cfdocument format=”PDF”>htmlcfdocument> filename attribute, ColdFusion MX streams output to yes: ColdFusion retrieves image files directly from. There are 76 supported CSS styles; see ColdFusion//CFMLRef/WSc3ff6d0eaecbec22cc html for the. Figured it out. Had to create the document using CFDOCUMENT, then add a ” Title” attribute to it using the CFPDF tag. Then output it to the.
|Published (Last):||5 March 2014|
|PDF File Size:||6.76 Mb|
|ePub File Size:||1.96 Mb|
|Price:||Free* [*Free Regsitration Required]|
It also needs to use a specified font, OCR-B, so that a line of text on the printed form can be machine scanned. I was at first thinking I might be able to use the new cfhtmltopdf tag, but quickly dropped that idea: After looking around over the fence for a bit at potential solutions outside of CFML, nothing hit me as particularly appealing, so I dug into getting cfdocument to work as best I could. First the tag attributes. LocalUrl is set to true to easily pull in a logo image from the local file system.
Nested directly within the cfdocument tag is a div tag that sets the page width, with position: Then within that parent div tag are nested the various div tags, absolutely positioned, containing the blocks of text and images that make up the PDF content. Here are a few examples to demonstrate:.
What I really like about this approach is that each of coldfjsion text blocks winds up very close to the top and left dimensions specified, and the ACF and Lucee outputs are nearly identical. Without the parent div tag specifying the width, the results between the 2 engines are vastly different, and positioning the elements is much more a question of trial and error than simply entering the top and left positions as measured with a ruler and perhaps tweaking them by a few milimeters if necessary.
Also without the parent div cfddocument to control how layout elements scale, changing the dimension of one absolutely positioned div within the PDF can easily alter the colldfusion or size of other divs, which can be very frustrating if you have 20 or 30 elements that all need to be precisely positioned.
For myself, I found it easier simply to measure placement from the edge of the page. Specifying a font for a block of text is simple. As of this writing, available CSS attributes remain limited.
Unless something changes in the future, forget OTF fonts for cfdocument. I tried a bunch that already seemed to be recognized, none worked. From my experience, using the font face name in your CSS specification should work.
If not, try the other names – I saw a post suggesting that. The file name often does not match the font name.
ColdFusion Help | cfdocument
For Lucee, the process is different. Copy it to a working directory, rename cdfocument copy to fonts. In the unzipped fonts directory that results, add your custom font files, again use only TTFs, and then open the pd4fonts. Keep a copy of it, just in case … replace the old fonts. Of course, the above approach for Lucee 4.
But for now, it works like this. A big thanks to Michael Hnat for pointing me in the right direction regarding Lucee with his very helpful blog post.
There is a logo image at the top of this PDF that was scaling up when rendered in Lucee in a way that caused it to be misplaced. After a bunch of reading that indicated cfdockment the image print size or resolution would not help, I tried adding a css style declaration to the image that specified a size in mm, and it worked!