Code128 source rendering error

Asked

Viewed 462 times

-2

I have developed a report in Genexus X Ev1 that needs to print the barcode using the Code128 font. It is compiled in .NET.

In the development environment (Windows 2012) everything works perfectly. The problem is on the production server (Windows 2008). In the print of the pdf instead of the image appear numbers.

I tried to reinstall the source on the production server and apparently this ok. However the printing/rendering of the pdf in any browser is wrong.

Any suggestions about other settings I should check?

  • 5

    The suggestion would be not to use font to generate bars. Despite the convenience, barcode are so simple that it costs nothing to draw straight by the application (in particular the C128). If you’re really going to insist on the source and you don’t want any trouble, you need to do the embed of it in the PDF, not just make it available on the machine. But make sure that bar font embed is always a second-rate solution, to say the least.

  • Genexus has a configuration file that takes care of embedding the source by generating the pdf as commented below.

2 answers

0

  • I came to this logical conclusion, but the problem is that even putting them identical does not work on the production server.

0

In order for the user to view the source correctly, the source must be on his computer, not on the server.

If you are going to serve a PDF as a page element, the only cohesive solution is to generate the corresponding image.

With the source on the server, you can generate the image with the graphical framework libraries, i.e.:

string nomeDaSuaFonte = "eu não sei o nome de família dela, mas você pode descobrir. Substituia por este texto.";
var fontFamily = new FontFamily(nomeDaSuaFonte);
var font = new Font(fontFamily, 32, FontStyle.Regular, GraphicsUnit.Pixel);
var solidBrush = new SolidBrush(Color.Black);

var bitmap = new Bitmap(largura, altura); // Monte conforme suas necessidades
var graphics = Graphics.FromImage(bitmap);

graphics.DrawString("seu código de barras aqui", font, solidBrush, new PointF(10, 60));

You can also generate a PDF on the server. There are several libraries for this. If you are using MVC, I suggest using Rotating. You still need to generate the barcode as an image, as above, but at least you ensure that the user has access to a PDF with the correctly rendered barcode.

  • Genexus generates the code c#. I don’t have direct access to the generated source code.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.