简体   繁体   中英

Check if interactive form exists in ColdFusion before using cfpdfform action=“read”

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

To read the form values I use the command:

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

But if a PDF without a form is uploaded (ie 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

I'd do a simple

<cftry>
  <cfpdfform source="#pathToNewPDFFile#" action="read" xmlData="xmlFields" />
  <cfcatch>
    <cfset xmlFields = XmlNew()>
  </cfcatch>
</cftry>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM