Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2006

Tip: Looking for answers? Try searching our database.

PDF preview in a c++ application

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hans Stoessel - 12 May 2006 15:57 GMT
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 - 12 May 2006 17:18 GMT
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

> Hi
>
[quoted text clipped - 5 lines]
> Thanks
> Hans
JF Jolin - 12 May 2006 19:22 GMT
> 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?

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 - 15 May 2006 12:29 GMT
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

> 12 May 2006 16:57:07 +0200, Hans Stoessel <hstoessel.list@pm-medici.ch>
> wrote:
[quoted text clipped - 15 lines]
> __
> JF Jolin
Tamas Demjen - 15 May 2006 18:24 GMT
> 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?

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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.