Is there any way to convert text to image without using picturebox in vb6?

Question:

Introduction

I have a VB6 DLL that is generating an array of javascript commands that will be executed on an asp page to dynamically generate a PDF. Until then, all right! In this PDF I need to generate a barcode, the old system used a font that has the characters in barcode, however the PDF generator does not accept custom fonts.

imagined solution

The pdf generator (jspdf) accepts base64 images, so I thought of creating a routine that would generate a barcode image using the font and then encode that base64 image to be displayed in the PDF

Progress

  1. I managed to create the routine to transform an image path (ex: c:\image.jpg) into a base64 string and it works correctly.
  2. The javascript code generator also works correctly now.

difficulties

  1. I can only generate an image from a pictureBox;
  2. Because it's a DLL I can't create the pictureBox

You doubt

  1. Is there any way to transform text using barcode font without using picturebox?

Answer:

Due to the time this question remained unanswered, it was necessary to solve the problem as possible and within the stipulated time.

Solution:

  • The DLL generates the barcode number;

  • Asp takes the number and writes it with the barcode font in an invisible div;

  • The javascript after the page loads takes this image and transforms it to base64;

  • JavaScript then uses this base64 code in making the PDF;

I advise those who have a similar problem, which generate the pdf on the server, using some backend and then make it available to the client, it is one of the ways we do here and it is the most current (here). There are several ways to solve a problem, this one, despite not being the indicated one and being difficult to maintain, was the appropriate solution at the time, but it should be revised to avoid future problems.

Scroll to Top
AllEscort