wkhtmptopdf error 127

(7 posts) (2 voices)
  1. rblanalt, Member

    Hi,

    If I try to export a result to PDF then I get this error:
    (hostname is changed in the message)
    There was an error (code:127) producing the pdf document
    Failed command: wkhtmltopdf -q --header-html https://xxx.xxx.com:8080/mydbr/user/export_header_pdf.php --replace rdate "2016-01-07" --replace rtime "15.56.35" --margin-top 20 --header-spacing 8 /tmp/mydbr_export_81426788.html -

    This does work:
    wkhtmltopdf https://google.com test.pdf

    Version of wkhtmltopdf is : 0.12.2.1 running on CentOS release 6.5 (Final)
    X is envirement not installed on the server.
    MYDBR 4.6.0 is installed

    Can you help?

    Thanks
    Ronny

  2. myDBR Team, Key Master

    Ronny,
    first of all, make sure your export_header_pdf.php is up to date. To ensure this, go to 'Server side files' and open the export_header_pdf.php from myDBR.com (bottom left) and optionally replace your copy of the file.

    Secondly, to see what is actually causing the problem in your case, use the debug export option to produce the HTML file.

    select 'dbr.export.options', 'debug', 1

    When you run the report next time, myDBR will show you the commands you can use from command line. The error messages from the command line can be more verbose.

    --
    myDBR Team

  3. rblanalt, Member

    Hi,

    I did update the export_header_pdf.php, but I get the same error.

    This is teh start and the end of the output of wkhtmltopdf command (or can I upload the complete Output somewhere):

    %PDF-1.4
    1 0 obj
    <<
    /Title (<FE><FF>^@T^@r^@a^@n^@s^@m^@i^@t^@ ^@A^@u^@t^@o^@r^@i^@z^@a^@t^@i^@o^@n^@ ^@L^@i^@s^@t^@ ^@V^@i^@e^@w^@ ^@o^@n^@l^@y^@ ^@t^@e^@s^@t^@ ^@-^@ ^@m^@y^@D^@B^@R^@ ^@T^@e^@c^@h^@c^@o^@m)
    /Creator (<FE><FF>^@w^@k^@h^@t^@m^@l^@t^@o^@p^@d^@f^@ ^@0^@.^@1^@2^@.^@2^@.^@1)
    /Producer (<FE><FF>^@Q^@t^@ ^@4^@.^@8^@.^@6)
    /CreationDate (D:20160108084110Z)
    >>
    endobj
    3 0 obj
    <<
    /Type /ExtGState
    /SA true
    /SM 0.02
    /ca 1.0
    /CA 1.0
    /AIS false
    /SMask /None>>
    endobj
    4 0 obj
    [/Pattern /DeviceRGB]
    endobj
    8 0 obj
    <<
    /Type /XObject
    /Subtype /Image
    /Width 118
    /Height 78
    /BitsPerComponent 8
    /ColorSpace /DeviceRGB
    /Length 9 0 R
    /Filter /DCTDecode
    >>
    stream

    1 begincodespacerange
    <0000> <FFFF>
    endcodespacerange
    2 beginbfrange
    <0000> <0000> <0000>
    <0001> <002E> [<0054> <0072> <0061> <006E> <0073> <006D> <0069> <0074> <0020> <0041> <0075> <006F> <007A> <004C> <0056> <0065> <0077> <006C> <0079> <0053> <0052> <0043> <0063> <0048> <0067> <004B> <0055> <0032> <0033> <002C> <0035> <0037> <0030> <0031> <0036> <002D> <0034> <002E> <006B> <0064> <004D> <004E> <0078> <0070> <0038> <002F> ]
    endbfrange
    endcmap
    CMapName currentdict /CMap defineresource pop
    end
    end

    endstream
    endobj
    6 0 obj
    << /Type /Font
    /Subtype /Type0
    /BaseFont /NimbusSanL-Regu
    /Encoding /Identity-H
    /DescendantFonts [22 0 R]
    /ToUnicode 23 0 R>>
    endobj
    2 0 obj
    <<
    /Type /Pages
    /Kids
    [
    5 0 R
    ]
    /Count 1
    /ProcSet [/PDF /Text /ImageB /ImageC]
    >>
    endobj
    xref
    0 25
    0000000000 65535 f
    0000000009 00000 n
    0000014700 00000 n
    0000000275 00000 n
    0000000370 00000 n
    0000003691 00000 n
    0000014559 00000 n
    0000009040 00000 n
    0000000407 00000 n
    0000003621 00000 n
    0000003641 00000 n
    0000004019 00000 n
    0000005603 00000 n
    0000003812 00000 n
    0000003999 00000 n
    0000005624 00000 n
    0000005833 00000 n
    0000008163 00000 n
    0000008470 00000 n
    0000008142 00000 n
    0000009181 00000 n
    0000009390 00000 n
    0000013418 00000 n
    0000013821 00000 n
    0000013397 00000 n
    trailer
    <<
    /Size 25
    /Info 1 0 R
    /Root 10 0 R
    >>
    startxref
    14798
    %%EOF

  4. myDBR Team, Key Master

    Ronny,
    when you test the PDF creation, save the output to a file.

    $ wkhtmltopdf -q --header-html https://xxx.xxx.com:8080/mydbr/user/export_header_pdf.php --replace rdate "2016-01-07" --replace rtime "15.56.35" --margin-top 20 --header-spacing 8 /tmp/mydbr_export_81426788.html > test_file.pdf

    Then open the generated file with PDF reader (valid PDF files start with "%PDF-"). If the file generated is OK, the next step is to find our why calling from PHP does not work.

    --
    myDBR Team

  5. rblanalt, Member

    Hi,
    The output is a valid PDF.
    So file is generated correctly.

    What information do you need to debug why it is not working if called from PHP

    Ronny

  6. myDBR Team, Key Master

    First thing to check is that PHP is able to find the wkhtmltopdf program (path is set correctly).

    Access the troubleshoot script found at:

    https://xxx.xxx.com:8080/mydbr/tools/troubleshoot/wkhtmltopdf.php

    The output should give you the command to be executed and output of "wkhtmltopdf -V".

    Doos any PDF export work or is it just this export?

    --
    myDBR Team

  7. rblanalt, Member

    Hi,

    Thanks to you help the problem could be solved.

    PHP was not able to find wkhtmltopdf

    The path to wkhtmltopdf in defaults.php was removed.

    I added the path again and now it does work.
    Today before adding the path, mydbr did report that wkhtmltopdf was not installed.

    I still have to find out why the Defaults.php was changed, but this is not a mydbr problem.

    Ronny


Reply

You must log in to post.