Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Is there a FREE library which will allow me to open a pdf and show it on a winform project. I know I could open it in adobe reader or something but it always seems so bloated to me and I would be relying on it being installed. Is there a nice lightweight alternative where I could just include a dll in my project or similar avoiding external dependencies.

I don't need much functionality just view, change page zoom..

I have seen a few libraries but they seem to be about creating PDF's not viewing.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
119 views
Welcome To Ask or Share your Answers For Others

1 Answer

I'm not sure what you call a 'dependency' since you'll always have to rely on some external code to render the PDF unless you bundle the whole PDF rendering source inside your project.

There are some commercial renderers and very few free ones.

If you want to avoid dependencies that you can't bundle then maybe you could have a look at the source code for SumatraPDF, an OpenSource PDF viewer for windows that uses MuPDF.
There is also Poppler, a rendering engine that uses Xpdf as a rendering engine. All of these are great but they will require a fair amount of commitment to make make them work and interface with .Net.

Most other open source libraries are only used for creating and managing PDF pages and I don't know any that actually does rendering; it's such a hard problem to solve right.

You may still want to consider using GhostScript as an interpreter because rendering pages is a fairly simple process.
The drawback is that you will need to either re-package it to install it with your app, or make it a pre-requisite (or at least a part of your install process).
It's not a big challenge, and it's certainly easier than having to massage the other rendering engines into .Net.

Have a look at this SO question I answered today.
It contains some more information and a link to some working .Net code I posted on another forum a few months ago.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...