Posts or Comments 06 January 2009

ColdFusion Matt | 18 Sep 2008 09:36 am

PDFFileNotFoundException Inside IsPDFFile and IsPDFObject

I’m having a heck of a time using pdf document variables in CF 8.0.1 on Mac OS X 10.5 and Redhat Linux ES 5.  Those are the only platforms I have to test cf with so perhaps this is a windows issue as well.

From Adobe’s IsPDFObject documentation, I’ve taken their example of reading in a file as a pdf object and writing it out.  I’ve even gone the extra step of making sure cf thinks the input file is a valid pdf.


<cfif IsPDFFile("filein.pdf")>
<cfpdf source="filein.pdf" action="read" name="myPDFform"/>
<cfif IsPDFObject(myPDFform)>
<cfpdf source=#myPDFform# action="write" destination = "fileout.pdf">
<cfelse>
<p>This is not a PDF.</p>
</cfif>
</cfif>

CF thinks the file is a pdf, it reads the file, it thinks the pdf document variable is valid, then when it tries to write, I get an error:


The file or directory (/Library/WebServer/Documents/coldfusion.pdf.PDFDocWrapper@1547134d) specified in the source attribute in the CFPDF tag does not exist.

The error occurred in /Library/WebServer/Documents/test.cfm: line 4

2 : <cfpdf source="filein.pdf" action="read" name="myPDFform"/>
3 : <cfif IsPDFObject(myPDFform)>
4 : <cfpdf source=#myPDFform# action="write" destination = "fileout.pdf">
5 : <cfelse>
6 : <p>This is not a PDF.</p>

Given where CF seems to be generating a temp file I could see this being a problem on my Linux box where cf can’t write to the webroot.  That would not be a problem on my local dev environment though where I can write to the webroot.  On both machines I can successfully access pdf files themselves and write to different files to add watermarks, get and set info, etc.  I just cannot work with the pdf document variable at all.  The last pdf file I tested with here was the CF 8.0.1 release notes from Adobe at around 250k.

When I get a solution to this issue, I’ll post it.  If anyone has any thoughts here I’m all ears.  Hopefully someone can point out that I’m doing something stupid and share a correction.  Otherwise I’ll submit a bug to Adobe.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Slashdot
  • StumbleUpon
  • Technorati

Trackback This Post | Subscribe to the comments through RSS Feed

Leave a Reply