docx recipe with unoconv to pdf renders everything slightly bigger

  • I'm using the JSReport 3.1.1 docker image on my local development machine. So far we're really happy with this product and are very likely to purchase a license soon. Thanks for making this great product!

    One problem I can't get fixed is this: We get our templates from our customers delivered in docx format, but need to have a PDF document as a result for most documents. I've accomplished this by just adding pdf in the unoconf parameter textbox for a given template, and leaving the checkbox enabled, this produces a PDF of our generated document.
    However, I've noticed that the generated PDFs appear to have everything slightly larger, from what I can see it's a larger font size, as e.g. the logo in the header stays at the intended size.
    I've been reading the unoconv documentation, but can't find anything obvious that would cause this.

    When I disable the unoconv step and let it output a filled-in docx file, everything looks fine.
    I can't imagine I'm the first to run into this, so has anyone faced this before?

    thanks for any feedback on this!

  • So far we're really happy with this product

    Thank you, I am happy to hear that.

    I've been reading the unoconv documentation, but can't find anything obvious that would cause this.

    This can be rather a problem of OpenOffice/LibreOffice which is doing the actual conversion to pdf.
    If you open the document in LibreOffice and save it to pdf. Is the pdf looking good? It will be most likely the same as with unoconv.

    Maybe there is a font used in the docx that you don't have installed on the server where is jsreport running. You may also try to search OpenOffice and LibreOffice forums if you find answers there.

    Although the unoconv workflow is used, it has some limitations. If you start with that as the first choice you may realize that it's better to reimplement the docx into HTML and use chrome conversion instead. However, of course, this depends on the situation.

  • Thanks for the input Jan.
    Copying the font (it was the default calibri font which word uses) from my PC into the docker container solved the issue!
    It means we'll have to build our own JSReport image with the extra fonts included, but that's acceptable.

    I agree that html is a better method for designing documents, but as a developer I'd rather spend no time at all designing documents, and by providing the means to our customer to design their own documents in their familiar word application, we don't have to worry about that :)

  • How did you copy the file, we're having the same issue?

  • I created a dockerfile with the following content:

    FROM jsreport/jsreport
    COPY ./Fonts/ /usr/share/fonts/

    Make sure the font you need is in the Fonts subdirectory.
    Then run docker build . in the directory where your dockerfile resides, and you should have an image which contains your font.

  • Perfect - that's worked.

Log in to reply

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