HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › PD4ML Tips & Tricks › Case Study: PD4ML used on CCA + Images and fonts issues
- This topic has 1 reply, 2 voices, and was last updated Jan 30, 2010
01:27:00 by PD4ML.
-
AuthorPosts
-
September 2, 2009 at 20:35#26260
Hi, I used PD4ML for a pretty major site, the new version of the Canadian Centre for Architecture (http://www.cca.qc.ca). Our client needed to be able to generate PDF versions of their content in both English and French. We did some research and came across PD4ML (for which Chris has written this great Ruby wrapper: http://extonrails.com/?q=node/26) and integrated it into our publishing system. So, whenever our client wanted to publish or re-publish their content, they would generate 6 files – 1 HTML file for display on the site, 1 HTML file for print purposes, and 1 PDF file (also for printing or distributing) x 2 languages. Big props to Chris Scott on this one! There were a few hurdles that we had to overcome though and the solutions are probably applicable to a lot of other PD4ML users:
- First, images with relative urls didn’t seem to work. The solution was obvious – use absolute urls for which we created a little Ruby helper method that prepended the full path to the image.
- Second, and much more frustrating! It seems that PD4ML doesn’t quite support all of the CSS I thought it would. Even though I had thought it supported font-family CSS properties, I could never get my basic font choices to appear in the PDF’s. This was really frustrating since our client, the CCA is pretty rigorous about which fonts it uses in publications. So the solution: I broke down and used the super old-school font-tag. Yeah, it really isn’t standard compliant and that kind of drives me nuts, but since the file generated is intended only for print and export to PDF I guess it works. And thats the point, it really does work and so the fonts I required are there.
January 30, 2010 at 01:27#27533@RobotAyatollah wrote:
First, images with relative urls didn’t seem to work. The solution was obvious – use absolute urls for which we created a little Ruby helper method that prepended the full path to the image.
In general relative image references work correctly in PD4ML. A problem may happen in specific J2EE scenarios (a web application is deployed as non-expandable JAR or WAR file, for instance), but useServletContext() API call usually helps in such situations.
I would recommend you to switch the debug mode on (pd4ml.enableDebugInfo()) and to inspect the log file of the server. It should dump resolved relative URLs it tries to load.
@RobotAyatollah wrote:
Second, and much more frustrating! It seems that PD4ML doesn’t quite support all of the CSS I thought it would. Even though I had thought it supported font-family CSS properties, I could never get my basic font choices to appear in the PDF’s. This was really frustrating since our client, the CCA is pretty rigorous about which fonts it uses in publications. So the solution: I broke down and used the super old-school font-tag. Yeah, it really isn’t standard compliant and that kind of drives me nuts, but since the file generated is intended only for print and export to PDF I guess it works. And thats the point, it really does work and so the fonts I required are there.
You may use in the resulting PDFs virtually any TTF font of your choice, but for that you would need to utilize TTF embedding feature of PD4ML:
pd4ml-html-css-pdf-tips-tricks-f7/ttf-embedding-t42.html -
AuthorPosts
The forum ‘PD4ML Tips & Tricks’ is closed to new topics and replies.