Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Coldfusion PDF DDX problem.

New Here ,
Jun 08, 2009 Jun 08, 2009

I have a problem when trying to add footers to the bottom of a PDF.  It would seem that there might be a BUG in ADOBE's DDX processing;

When I try to add a footer on this particular document I get the following when I cfdump out the ddx variable:

failed: CCITTFaxDecode Filter

So this document has a fax image in it (not a real shocker) but why do we get these sort of problems?

Does anyone have a solution?

622
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 09, 2009 Jun 09, 2009

Attached is a copy of the pdf in question

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 17, 2009 Jun 17, 2009
LATEST

It sounds like a bug.  As a work-around, you can use iText instead of ddx to add footers.  Here is an example that adds page x of y footers.

<cfscript>
    pathToInputFile = ExpandPath("GDC.pdf");
    pathToOutputFile = ExpandPath("GDC_Stamped.pdf");

    try {
        // create the footer font
        BaseFont = createObject("java", "com.lowagie.text.pdf.BaseFont");
        footerFont = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);

        // read in the input file
        reader = createObject("java", "com.lowagie.text.pdf.PdfReader").init(pathToInputFile);
        totalPages = reader.getNumberOfPages();

        // create a stamper for modifying the pdf
        outStream = createObject("java", "java.io.FileOutputStream").init( pathToOutputFile );
        stamper = createObject("java", "com.lowagie.text.pdf.PdfStamper").init(reader, outStream);

        // for each page
        i = 0;
         while (i LT totalPages) {
            i = i + 1;
            // add page numbers to the overcontent layer
            over = stamper.getOverContent( javacast("int", i) );
            over.beginText();
            over.setFontAndSize(footerFont, javacast("float", 18) );
            over.setTextMatrix( javacast("float", 30), javacast("float", 30) );
            over.showText("Page " & i &" of "& totalPages);
            over.endText();
         }

        WriteOutput("Finished!");
    }       
    catch (java.lang.Exception e) {
        savedErrorMessage = e;
        WriteOutput("Unable to create document "& e.message);
    }
    // closing PdfStamper will generate the new PDF file
    if (IsDefined("stamper")) {
        stamper.close();
    }
    if (IsDefined("outStream")) {
        outStream.close();
    }
</cfscript>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources