in reply to Re: Converting all files in a directory to PDF
in thread Converting all files in a directory to PDF

The format of the .html files been converted to .pdf must follow a certain format? How would I know that?
  • Comment on Re^2: Converting all files in a directory to PDF

Replies are listed 'Best First'.
Re^3: Converting all files in a directory to PDF
by CountZero (Bishop) on Oct 16, 2014 at 06:26 UTC
    "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
Re^3: Converting all files in a directory to PDF
by NetWallah (Canon) on Oct 16, 2014 at 03:25 UTC
    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

Re^3: Converting all files in a directory to PDF
by thewebsi (Scribe) on Oct 16, 2014 at 03:25 UTC
      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