wkhtmltopdf with silverstripe 3.2 - pdf-generation

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

Related

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.

phpDocumentor2 not showing packages in html output

I am trying to get phpDocumentor2 to build API documentation for a PHP project I am working on.
The problem is that the HTML output landing page does not show the packages defined in my project. It only shows "Global ()" package.
I believe I am properly using the #package tag for my classes. phpDocumentor version is 2.0.0b4.
In my efforts to find the bottom of the problem I found a project that is already using phpdoc2. I downloaded that project and tried to build the documentation myself as it has a phpdoc.dist.xml file in its codebase root. I got the same problem: no packages in HTML output landing page, while the vendor's one is showing them (SimplePie, CodeIgniter, Streams etc.).
How can I get my phpdoc output showing packages?
I think you are experiencing a bug in the early betas. Keep watching for new beta releases, as they are coming out quite fast as bugs are reported and fixed.

Wkhtmltopdf version, first page and TOC

Some questions for this very nifty tool, unfortunately lacking many usage examples.
Manual speaks of a possible “Reduced Functionality” for wkhtmltopdf. I have version wkhtmltox-0.11.0_rc1-installer.exe, by running wkhtmltopdf --version what should I read to understand whether my version is the reduced one or not?
Currently I like wkhtmltopdf for webpages I want to read later and/or store. To mirror webpages I use httrack, then I generate the PDF with wkhtmltopdf *.html offline.pdf. How can I set/specify the first PDF page from the *.html list? Currently they seem to be converted in alphabetical order.
If I run wkhtmltopdf toc http://qt-project.org/doc/qt-4.8/qstring.html qstring.pdf I simply get a leading blank page, no TOC. What’s wrong?
Thanks for helping
EDIT:
#Nenotlep:
Your TOC trick works perfectly.
As for the first page, I don’t need an actual cover.
What I need is a way to download/convert a given page www.site.com/foo.html and all the linked pages (A.html, B.html ...) up to a certain depth level. Then I want a single PDF starting with foo.html and containing also the pages A.html, B.html ... (with relative links).
I don’t think there is an option to download and insert the linked pages in the final PDF (please, correct me if I am wrong). So I use httrack.com to download and wkhtmltopdf to convert. Given the alphabetical behaviour of wkhtmltopdf, the best now seems to rename the target page, downloaded with httrack, something like !foo.html.
Please, let me know of possible alternatives.
For part 3 of the question which is blank TOC, the latest stable version 0.12.5 also does not generate it. The pre-release version 0.12.6-dev has fixed this problem in Mac.
I think all available precompiled wkhtmltopdf's are compiled with the patched QT, they are not reduced. The reduced functionality means that it was compiled without a special patched version of QT. I use the windows version and it isn't reduced.
I think the cover command line argument would work for you. I can't test at the moment, but try a command like wkhtmltopdf cover derpy.html toc --xsl-style-sheet default.xsl rarity.html twilight.html spike.html equestriadaily.pdf
At least in Linux, I think the asterix *.html simply explodes into all the html files before the command is performed, so if you select one html file for the cover and then do *.html in the same folder you will get the file twice. Getting around this issue might need some command line sorcery or a batch file or some other trickery.
This is a bug in wkhtmltopdf. The workaround is to manually set a tocfile. You can get the default tocfile with wkhtmltopdf.exe --dump-default-toc-xsl. Then you can save the output as a file and use it like wkhtmltopdf.exe toc --xsl-style-sheet default.xsl www.stackoverflow.com so.pdf.

Internal links with wkhtmltopdf?

I have created a PDF from several web pages using wkhtmltopdf.
Is there a way to link across pages, for example from page 10 to 15.
I tried creating an element with an ID and then an anchor to link to it, but this does not work within the same page or across pages. It turns the link into an absolute URL and tries to open it in a web browser.
I solved this issue by updating the binary that I was using.
I was using 0.8 and switched to 0.11.0 rc1.
Ensure that it is built against QT (the latest binary at http://code.google.com/p/wkhtmltopdf/downloads/detail?name=wkhtmltoimage-0.11.0_rc1-static-amd64.tar.bz2 is.
And then just to be sure enable internal links:
--enable-internal-links
when you call the conversion
i had this issue after installing pathced version of QT
i had wkhtmltopdf 0.9.6, than i also switched to 0.11.0 rc1
then worked fine!
and no need to use --enable-internal-links. you can just turn off this option by --disable-internal-links* by default its on.
Internal links appear only to work correctly in certain builds for certain platforms. With the latest WkHTMLtoPDF 0.12.5 releases the unix builds are OK (at least for Centos and Ubuntu) and internal links are generated correctly BUT windows builds DO NOT work and leave broken links. I don't know why this is and have commented on GitHub accordingly.
Also when multiple html input documents are used any 'internal' hyperlinks between these are broken (all platforms). In other words cross input document links are NOT fixed up. This would be a really useful feature addition (particularly when generating massive reports) but sadly does not appear to be supported as yet.

Local image to text converter script

I'm looking something that will convert an image to text art, similar to this website but instead something I can install locally and use in scripts (or build into a fun app).
I've tried searching for one but all I get is a multitude of online versions.
Try AALib
Or, Caca lib

Resources