Read the Community Blog

Trials and tribulations of TCPDF

I've been trying to get the PDF rendering working properly and I find that this is not as simple as I would like!

We are using Joomla which includes TCPDF as the default rendering engine, however the documentation on how to configure is weak to non-existent so I will capture my efforts here so we do not lose.

Configuration options are held in /cms/libraries/joomla/document/pdf/pdf.php rather than in /cms/libraries/tcpdf/config/tcpdf_config.php as you might expect.

The TCPDF library does not deal with images that have sizes specified very well, and seems to scale incorrectly. I have tracked down the problem to the image_scale variable in pdf.php as follows

// Scale ratio for images [number of points in user unit]
var $_image_scale = 1.75;

This is 4 by default (very small image), when set to 1.75 and using standard PNG or JPG images the image scale is fine. If you set scale to less than 1.5, the image expands off the page, and the PDF text gets corrupted. It may that the units need to be corrected (px rather than the default mm), as I have found that setting the image with no size attributes works fine.

The text formatting still needs some work, but this should be quite straightforward to correct.

The test pattern can be viewed here

The final problem to solve is how to get PDF renderer to use the PNG image rather than default SVG which is the preferred option we use on the site as it allows links for the controls. Unfortunately the SVG is too complex for the PDF renderer to handle...

Details on TCPDF API are available from http://api.joomla.org/1.5/com-tecnick-tcpdf/TCPDF.html

  • Created on .

Better printing for patterns

We will try and get the printing improved as a priority. We know that quite a lot of our users want to easily print the patterns, and right now they do not print very well. One option is a PDF converter, although when we tested this a while back it did not work very well. Stay tuned and we should have an answer soon!
  • Created on .

Summer hibernation

Just a quick note to say that while progress has been slow lately due to the summer here in the Northern Hemisphere where the core team are located, we are still working according to the roadmap and you can expect to see some new patterns and other artifacts as we head into September and October.

It's not so much fun working on a PC after work when there are long evenings to be spent in the garden, playing with the children, and generally enjoying life :-)

  • Created on .

New data security pattern

I finally got round to finishing the draft of the data security pattern.

Fortunately (perhaps less so for the civil servants concerned) the UK government has had some major data protection issues of late, and consequently have issued some great guidance materials in the form the of Poynter and Hannigan reports, which I have used to form the backbone of the pattern.

Interested in getting a sense if you think this is a worthy architectural topic, and if this is a hot spot for you. We're planning to move this into the pattern section in the next couple of days.

Cheers,
Spinoza

  • Created on .

OSA presentation at OWASP chapter meeting

At the recent OWASP Switzerland chapter meeting, I have presented OSA. We have got some positive and constructive feedback and look forward to more contributors :-).  Most importantly we have heard again that also for security architecture pattern applies: "the more the merrier" Laughing

You can find the presentation here:

OSA Presentation 2009 April

 

  • Created on .