Preview PDF File in C# Application

J

johanasvensson

Hi,

Could someone tell me how can I preview a PDF file in a C#
application?

I am developing an application that puts an image in a PDF document.
The place where the image will be put can be selected manually, but I
need to preview the document to know if the image is overriding text
or something like that. Basically i need to preview the document
inside the application.

Thanks,

jo
 
I

Ignacio Machin ( .NET/ C# MVP )

Hi,

Could someone tell me how can I preview a PDF file in a C#
application?

I am developing an application that puts an image in a PDF document.
The place where the image will be put can be selected manually, but I
need to preview the document to know if the image is overriding text
or something like that. Basically i need to preview the document
inside the application.

Thanks,

jo

I do not know of any such control either in the framework on in a
third party tool that I have use before.
Check if Adobe has a component that you can embed in your app. I'm
pretty sure it does exist.
 
M

Michael B. Trausch

On Tue, 25 Nov 2008 07:35:31 -0800 (PST)
Could someone tell me how can I preview a PDF file in a C#
application?

I am developing an application that puts an image in a PDF document.
The place where the image will be put can be selected manually, but I
need to preview the document to know if the image is overriding text
or something like that. Basically i need to preview the document
inside the application.

Look into libpoppler (a portable, native library written in C).[0] It
should have a set of C# bindings these days that you can use; if not,
though, you can use P/Invoke on it. You'll need to distribute versions
of the native DLL with your deployed application, in 32-bit and 64-bit
versions so that people can run with the native dependency on both x86
and x86-64 platforms.

You may also want to check out PDF Clown, which is a library which is
apparently written both for Java and C#, with source code. Haven't
tried it, so I don't know how well it works.[1]

--- Mike

[0] http://poppler.freedesktop.org/
[1] http://sourceforge.net/projects/clown/
 
R

rhaazy

Check out iTextSharp library.

Could someone tell me how can I preview a PDF file in a C#
application?
I am developing an application that puts an image in a PDF document.
The place where the image will be put can be selected manually, but I
need to preview the document to know if the image is overriding text
or something like that. Basically i need to preview the document
inside the application.

Look into libpoppler (a portable, native library written in C).[0]  It
should have a set of C# bindings these days that you can use; if not,
though, you can use P/Invoke on it. You'll need to distribute versions
of the native DLL with your deployed application, in 32-bit and 64-bit
versions so that people can run with the native dependency on both x86
and x86-64 platforms.

You may also want to check out PDF Clown, which is a library which is
apparently written both for Java and C#, with source code.  Haven't
tried it, so I don't know how well it works.[1]

        --- Mike

[0]http://poppler.freedesktop.org/
[1]http://sourceforge.net/projects/clown/
 
M

Michael B. Trausch

Check out iTextSharp library.

Looks like iTextSharp requires Adobe Acrobat Reader, which is why I
didn't include it in the list of options.

--- Mike
 
G

Govert J. Knopper

Could someone tell me how can I preview a PDF file in a C#
application?

1. Adobe Viewer (should be installed; then in Visual C# add Toolbox item,
select Adobe PDF Reader; it will be available from the Toolbox, from where
you can place it on your forms).
2. GhostScript; call either the exe or use a wrapper around the gs dll and
let it convert the PDF to an image file that you read back in the
application.

Govert

http://www.noliturbare.com
 
E

Erik Molenaar

Hi Jo,

A fast way to preview a pdf is to use the pdf viewer your user
has chosen to view pdfs in IE. If you put an embedded IE in your
form it can handle the viewing by just navigating to the file you
want to show.
(this method is simple, but you might find it a disadvantage
depending on the user's settings in IE)

Groetjes,
Erik
 
S

Support

You may want to take a look at PDFTron SDK (which is available
for .NET, JAVA, and C/C++ on various platforms). Download:
http://www.pdftron.com/downloads.html

There is only a single DLL that needs to be referenced from a project
(and there are no dependencies on Acrobat or similar).

As a strting point you may want to take a look at C# sample called
PDFView:
PDFView: http://www.pdftron.com/net/samplecode.html#PDFView
PDFViewSimple: http://www.pdftron.com/net/samplecode.html#PDFViewSimple

The same component can be used to add images to PDF among many other
things.

Rob.
 
R

rpresser

Check out iTextSharp library.
iTextSharp is exclusively for creating PDFs, not rasterizing them.

abcPDF is a commercial library (by webSuperGoo) that is fantastic at
rendering PDFs as well as generating them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top