PDF header



  • My report is up and running but now I'm trying to get it working with headers. I installed pdf-utils. I created a test header template with just two h tags in it.

    0_1517238245932_upload-eb43c1a5-2df3-46e9-b651-81ecf9a58aba

    Putting that one pdf operation gives me that error.

    On a related note, does anyone have a link to chrome-pdf or phantom-pdf current wiki or examples?

    Thanks!

    edg


  • administrators

    hi! are you sure that both "FieldMgmtZonesResultsVersionA" and "TestHeader" templates have as recipe a pdf one (like "chrome-pdf")? can you post an example of your templates (the main and the header) in our playground?

    On a related note, does anyone have a link to chrome-pdf or phantom-pdf current wiki or examples?

    phantom wiki/docs
    chrome wiki/docs

    currently we don't have any examples in those pages but i think that with the new pdf-utils we can create some examples and link them here, or just collect some old ones.. let's see, thanks for the suggestion.


  • administrators

    also make sure to check https://jsreport.net/learn/pdf-utils which has some examples and can help you figure it out how to use it appropiatly



  • I can't share the ones I have been doing as they have proprietary information in them.

    I created two new templates to test. One is called TestingBody and is:
    <style>
    .page-break { display: block; page-break-before: always; }
    </style>
    <h1>The Body</h1>
    <div>
    This is some testing text
    </div>
    <div class="page-break"></div>
    <div>
    More text.
    </div>

    The second is called TestHeader and is:
    <h1>Test Header</h1>
    <h2>This is important stuff in the header.</h2>

    Both use phantom pdf and I also tested with chrome pdf and it was the same result. Individually, both work.

    Setting pdf-utils on Testing body. Append and prepend work just fine. Any merge, which is what allows me to make one a header (Render for every page option), does not work. I get the previous error.

    I did read through the documentation and pdf-utils page but can't get what I think is the basic function working. I'm not trying to do anything special but the header option.

    This is as basic as I can make it and it didn't work. So, again, what am I doing wrong?

    Thanks!

    edg



  • More testing results: In my localhost environment, this doesn't print the page numbers: {{$pdf.pageNumber}} / {{$pdf.pages.length}}

    Does that mean I'm missing something else?

    Thanks again for all of the help!

    edg


  • administrators

    it is impossible for me to tell you what is wrong with your code without seeing the full picture and the rest of configuration in your server.. but i've created an example with the exact code that you have posted in the last comment and it works normally, here is the link -> https://playground.jsreport.net/studio/workspace/rysEZgTrf/9

    example tested in both osx and windows

    for reference here is the windows screenshoot:

    0_1517255324736_Captura de pantalla 2018-01-29 a las 2.48.19 p.m..png

    my advice is to first make sure to check the full example that i'm giving to you and compare with the properties of your template, if after doing this you are still getting the error please do the following:

    • make sure that TestHeader template is not configured to used pdf-utils, for this case TestingBody should be the only template using pdf-utils configuration
    • please check the version of pdf-utils that you have installed, it should be 0.4.0
    • check your node version, it should be >= 8.0.0
    • check your jsreport version, it should be latest one 1.9.2
    • check you jsreport-chrome-pdf version, it should be latest one 0.3.1

    if any of the versions listed above does not match please upgrade.



  • Hey,

    Sorry for all of this but thanks again for all of your help!

    I was behind on node version (7.8) and pdf-utils (0.3.1). Once I updated them, I got the merge option -> render for every page to work.

    Thanks!

    edg


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.