Forum Bugs

general errors

inx_dev
Hey all, Recently purchased the PrinceXML software, and am running into some parsing problems.

I have logging turned on, trying to output three pdfs and this is what it outputs:

PDF1:
Wed Jan 9 09:39:33 2008: ---- begin
Wed Jan 9 09:39:33 2008: -:1: error: htmlParseEntityRef: expecting ';'
Wed Jan 9 09:39:33 2008: internal error: io_error("error writing to output file: Invalid argument")

PDF2:
Wed Jan 9 09:41:31 2008: ---- begin
Wed Jan 9 09:41:31 2008: -:3: error: htmlParseStartTag: invalid element name
Wed Jan 9 09:41:31 2008: internal error: io_error("error writing to output file: Invalid argument")


PDF3:
Wed Jan 9 09:50:33 2008: ---- begin
Wed Jan 9 09:50:34 2008: finished: success
Wed Jan 9 09:50:34 2008: internal error: io_error("error writing to output file: Invalid argument")

I'm assuming there is some invalid XML/HTML somewhere, but I'm not positive, the logging is a little bare about what/where its goings wrong. Anyone have any idea? the problem with the XML/HTML is that its dynamically generated, so it can be anywhere. It would be tremendously helpful to be able to point straight at a line and see whats breaking it.
mikeday
These messages indicate invalid HTML on lines 1 and 3 of the input file respectively:
Wed Jan 9 09:39:33 2008: -:1: error: htmlParseEntityRef: expecting ';' 
Wed Jan 9 09:41:31 2008: -:3: error: htmlParseStartTag: invalid element name

The first one probably relates to the use of an unescaped ampersand character (&) which needs to be written &amp; in HTML or XML documents, the second probably relates to the use of an unescaped less-than character (<) which needs to be written &lt; however these aren't serious problems.

The final error message is more serious, as it seems that Prince cannot write out the generated PDF file to the specified output. Are you calling Prince through the PHP or Java interface?
inx_dev
thanks for the fast reply!

I'm actually writing it out through a Ruby interface via a command line call.
inx_dev
I've fixed the htmlParseEntityRef and HtmlParseStartTag errors,
however, the last one is still left. The io_error. Whats strange is.. that it DOES actually output a file even if we get that error. Any idea as to why?

also, I didn't mention this before, but we've created a lot of documents and only sometimes do we get this io_error.

thanks again!
mikeday
So you are directing Prince to write the PDF to a file on disk, not to the standard output stream to be captured by your Ruby script? Also, are you running on Linux, Windows or MacOS X?
inx_dev
First, sorry for the long delay, lots of stuff happening at work =]

Just now was able to get back to this again.
Yes, I have Ruby calling PrinceXML to produce a PDF on the server, and then its in turn printed. Running it on Windows.
This is all the output im still receiving:

Tue Jan 22 14:06:30 2008: ---- begin
Tue Jan 22 14:06:30 2008: finished: success
Tue Jan 22 14:06:30 2008: internal error: io_error("error writing to output file: Invalid argument")

If I check the output dir, it outputs and it APPEARS to be correct, but I need to be certain that something isn't breaking and producing half-correct data sometimes.
mikeday
The "finished: success" message is not logged until after the entire PDF file has been successfully written, so there should be no problems with that. The error message appears to relate to writing the log itself, which should finish with "---- end" just after the finished message. I'm not sure why it's failing to write the last line of the log. Do you get this behaviour when running it from the command-line, or only from Ruby? Does it happen every time or only sometimes? Are multiple Prince instances writing to the same log file?
inx_dev
It's kind of hard to run the exact same command from the command line manually, as whats happening in Ruby is that there is a TON of generated content. However, if I use minimal content, everything works great, and the log does as you say it should '--begin' followed with an '--end'.

It seems to be happening every time at the moment and it's possible that multiple instances may be writing at the same time in the future, but at the moment its just me testing, so theres only one (me) writing to it now.
mikeday
We haven't been able to reproduce this yet, the ideal solution would be if you could capture one of the generated documents that you're feeding to Prince and try running it through Prince with the same command-line but not from Ruby, that would help to isolate the problem.