views:

268

answers:

1

Hi there,

I'm using cfpdfform to read values from an uploaded PDF form created in Adobe Livecycle and then filled in using Adobe acrobat Acrobat.

To read the form values I use the command:

<cfpdfform source="#pathToNewPDFFile#" action="read" xmlData="xmlFields" />

But if a PDF without a form in is uploaded (i.e some other PDF) coldfusion errors with the following:

The source PDF document is not an interactive form.

Is there any way I can test for the presence of a form in a PDF in coldfusion without needing to catch and interpret this error?

I've tried cfpdf action="pdfinfo", but none of the variables appear to change between an interactive and non interactive form.

Thanks,

Tom

+4  A: 

I'd do a simple

<cftry>
  <cfpdfform source="#pathToNewPDFFile#" action="read" xmlData="xmlFields" />
  <cfcatch>
    <cfset xmlFields = XmlNew()>
  </cfcatch>
</cftry>
Tomalak
You have a typo: 'xfcatch' should be 'cfcatch'
Adam Tuttle
Thanks, fixed.
Tomalak
Hi, this is pretty much what I've done - my quesion is more is there a way do do this without using error handling e.g. some property or function I can call.
Loftx
Is something wrong with error handling here? I mean, it *is* an error, right?
Tomalak