Menu

ColdFusion 9 Integration

Help
2012-03-30
2013-04-29
  • James Moberg

    James Moberg - 2012-03-30

    Adobe ColdFusion 9 generates bloated PDF files.  (This is a complaint by many of my clients.)  I've been using the 32bit command line Ghostscript to optimize PDFs. Many of the dependencies are already available in ColdFusion, but sometimes an older version is used.  Could you confirm whether this will cause any problems or not?

    I added JNA & xmgraphics as they were not already used by ColdFusion.  commons-logging-1.1.1 and log4j-1.2.15 were the same, but here are the other library versions.  (I didn't want to replace in case something would break in ColdFusion.)

    GHOST4J COLDFUSION 9 (Jrun.  CF 10 Beta-runs on Tomcat)
    commons-beanutils-1.8.3 commons-beanutils-1.8.0
    itext-2.1.7 iText.jar (2.1.0?)
    commons-io-1.3.1 commons-io-1.4

    I've been able to get a high level demo to work:

    //http://ghost4j.sourceforge.net/highlevelapisamples.html 
    //Count pages of a Postscript document using PSDocument (modified to use PDF document)
    PDFDocument = createObject("java","net.sf.ghost4j.document.PDFDocument");
    iFile = createObject("java","java.io.File").init("c:\inetpub\wwwroot\ghosttest.pdf");
    PDFDocument.load(iFile);
    writeoutput('Pages: ' & PDFDocument.getPageCount() & '. Document Type:' & PDFDocument.getType());[code]
    The command-line equivalent that I want to execute is:
    [code]gswin32 -sDEVICE=pdfwrite -dPDFSETTINGS=/default -dNOPAUSE -dQUIET -dBATCH -sOUTPUTFILE=c:\out\test.pdf c:\in\test.pdf[/code]
    Any assistance or recommendations would be greatly appreciated.  Thanks.
    
     
  • zippy1978

    zippy1978 - 2012-03-30

    Hi,

    To do the same as your command line with Ghost4j, you can reuse the PDFConverterExample (http://ghost4j.sourceforge.net/highlevelapisamples.html)

    Use the converter.setPDFSettings(…) option on the converter to set the desired output quality.

    Regards,
    Gilles

     

Log in to post a comment.