Connecting Tech Pros Worldwide Forums | Help | Site Map

PDF preview in a c++ application

Hans Stoessel
Guest
 
Posts: n/a
#1: May 12 '06
Hi

In my C++ application (no MFC) I have a dialog and like to show a PDF
preview in this dialog.

How can I do that?

Thanks
Hans



Tamas Demjen
Guest
 
Posts: n/a
#2: May 12 '06

re: PDF preview in a c++ application


You can launch Acrobat Reader as an external application, using
::ShellExecute("open", ...). Or you can embed the Acrobat Reader ActiveX
control in your application, but it has several bugs that make your life
quite difficult, and the functionality provided by the ActiveX control
is very thin (all can do little more than load a file and navigate to a
certain page).

The most comprehensive solution with the greatest degree of control is
by using the Adobe Acrobat API to write an Acrobat plugin. The way it
works is it renders the page for you on an HDC that you pass to the API.
You have to do inter-process communication between the Acrobat plugin
and your app. The drawback of this solution is that there's virtually no
documentation (other than the over thousand-page SDK reference from
Adobe), no newsgroups where you can expect help from other programmers,
and no sample applications that show you how to do it (and believe me,
it's enormously overcomplicated). In addition, the SDK is only free for
the full version of Acrobat. If you want to write a plugin for the free
Acrobat Reader, you have to pay over thousand dollars in license fees
(don't quite remember exactly how much).

Tom


Hans Stoessel wrote:[color=blue]
> Hi
>
> In my C++ application (no MFC) I have a dialog and like to show a PDF
> preview in this dialog.
>
> How can I do that?
>
> Thanks
> Hans[/color]
JF Jolin
Guest
 
Posts: n/a
#3: May 12 '06

re: PDF preview in a c++ application


12 May 2006 16:57:07 +0200, Hans Stoessel <hstoessel.list@pm-medici.ch> wrote:
[color=blue]
> In my C++ application (no MFC) I have a dialog and like to show a PDF preview in this dialog.
>
> How can I do that?[/color]

You can try the following link.
It's a free utility to convert any text file to PDF format.

It provides also: pdflib.dll pdflib.lib pdflib.h
This library is free for personal usage and
requires a license for commercial products.

http://www.codeproject.com/tools/Text2PDF.asp

__
JF Jolin
Hans Stoessel
Guest
 
Posts: n/a
#4: May 15 '06

re: PDF preview in a c++ application


Hi

Thanks for the answer.

I should only open an existing PDF and should show it in a window (device
context; CDC). Maybe I can render the PDF into a bitmap and show the bitmap.

Is there a possibility to do that?

Thanks
Hans



"JF Jolin" <spam@nospam.com> schrieb im Newsbeitrag
news:ops9gandtxqf52gd@news.contact.net...[color=blue]
> 12 May 2006 16:57:07 +0200, Hans Stoessel <hstoessel.list@pm-medici.ch>
> wrote:
>[color=green]
>> In my C++ application (no MFC) I have a dialog and like to show a PDF
>> preview in this dialog.
>>
>> How can I do that?[/color]
>
> You can try the following link.
> It's a free utility to convert any text file to PDF format.
>
> It provides also: pdflib.dll pdflib.lib pdflib.h
> This library is free for personal usage and
> requires a license for commercial products.
>
> http://www.codeproject.com/tools/Text2PDF.asp
>
> __
> JF Jolin[/color]


Tamas Demjen
Guest
 
Posts: n/a
#5: May 15 '06

re: PDF preview in a c++ application


Hans Stoessel wrote:
[color=blue]
> I should only open an existing PDF and should show it in a window (device
> context; CDC). Maybe I can render the PDF into a bitmap and show the bitmap.
>
> Is there a possibility to do that?[/color]

Yes, using the Acrobat SDK. You have to write a plugin for Acrobat.
Since Acrobat is running in a separate process than your application,
you need to use inter-process communication between them to pass the
HDC. Note that you don't have to open an Acrobat window to do this. You
can render a PDF page right on an HDC. It takes a while to learn the
Acrobat SDK, it's enormously complicated, and if you do a google search
on any of the SDK functions, you'll usually get exactly 0 hits.

Then there's the DocuCom PDF Core Library, which is a 3rd party library
that mimics the Acrobat SDK functionality. The advantage of it is that
it doesn't require any Adobe product to be installed.

Then there's always GhostScript, which is able to rasterize a PDF file
(create a .bmp or .tif for you). However, it's always a bit behind the
latest Adobe technology, and I have several perfectly valid PDF files
that GhostScript can't handle very well. Also, it's only free for
personal and academic use, you can't distribute it with your commercial
product without obtaining a license.

Also, there are several print drivers out there that create a .tif file
out of anything printable. There's Black Ice and LeadTools, just to name
two. Then you can make Acrobat print to this virtual printer to
rasterize a PDF file.

Tom
Closed Thread