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

Dec 23 by Michael Benner

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 of all things and the fact that some server problems have kept me from posting until the host could get them straight. Hopefully, this will all be resolved to a posting tomorrow night.


Comments (2)              | 695 Views | Tags: Report Builder, Coldfusion, DDX, Programming


Comments
Randy Martin's Gravatar Did you ever get this working? I'm having all kinds of problems with the new CF 8 report builder. Namely, the internal routines that calculate the total page length completely ignore hard page breaks inserted in the report template. This makes it impossible for me to have a long detail section. The .cfr file is generated correctly, but the report won't run because the engine thinks it's larger than the page. Very frustrating!

Also, do you know any way to have one report call another report upon completion?

Thanks,
Randy
# Posted By Randy Martin | 4/29/08 3:39 PM
Mike Benner's Gravatar I have abandoned report builder as it would not meet my needs once things became complicated.

As for dynamic PDFs and DDX, it worked OK, but still lacked in functionality. we ultimately had to compromise and make the PDFs simpler. I have found myself doing most of the work CF with DDX as a helper. I am actually going out next week to spend some time with this client reworking the PDFs and will post my findings.
# Posted By Mike Benner | 4/29/08 10:15 PM