How to render pdfs using C#

I wish to pack and draw pdf files graphically using C#. I do not have to modify them or anything, simply render them at a provided zoom level. The pdf libraries I have found seem to be focussed on generation.

There are a couple of other options in case the Adobe ActiveX isn’t exactly what you’re looking for (given that Acrobat must be present on the user device and you cannot deliver it yourself).

For producing the PDF preview, first have an appearance at some other discussions on the topic on StackOverflow:

How can I take sneak peek of documents?
Get a preview jpeg of a pdf on windows?
. NET open PDF in winform without external dependencies
PDF Previewing and viewing

In the last 2 I speak about a few things you can try:

You can get a commercial renderer (PDFViewForNet, PDFRasterizer.NET, ABCPDF, ActivePDF, XpdfRasterizer and others in the other answers …).
A lot of are fairly costly though, especially if all you care about is making an easy preview/thumbnails.

In addition, there is a CodeProject article that reveals how to utilize the Adobe ActiveX, but it might be out of date, easily broken by new releases and its legality is dirty (essentially it’s ok for internal usage but you can’t deliver it and you can’t utilize it on a server to produce images of PDF).

You could take a look at the source code for SumatraPDF, an OpenSource PDF viewer for windows.

There is likewise Poppler, a rendering engine that uses Xpdf as a rendering engine. All of these are great however they will require a reasonable amount of commitment to make them work and interface with.Net and they tend to be distributed under the GPL.

You may desire to think about using GhostScript as an interpreter due to the fact that rendering pages is a fairly simple process.

There’s some excellent reactions listed here already, however I thought I may indicate that pdftk may be favorable for this task. Rather of creating one PDF directly, you may generate each PDF you call for then incorporate all of them with each other as a post-process with pdftk.

There is a C# nuget package deal called PdfiumViewer which gives a C# wrapper around PDFium and makes it possible for PDFs to become revealed and also published. I have really used it and also was actually incredibly satisfied with the top quality of the making. PDFium functions directly with streams so it does not require any type of information to be actually contacted disk.

Not ony is going to it provide your PDF to a series of formats (eg JPEG, GIF, PNG, TIFF, JPEG 2000; vector EPS, SVG, Flash and PostScript) nonetheless it may likewise do this in a series of colour spaces (eg Gray, RGB, CMYK) and bit midsts (eg 1, 8, 16 bits per component).

I call for to identify the number of web pages in a determined PDF documents utilizing C# code (. PDF utilizes versioned items, as well as can likewise feature eliminated items if the PDF have not been actually washed up, so it is possible to possess Page products that aren’t actually linked in to the PDF or even that have really been actually transformed along with a latest variety.

The negative aspect is actually that you will must either re-package it to mount it with your application, or create it a pre-requisite (or even at the very least a component of your put together method).
It’s not a big difficulty, as well as it is actually definitely a lot easier than needing to massage therapy the various other delivering engines in to conforming with.Net.
I carried out a little bit of activity that you are going to discover on the Programmer Express on the internet forums as a device.
Deal with the certificate requirements for GhostScript with.
Commercial software application is perhaps your only alternative, if you can’t leave behind along with that.

Google possesses available sourced its own excellent PDF rendering engine – PDFium – that it wrote with Foxit Program.

Leave a Reply

Your email address will not be published. Required fields are marked *