Login

    Register

Managed Hosting

PROJECT CATEGORIES

 

PDFUtils
Project Home Known Issues Contact Project

PDFUtils Issue: Premature end of file error

Name: Premature end of file error
ID: 1
Project: PDFUtils
Type: Bug
Area: Code
Severity: High
Status: Open
Related URL:
Creator: paul
Created: 05/11/09 5:02 PM
Updated: 08/12/10 11:47 AM
Description: The following code works great on text PDFs:
<cfset pdf = createObject("component", "pdfutils")>
<cfset mypdf = expandPath("test.pdf")>
<cfset eInfo = pdf.getExtraInfo(mypdf)>

But on scanned PDFs it gives the following error:

An error occurred while Parsing an XML document.
Premature end of file.
The error occurred in C:\Inetpub\wwwroot\books\pdfutils.cfc: line 43
43 :    <cfset myxml = xmlParse(myxml)>

Could you please be so kind as to suggest a fix, if it's not too much trouble?

Thanks!
History: Created by ebookdev (paul) : 05/11/09 5:02 PM

Comment by cfjedimaster (Raymond Camden) : 05/11/09 5:21 PM
Could you send me a PDF as an example?

Comment by ebookdev (paul) : 05/11/09 8:10 PM
http://66.199.183.198/test.pdf

Comment by cfjedimaster (Raymond Camden) : 05/11/09 11:43 PM
paul - I was in the middle of downloading your PDF when the connection died. When I tried to get it again, I couldn't connect at all. Is your server down?

Comment by ebookdev (paul) : 05/12/09 3:59 AM
Sorry, can you please try again now?

Comment by ebookdev (paul) : 05/12/09 12:02 PM
I uploaded a second smaller sample. It's at: http://66.199.183.198/test2.pdf

I tried inserting a pause with java before your cffile=read thinking maybe you were reading the output before it was fully written but that didn't help.

Comment by cfjedimaster (Raymond Camden) : 05/13/09 5:04 PM
I'm not able to reproduce this, but the error interesting. It is throwing an error trying to read in the temp XML file it creates. Can you add some debugging? First, before line 43, add <cfdump var="#outputStruct#"> You should see a filename. This is the file the CFC is trying to read. Look on the file system for this file and tell me if you see it. Actually, you can just do:

<cfoutput>#tempxml#</cfoutput><cfabort>

THat will give you the filename. See if the file exists before line 42.

Comment by maryjos (Mary Jo Sminkey) : 08/12/10 11:35 AM
I am having this problem as well, I'm on CF 9.01. It is creating the tmp files, but they are blank, hence the error when trying to parse them.

Comment by maryjos (Mary Jo Sminkey) : 08/12/10 11:47 AM
Never mind...it does seem I run into the same problem with the CF9 extracttext option, seems a few of my PDFs have some kind of issue that's causing a problem with parsing.

To add a comment to this bug, please login using the link above.