Problem when displaying barcodes

571 views
Skip to first unread message

victmarqm

unread,
Jun 5, 2014, 5:44:11 AM6/5/14
to dom...@googlegroups.com
Hi! When using DOMPDF the barcodes and QR codes on my HTML document (generated with Zend Barcode library) display blurry, not sharp like they do on the HTML where they only have just black and white pixels. I've read all I could find on google. Changing the value of DOMPDF_DPI just affects the size of the images but they show blurry in any case. I have the same problem with div borders. A simple 1px black border of a div shows blurry. In this case is just an aesthetic problem but with the bar codes the barcode reader struggles to scan them so I need to solve it.
Any help would be really appreciated. Thanks a lot

BrianS

unread,
Jun 5, 2014, 3:00:35 PM6/5/14
to dom...@googlegroups.com
What format are the images output in? PNG images go through quite a bit of processing, which could be responsible for the blurriness.

A note about DPI. I recommend using 72, since that's the native resolution of PDF documents. Then you can specify your image resolution in PX and get a one-to-one correspondence in the PDF (1PX = 1PT).

Is there a sample online we can check?

victmarqm

unread,
Jun 5, 2014, 3:36:57 PM6/5/14
to dom...@googlegroups.com
A sample image:


I tried JPG with no luck. I need to set DOMPDF_DPI to 112 for barcodes to display the same size as in HTML. Setting it to 72 or 96 and css-resizing doesn't solve the problem. I have the same problem with the main div borders (you can see this simple 1 px solid black border fails to be displayed correctly just as the barcodes). The fonts displayed bigger in the pdf as well but I corrected it by setting specific css rules for the PDF case (fonts 1-2 points smaller). In the case of the border it doesn't matter but the barcodes need to be displayed sharp so the barcode scanner can red them quicker.

Thanks BrianS for your help
Reply all
Reply to author
Forward
0 new messages