#1 2010-10-25 06:48:49

plastkort
Member
Registered: 2010-10-25
Posts: 11

PDF Engine

hi!, can it be possible to read PDF  files and extract a page to TBitmap ?

Offline

#2 2010-10-25 09:03:11

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,656
Website

Re: PDF Engine

Our engine is a PDF writer, you're not able (yet) to read pdf files.
It could be possible to read PDF files in our unit, because we've flattered the whole pdf format into Delphi classes.
But a dedicated parser is needed.

If you want to export a PDF into a bitmap, you should need not only a PDF parser/reader, but a PDF renderer.

There are some solutions around, the most easy I could guess is to install a virtual printer able to print into files (PDF creator allows this, AFAIR), then print the PDF page from your PDF renderer (like Acrobar Reader), and get the resulting file.

You could try to use the ActiveX version of Acrobar Reader, then use screenshots to get the result. But the resolution won't be good, it'll be limited by the actual monitor resolution. Not a good solution.

Offline

#3 2010-10-25 09:09:56

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,656
Website

Re: PDF Engine

If you want just to extract an image stored inside a pdf, you could try the free pdfimage command line tool.

You can get it freely from http://www.foolabs.com/xpdf

Other tools do exist around, but they are not free.

Offline

#4 2010-10-25 09:30:33

plastkort
Member
Registered: 2010-10-25
Posts: 11

Re: PDF Engine

hi again and thanks for replies smile

yes what I am looking for is some renderer, I would like to view the PDF file, and be able to use it as a normal TBitmap/TGraphic etc etc, and be able to assigned to an TImage.

the ActiveX method I tried, but it seems not to be able to screenshot it, or export it as a image, even foxit reader does not help me here

Offline

#5 2010-10-25 12:35:49

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,656
Website

Re: PDF Engine

You can try this one:
http://www.wpcubed.com/products/pdfviewer/index.htm

It does exactly what you need. smile

But it cost some money. sad

Offline

#6 2010-10-26 06:23:57

plastkort
Member
Registered: 2010-10-25
Posts: 11

Re: PDF Engine

if it cost a few bucks, that is ok smile
thanks

Offline

#7 2010-10-26 15:15:08

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,656
Website

Re: PDF Engine

a bit more than a few bucks...
sad

Offline

#8 2010-10-27 07:21:37

plastkort
Member
Registered: 2010-10-25
Posts: 11

Re: PDF Engine

hmm how many bucks?
company I work for have wPDF.. shame they did not have the viewpdf smile hmmm

Offline

#9 2010-10-27 08:24:37

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,656
Website

Re: PDF Engine

Follow the link, and checkout... 248 euros for single developer.

Offline

#10 2010-10-29 12:11:04

plastkort
Member
Registered: 2010-10-25
Posts: 11

Re: PDF Engine

ah expensive, but if it is the only component out there, i guess there is not much other alternatives..

i checked image magic, but convert.exe crashes everytime i do

convert 1.pdf 1.png

Offline

#11 2010-10-29 12:19:21

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,656
Website

Re: PDF Engine

Checkout SumatraPdf and XPDF.

Perhaps there is some command line options for rendering a page content into a png.

Or you could ask the author for such a feature (SumatraPdf is made by one man, so you could have a chance here).

Offline

#12 2010-11-01 10:59:20

plastkort
Member
Registered: 2010-10-25
Posts: 11

Re: PDF Engine

thanks ab!

can you please add a feature at this forum, notifying the registered email if there are any new messages in a thread ?

I tend to forget where I write on message boards sometimes smile

Offline

#13 2010-11-02 07:05:29

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,656
Website

Re: PDF Engine

This forum is based on FluxBB, which doesn't offer such an "email watch" feature, as far as I know.

But I'll check and try to add it.

Offline

#14 2010-11-08 15:19:40

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,656
Website

Re: PDF Engine

Did you make a try to http://mupdf.com ?

MuPDF is a lightweight PDF viewer and toolkit written in portable C.

The renderer in MuPDF is tailored for high quality anti-aliased graphics. It renders text with metrics and spacing accurate to within fractions of a pixel for the highest fidelity in reproducing the look of a printed page on screen.

MuPDF has a small footprint. A binary that includes the standard Roman fonts is only one megabyte. A build with full CJK support (including an Asian font) is approximately five megabytes.

MuPDF has support for all non-interactive PDF 1.7 features, and the toolkit provides a simple API for accessing the internal structures of the PDF document. Example code for navigating interactive links and bookmarks, encrypting PDF files, extracting fonts, images, and searchable text, and rendering pages to image files is provided.

License

MuPDF is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Offline

#15 2010-11-10 10:43:13

plastkort
Member
Registered: 2010-10-25
Posts: 11

Re: PDF Engine

mupdf, never heard of, but C, I cannot use:(

Offline

#16 2010-11-10 12:24:44

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,656
Website

Re: PDF Engine

You can try to compile it into a dll, then call it from Delphi.

The API seems not difficult to convert and Delphi external functions.

And there is dedicated calls for converting a PDF into pictures, just as you expect.

See http://www.codeproject.com/KB/files/xpd … sg=3154408

Offline

#17 2010-11-10 13:18:51

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,656
Website

Re: PDF Engine

Check pdfdraw.exe available from mupdf site.

It performs exactly what you need.

Offline

Board footer

Powered by FluxBB