New to DOMPDF - Questions

139 views
Skip to first unread message

Mark

unread,
Feb 10, 2020, 5:09:14 PM2/10/20
to dompdf
Hi,

I'm a reasonably new import to PHP, and I've started on the PDFing quest. I couldn't really find

First question, is something like the attached image possible? I've started down this path, but I'm starting to wonder if perhaps this is too complex?

Secondly, Font import. I have a TTF for a font stored on the Apache server, and I have tried absolute references (starting with a /) and relative (../fonts/) - neither of which really work.

Third, the font sizes don't appear to be working. They're done with em's. Should that be avoided?

Any other noob suggestions you might have would be appreciated.

Mark
FakeInvoice.png

BrianS

unread,
Feb 10, 2020, 8:50:09 PM2/10/20
to dompdf
First: that design should be possible, though you may have to fiddle with your HTML + CSS a bit to make it something that Dompdf likes. But the basic layout seems simple enough.

Second: is that your issue in github? If so check there.

Third: em's are fine though 0.8.4 has a bug that may be affecting your layout. A new release should be going out this week to address it. You can try 0.8.3 in the meantime to see if it works OK.

M

unread,
Feb 11, 2020, 5:04:55 PM2/11/20
to dompdf
Hi Brian,

Yup, that was me.

Now that I've inline'd the CSS, the EMs are working happily.

Will continue on Github

M

unread,
Feb 24, 2020, 5:17:55 PM2/24/20
to dompdf
Follow Up

Fonts
The link to Github mentioned above is:https://github.com/dompdf/dompdf/issues/2083

All the detail is there, but the overview is that I didn't have write permissions for the correct fonts folder - and DOMPDF (et al) couldn't write the caching file.

But that's not all, it didn't appear to want to write anything, so I actually had to download DOMPDF/Utils ( As noted in the summation: https://github.com/dompdf/dompdf/issues/2083#issuecomment-588587182 ) and manually (from bash command line) add the fonts in.

Once the cache file (dompdf_font_family_cache.php) was created, and the fonts were copied into the right directory, it all started working.

Conditional Header
This was slightly harder, under the direction of BrianS, I fixed positioned the header - which made it happen on every page (including page 1), and then I absolutely positioned the first page header over the top of it. (or at least, I tried.)

I did get it working - after trying all the expected CSS fixes for layered elements, I tried z-index:-1 on the fixed element. That did the trick.


Thank you BrianS for all the support, help and insight. Appreciate it lots.
Reply all
Reply to author
Forward
0 new messages