in reply to Converting all files in a directory to PDF

That error is typically a (XML) parsing error.

It relates to the content of one of your files.

Check line 2 of the data file.

        "You're only given one little spark of madness. You mustn't lose it."         - Robin Williams

  • Comment on Re: Converting all files in a directory to PDF

Replies are listed 'Best First'.
Re^2: Converting all files in a directory to PDF
by Acar (Initiate) on Oct 16, 2014 at 01:31 UTC
    The format of the .html files been converted to .pdf must follow a certain format? How would I know that?
      "html" files have to follow the rules of "html" syntax. Undefined tags, missing tags, typos,... all these can mess up an html file such that the converter gets confused. Most browsers can work "around" such errors (or rather silently drop these errors and simply hope for the best), but this converter seems more strict. You'd be surprised how few html pages on the web are actually fully compliant with the HTML syntax rules.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      My blog: Imperial Deltronics
      You need to narrow down the problem to one of your HTML files.

      You either learn and use the perl debugger (perl -d) and put a breakpoint before the failure, then check the file name being processed, or, create a source directory with only one html file at a time.

      It looks like the HTML may be malformed on line 2 of that file. Also check encoding utf8 ?

              "You're only given one little spark of madness. You mustn't lose it."         - Robin Williams

        No - just show us the first 3 lines of the html that is failing.

        Also, try running your code using:
          perl -d <your-code-file-name>

        Then, at the prompt, enter "c" (without the quotes), and <ENTER>.

        WHen your program crashes, there should be line numbers to look at. You can do a lot more with the "-d" option, including examining the data that caused the failure.

                "You're only given one little spark of madness. You mustn't lose it."         - Robin Williams