Show pdf with qtwebkit - pdf

I have a project in which we use custom built software, that is not developed by us.
The application is developed in qt 4.7.0 and is running on Ubuntu 10.04 LTS.
It uses html pages to provide the "online help" to the user. My task is to write the initial help content. The pages are rendered using qtwebkit.
Our customer would also like to display pdf-documents. When I asked the developers, I was told to convert the pdfs to html and add the converted files to the online help.
This would cause quite a bit of additional work and results in html-output that won't look exactly like the pdf-files... and it would prevent the simple addition of new pdf-files by the customer.
So I ask the community here: is there a way to display pdf-files with qtwebkit? Are there any plugins?
Cheers,
10.6um

No idea if there is an existing plugin. But I think you could implement a PDF viewer plugin by yourself with the help of poppler. Poppler is portable to Windows/Linux/Mac.
Reimplement QWebPluginFactory and intercept request with PDF mime type.
Download the PDF content, and use poppler to render PDF data to QPixmap.
Set the QPixmap as the content of QWebPage.

Related

API for PDF Library

I need to build a small PDF library that will display many catalogs, the user will be able to view the document and go thru pages but he will not be able to download or share the documents in any way, somehow to work like Google Books (here an example).
I have in mind something like the Google Drive API or some kind of Scribd API, but I don't know if one of those will work, I would like to know if there are more options for these application or the mentioned before will do the job.
Edit: Forgot to mention, all this done in a web browser.
In principle all you need would be the ability to render pages from a PDF file into an image. Your application (you didn't mention where you want to build this) is then responsible for displaying the images, scrolling, moving from page to page etc...
If this is correct there are multiple possible libraries that can do this:
- ImageMagick can convert PDF to images (http://www.imagemagick.org)
- GhostScript has extensions for PDF and can convert PostScript or PDF into images and other formats (http://www.ghostscript.com)
- I'm sure there are many, many more...
There are also a number of commercial tools, for example those from Adobe (licensed through DataLogics, http://www.datalogics.com) and callas software (http://www.callassoftware.com - I'm affiliated with this company)

Creating Thumbnail from PDF without Adobe SDK

I've been looking for ways by which I can generate Thumbnails from pdf, as shown in the explorer. But the problem is that without Adobe Pro, the free version does not expose all ihe COM interfaces. Is there any other way? please help.
Ghostscript (which is what ImageMagick uses) will generate images in a wide variety of different image formats... if you need something really obscure then use the imagemagick wrapper, otherwise, I prefer the straight dope.
If you can afford a commercial option, you could use Amyuni PDF Creator ActiveX for this task, (or .Net version if that suits your needs better). Using this product you can create jpg/png/bmp images from the first page of your PDF files with the specified resolution, and then use them as thumbnails.
Disclaimer: I am part of the development team of this product.
Here are other SO questions proposing other approaches (not involving COM):
Using ImageMagic in command line
Thumbnail of a PDF page (Java)

PDF Generation Help needed

I am brandnew to PDF Generation or rendering but have a project to, create a PDF Template system that allows users to save Template to Database,
and later generate a PDF document using the template and values from my database.
Language to use C#
Questions
a) Is there a PDF tool out there that can help me with this and documentation I can study to learn of this?
b) Are there free tools out there for this?
c) How do I create a PDF Template? XML?
Thanks in Advance!
You should have a look at xsl:fo.
Apache has a tool which might be helpful.
You can use PHP to create and modify PDFs. (Everything below is completely free.)
Here are two extensive tutorials on generating PDFs in PHP:
http://blog.eirikhoem.net/index.php/2008/04/28/populate-pdf-templates-with-php-fpdf-fpdi/
http://www.astahost.com/info.php/create-pdf-php_t4972.html
You can use the FPDF library located here to handle generating PDFs based off of templates.
If You are using Java, you could try Docmosis or JODReports - they work from templates and can produce PDF output dynamically based on data and those templates. Depending on your template requirements, you might also be able to use Jasper Reports or Apache POI. All have free versions.
If you are looking for an instant solution, take a look on http://pdfnow.com . You can upload your XSL/FO-Templates and simply generate PDF-Templates with a simple webservice call.
I would give a shot to jsreport. You can install it on premise for free or use it online. It supports html -> pdf transformation using phantomjs or xml -> pdf transformation using apache fop.
The idea is that first you create report template using javascript templating engines like handlebars in jsreport studio and then you get back pdf by calling jsreport api.
If you are in c# there is jsreport c# sdk for it.
Note: I am the author of jsreport

Document -> Flash viewer, not hosted

I've got a content management solution where we present scanned images (TIFF), PDFs, word docs for viewing. While we can simply embed a PDF, sometimes depending on user preferences it's a bit fiddly and sometimes not user-intuitive.
I'd like a solution like scribd, embedit, etc, but not hosted. I want to run the application on our own servers and manage it that way (for legal reasons, and our clients won't buy the service if it's hosted somewhere else).
SWFtools looks a little basic for my needs, plus doesn't do doc, docx or ppt.
Any options? Doesn't have to be free, but would be ideal.
As far as I understand (Scribd) uses swftools. And it is not basic, it is amazingly flexible. Convert everything into PDF and use swftools to convert PDF's into swf or something like Scribd does (SCB, what they call it, modified swf).
webSupergoo has a .net component that will do this...
Their ABCpdf component can import and export a wide range of graphic and document formats, including those you've mentioned.
The installation also contains an SWF demo project that can be freely adapted, and used as the basis for a scribd-like service.
http://www.websupergoo.com/products.htm
you can try this alternative solution :
FreepapeR.
You can display pdf documents. The pdf is converted using swftools (pdf2swf), using php on the server side or locally by hand, the user interface is written in as3.
Hope this helps...

Functional PDF Testing (Automate Testing of PDF Content)

I am working on an application where I am writing some automation framework for testing a web application. I am using Watij / Watin for the framework, but have run into a problem with verifying the PDFs generated have the correct content.
I know I can use IText or a native PDF library to load up the PDF, but I am wondering if there is already an existing framework dedicated to testing PDF file content?
it's an interesting problem, but thankfully like most out there, there's someone who has done it before you.
Take a look at http://jpdfunit.sourceforge.net/references/jpdfunit_aShortIntroduction.pdf for information on a PDF testing framework called JPdfUnit.
The program homepage is at http://jpdfunit.sourceforge.net/.
Hope that helps!
Simple PDF Automation to read text from PDF document.