cfdocument, cfpdf, DDX and Coldfusion Report Builder, a lesson in hodge podge

Coldfusion Add comments

This is a another rerelease of a post lost in the move, but was one of the most read on the previous blog.

Since the days of MX7 I have always had issues with CF's ability to properly build a dynamic PDF. FlashPaper always seemed to work better (made sense when Macromedia was in charge) but I thought for sure that PDF would "just work" when Adobe took over. I have been sadly mistaken in my thoughts and have experienced nothing but bug after bug. This most recent bug, is something that I have ALWAYS experienced but thought it would have been fixed moving to CF8. It is the issue that when placing images in the header and trying to size them. They just scaled willy nilly. Seriously, no rhyme or reason just scaling, I can refresh the page with the same data and get a different scaled image.

Well, it is crunch time on this project and I was at a loss. How do I REALLY make this work. I am not going to build custom one off PDFs, I am not going to play 9 out of 10 it works, none of it. In my searches I turned up SEVERAL people all experiencing the same problem and few suggestions for helping. I tried ALL the suggestions, and as with everyone else, they did not work.

Image DPI set to 90 on a mac, 96 on Windows. CF Report Builder, while very cool and a tool I will no longer ignore, it did not solve my issue because of some limitations. Using print CSS, use inches, centimeters, points, none of it worked. Then I stumbled on something. DDX. I found it in the CF8 Docs. It is a part of the LiveCycle ES PDF Assembler if I understand correctly and part (oddly not all, but I guess need to have something else to sell) of it works with CFPDF.

How does that help you ask. Well, it lets me strip background images and insert them using DDX instructions. It has worked like a charm. I will post some code Friday, I am beat from today and will be buried tomorrow, that shows off what I am doing to help all the others, but here is a description.

First I made a background image that was the full size of my document. I then made a PDF with that image as the background and nothing else. Next using Coldfusion I dynamically create my PDFs with the text in the right place and also generate a DDX file for processing. After all the files have been created (PDF and DDX) I call the DDX file that copies the background image from my stock PDF into the specific ones I want (some need it some don't) and then I combine all the PDFs, add headers and footers and display the link.

Here are some things that made this quite the experience:

1. Some pages are Legal, some are Letter.
2. Some pages are Portrait, some are Landscape.
3. Some need the logo in the header, some don't.
4. Some have headers and footers, others don't.
5. It has to be in a specific order and in one PDF.

UPDATED:  No code to post as I ran into some trouble with headers and am working through that right now using <CFIMAGE> of all things.

1 response to “cfdocument, cfpdf, DDX and Coldfusion Report Builder, a lesson in hodge podge”

  1. ann ann Says:
    interesting

Leave a Reply





Powered by Mango Blog. Design and Icons by N.Design Studio