Replies: 1 comment 1 reply
-
Your custom paper size should not include units. Dompdf expects an integer representing the dimensions in pt (the native PDF unit). Though Dompdf does parse them through floatval, so while your syntax is incorrect it won't break rendering. PDFs have a fixed resolution of 72ppi (pt per inch). I'd have to see reference documentation for the cards, but 300 DPI may refer to the resolution of the images included in the PDF. So long as you utilize JPG that shouldn't be a problem. Other image formats, and all background images, require extra processing so the extra resolution would be lost. The Dompdf DPI is basically a translation from px to pt. That's why we recommend sticking to 72, you get a one-to-one match against the PDF dimensions. If you want to stick with 300 DPI, then use real-world units (such as in) or pt to represent your dimensions. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I wrote a webapp to design cards.
Now i'm trying to write them into a pdf file with dompdf, so I can send them to a printing firm.
I defined the size of a page with:
$customPaper = array(0,0,'673px','1051px');
$dompdf->set_paper($customPaper);
But when I write a div-tag with width=673px and height 1051px it is much smaller than the page.
What am I doing wrong?
I read in this forum, that I should not change the dpi and by default it ist set to 72. For printing the cards they shoukd have a dpi of 300.
Is there anything I can do?
Can I use dompdf for my project?
Thanks for helping me. :)
Greetings from Germany,
Fabrice
Edit: the ratio from the div tag to the size of the Paper ist 0.75. But I don't knw why.
Beta Was this translation helpful? Give feedback.
All reactions