Convert html to image and add into a pdf using coldfusion

722 views Asked by At

I am using cfpdf and cfdocument to create thumbnails and save them to a pdf. Everything works ok but I don't like the resolution. What other approach can I use to generate images from HTML, then create a pdf with those images.

2

There are 2 answers

1
James On

Without more details on your issue, I can only guess at a solution. That said, when using cfpdf action="thumbnail", there is an attribute called hires which can be set to "yes". This will retain the resolution of the image (doesn't shrink it down). If that doesn't do the trick, you could combine hires="yes" with scale="100" to retain the original dimensions of the image. The resulting image should be identical in size and resolution to the source document, and you are free at this point to use CSS to control the actual size of the image on the pdf during cfdocument.

0
Rodrigo Celebrone On

I solved my issue, just need to use a combination of maxBreadth + scale = 100. But remember, hi maxBreadth number result in a slow process to generate thumbnails.

if you only use scale = 100, thumbanail will be generated based on your html page, if you want a increase the width of the thumbail to generate a better resolution thumbnail, you need to use maxBreadth.