Knp Snappy Bundle - get number of pages of generated pdf file - wkhtmltopdf

I use Knp Snappy bundle (wkhtmltopdf wrapper) for creating pdf files. I have to know how many pages ther is in the generated pdf file. Is it possible to do it with knp snappy bundle or wkhtmltopdf ?
If not, do you know a fast solution for count the total number of pages of my generated pdf file. My application is made with Symfony 3.
Thanks in advance for your advices.

Related

Maatwebsite exported(generated) Excel (Laravel Excel) file performance issue while opening

We'are using Maatwebsite version 3.1.0 with Laravel version 6.x.
Excel files that are exported by this composer package are too slow to edit by Excel program than same files generated by copy/paste all datasets from exported excel.
The size of output file exported by Maatwebsite is rather smaller than the file generated by copy/paste but is very slow to edit(or scroll down, and other manipulations).
Even if we removed all custom styles and format, the problem is not solved.
Is there anyone who had the similar experience or know the way to recommend to solve theses kind of problem?
Thank you in advance.

Laravel - Thumbnail Generator Installation

I have a Laravel project that needs files like docx, xlsx, pptx, and pdf to generate a thumbnail. I can't see any tutorials that may be helpful enough for a beginner like me.
Sorry! the package you are referring to is a python library.

wkhtmltopdf with silverstripe 3.2

I'm playing around with pdf generation. After the silverstripe modules for dompdf and tcppdf which doesn't work like I want them to, I came across BetterBrief's module for wkhtmltopdf https://github.com/BetterBrief/silverstripe-pdf
It should be exactly what I need but I can't figure out why it's not creating pdfs. I installed it with composer following the module instructions, after that I installed the debian application and set up a demo template with just three words in it to test ist. But the pdf file can't be created.
The error I receive is the following and not very helpful to me http://www.sspaste.com/paste/show/5676bac4a4186
perhapse someone had the same problem or knows a solution for that.
the creation of a pdf from commandline works
wkhtmltopdf http://google.com google.pdf
Edit That's not a real solution for this problem, but an alternativ to create a pdf with SilverStripe and wkhtmltopdf. https://github.com/creativeSynergy/silverstripe-wkhtmltopdf
A quick google shows it has something to do with wkhtmltopdf needing X to work.
https://github.com/knplabs/snappy/issues/20

GhostScript on CentOS 5.3 - Unable to process JPXDecode data

I'm trying to get our server to convert PDFs to image files. It's a CentOS 5.3 system and the latest version of ghostscript that can be (8.70), has been installed.
When I try to convert a PDF I get the following error repeated for each page, and the result is a load of blank images.
**** ERROR: Unable to process JPXDecode data. Page will be missing data.
So, I found an answer on here that seemed to answer that question:
iText PDF; howto convert jpeg2000 to jpg using Java
Following that I downloaded iText 5.3.4 and jai_imageio-1.1.jar and compiled the supplied script on my local machine. When I run the final conversion command on my PDF I get:
java.lang.NullPointerException
at com.itextpdf.text.pdf.parser.PdfImageObject.decodeImageBytes(PdfImageObject.java:296)
at com.itextpdf.text.pdf.parser.PdfImageObject.<init>(PdfImageObject.java:199)
at com.itextpdf.text.pdf.parser.PdfImageObject.<init>(PdfImageObject.java:158)
at PDFConverter.hasJpeg2000(PDFConverter.java:36)
at PDFConverter.main(PDFConverter.java:15)
Doesn't contain any JPEG2000 images: Nothing to be done...
I'm not sure whether that's definitely saying that the PDF doesn't have any JPEG2000 images, or whether I've done something wrong when I compiled the script. Perhaps I've got the wrong version of iText since no links were provided in the answer to that other question.
So now I either need help to convert my PDFs to remove any JPEG2000 images, or I need help to get our server running ghostscript properly.

online pdf generation

I'm looking to create PDF files instantly online given user input in my html/php page.
are there any FREE API's out there that will allow me to do this?
various options, here are a couple:
Prince XML
wkhtmltopdf
TCPDF
HTML2PDF
PDF converter
PDFSharp
pdflib
formatter coverters
Php uses the PDFlib library, it has a lot of pdf functions, check it out here http://php.net/manual/en/book.pdf.php
You could probably use pdflib
Hi You have two or three approaches:
1) If you can work with XML, that is, the source of your PDF file is in XML format, you could use XSL and XSL:Fo to generate the PDF. XSL and Fo are declarative languages so you can control the PDF layout external to your application. Fo creates only documents, not interactive forms.
2) If you can work in Java, you could use iText to generate the PDF using a jar/api. There is also iTextSharp for C#. Using iText, you can also create PDF Forms, not just documents.
3) If you have XHTML and just want to create PDFs that look like your HTML pages, there are several options - just search the web for HTML to PDF converters.
If your pdf isn't overly complex, you should look into XFDF before making an architectural decision. The main benefit to this approach is that there is no need to store pdf's in the db or on hard drive. Additionally, I have seen many pdf generation implementations that use home grown batch processes that are buggy and only create another 'moving part' in an application. If you have very complex pdf needs and don't mind the overhead of storing the pdfs, pdflib is a good choice.

Resources