KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

PDF Generate as a image #2638

Open Lawrbit opened this topic on on Apr 15, 2022 - 18 comments

Lawrbit commented on Apr 15, 2022

Hi,

We are using the export package to generate the report in PDF format, but even after creating the text, the text is converted into an image and generated PDF, due to which the size of the pdf increases a lot.

If we are using graphs it's ok will be saved into an image but the text should be text.

Sebastian Morales commented on Apr 15, 2022

Thank you for your feedback! Would you pls post your export code as well as the exported pdf file for us to check it for you? In our online example the exported pdf file contains text instead of image:

https://www.koolreport.com/examples/reports/export/sakila_rental/

Pls compare it with your export and let us know any difference. Tks,

Lawrbit commented on Apr 15, 2022

the issue coming on the AWS server, Same code working fine at localhost so any restriction for the server

Sebastian Morales commented on Apr 18, 2022

Our Export package uses Phantomjs headless browser to render pdf or images. Currently, the output format is automatically set based on the file extension. Would you pls connect to your AWS server and test your Phantomjs installation with standard examples, especially the jakarta.pdf one:

https://phantomjs.org/screen-capture.html

Lawrbit commented on Jun 1, 2022

Hi,

We continued trying to fix this error.

While we generate PDF files in the Windows system it works fine, Text comes as a Text into PDF, and charts showing as an image.

The same code not working in Linux.

I tried with the old version of phantomJS(1.9.8) working fine, But when I going to update phantomJS 2.1.1 Not working in Linux any solution for this.

If any dependencies there for phantomJS please let us know.

I don't think the problem is in our source code, I think the issue is in the phantomJS latest version.

Sebastian Morales commented on Jun 1, 2022

What are your server's Linux distro and version?

Lawrbit commented on Jun 1, 2022

Amazon Linux 2

Sebastian Morales commented on Jun 1, 2022

Pls try this guide to see if it works for your server:

How do you install phantomjs on AWS lambda?

And note this requirement from Phantomjs website: "It however still relies on Fontconfig (the package fontconfig or libfontconfig, depending on the distribution). The system must have GLIBCXX_3.4.9 and GLIBC_2.7."

Lawrbit commented on Jun 1, 2022

We installed phantomjs like this.

sudo yum install fontconfig freetype freetype-devel fontconfig-devel libstdc++
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-i686.tar.bz2
sudo mkdir -p /opt/phantomjs
bzip2 -d phantomjs-2.1.1-linux-i686.tar.bz2
sudo tar -xvf phantomjs-2.1.1-linux-i686.tar \
    --directory /opt/phantomjs/ --strip-components 1
sudo ln -s /opt/phantomjs/bin/phantomjs /usr/bin/phantomjs
Sebastian Morales commented on Jun 2, 2022

Is your server 32 bit? If not pls try the 64 bit version "phantomjs-2.1.1-linux-x86_64.tar.bz2". Also you said version 1.9.8 does work better. Can you use that version or is there something missing?

Lawrbit commented on Jun 2, 2022

Version 1.9.8 works on Linux local system but does not work on AWS.

We already tried with "phantomjs-2.1.1-linux-x86_64.tar.bz2"

Sebastian Morales commented on Jun 2, 2022

Pls run the following command to see phantomjs' dependencies list:

ldd /opt/phantomjs/bin/phantomjs

Then try to install missing libraries. If you could request an AWS support session to help with installing such dependencies it would be nice.

In case you are all out of options there's always our CloudExport solution to fall on. Rgds,

Lawrbit commented on Jun 3, 2022

We run the mentioned command and check the result in the attachment.

Sebastian Morales commented on Jun 3, 2022

It looks like there's no dependency problem. Which fonts do you use for your PDF view? Pls make sure installing them on /usr/share/fonts and /usr/local/share/fonts/. If you use web fonts, here's a quote "For webfonts (like google fonts) to work properly on the render one needs to install them on the running system. Otherwise QT will render the page as bitmap because the fonts are not available." As a test, you could try to use a locally available fonts of your server.

Lawrbit commented on Jun 6, 2022

But it's working fine on the lower version. Why? In the New version layout issues revolved that why we are want to go with the new version

Sebastian Morales commented on Jun 6, 2022

I thought you said that 1.9.8 only worked on your local system, not your AWS server?

Lawrbit commented on Jun 7, 2022

Yes, and with higher versions, text generating as an image in PDF because of the PDF report size increasing. Below 1.9.8 working fine.

Sebastian Morales commented on Jun 7, 2022

With Phantomjs version 2.1.1, pls try to export a report pdf view containing only a simple string like "Hello world" (no html, css, js, etc):

<!-- MyReportPDF.view.php -->
Hello world

See if you can select text in the exported pdf file.

Lawrbit commented on Jun 8, 2022

It's working now.

I was using google font @import url(), I removed google font from my CSS code now it's working fine.

Thank you so much for your support

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed
solved

Export