#1 2011-03-20 23:34:15

eraldo
Member
From: Brasil
Registered: 2010-07-22
Posts: 69
Website

How do I add a barcode in a PDF.

Would give a code example?

Offline

#2 2011-03-21 07:22:23

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,237
Website

Re: How do I add a barcode in a PDF.

See http://synopse.info/forum/viewtopic.php?pid=684#p684

Some hints how to insert an image to the pdf content.

Offline

#3 2011-03-21 13:11:42

eraldo
Member
From: Brasil
Registered: 2010-07-22
Posts: 69
Website

Re: How do I add a barcode in a PDF.

I understood, but create the bar code is still not possible?

Offline

#4 2011-03-22 23:41:37

reddwarf
Member
Registered: 2010-06-28
Posts: 40
Website

Re: How do I add a barcode in a PDF.

use TPSysTools to generate a barcode + export it to bitmap/WMF + draw it onto PDFCanvas.

but I had best results by generating a 1:1 barcode with TPSysTools onto a bitmap - then you have to scan the image for each pixel and generate a rectangle over each "black area". this is needed because TPSysTools generate one rectangle per barcode pixel which can end up in non consistent "black areas" on the print because the rectangles are scaled and so rounding errors can occure. I know it is not the most efficient method, but quick-and-dirty is sometimes good enough wink

Last edited by reddwarf (2011-03-22 23:53:50)

Offline

#5 2011-03-23 08:01:57

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,237
Website

Re: How do I add a barcode in a PDF.

TPSysTools is great, and open source software.

If you have an WMF, you can draw it on the PDFCanvas.

It will be vectorial, so I guess it could work perfectly with PDF and create smaller files.
I think there is perhaps some problems with WMF, since EMF is the native format of our canvas.

Offline

#6 2011-03-23 15:22:44

eraldo
Member
From: Brasil
Registered: 2010-07-22
Posts: 69
Website

Re: How do I add a barcode in a PDF.

If we could add a unit to generate bar code would be interesting right?

Offline

#7 2011-03-24 23:49:36

reddwarf
Member
Registered: 2010-06-28
Posts: 40
Website

Re: How do I add a barcode in a PDF.

eraldo: i don't think so - just follow my/arnauld's instructions and you will be able to generate a pdf barcode with very little effort. look at the examples in TPSysTools and do what you want. there are so many different barcode types, for example. the demos are very straightforward.

to arnauld: the problem with wmf/emf originally generated with TPSysTools is that when they are scaled, "new white lines" can occur in the barcode because of rounding errors when scaling. this is because a bar with the width of 2px is generated with 2 bars with the width of 1px. that's the problem. but maybe someone changed it since i had the problem wink

Offline

Board footer

Powered by FluxBB