SAVE PDF PAGE AS IMAGE ITEXTSHARP PDF

The discussion thread here asks how to convert a PDF to an image. Save Cancel Delete . -a-pdf-document-into-image-format/?refresh= You can convert PDF to image using free library itextsharp. That's basically it. It is however a bit of a cheat; we aren't saving the exact original image as it is stored in the PDF file, we are re-compressing it. Next is to convert the PDF document generated by ItextSharp to an image with Open the PDF document. To open a document the library contains a PdfDocument class, that allows loading PDF documents in many formats, stream, byte, and so on. Iterate through the PDF document pages and save it as an image.


SAVE PDF PAGE AS IMAGE ITEXTSHARP PDF

Author: Max Abernathy
Country: Serbia
Language: English
Genre: Education
Published: 19 August 2014
Pages: 823
PDF File Size: 35.91 Mb
ePub File Size: 10.38 Mb
ISBN: 279-1-65685-609-5
Downloads: 79835
Price: Free
Uploader: Max Abernathy

SAVE PDF PAGE AS IMAGE ITEXTSHARP PDF


ITextSharp - Working with images

The SetAbsolutePosition method will do this, but I need to get a calculator out. SetAbsolutePosition accepts 2 floats as parameters.

  • C# - Convert Pdf file pages to Images with itextsharp - Stack Overflow
  • Images (iText 5)
  • 2. Creating PDF/A files with iText
  • How To Buy
  • Software Monkey

The first represents the co-ordinate along the X-axis, save pdf page as image itextsharp starts at the left hand edge of the document and finishes at the right hand edge of the document.

The second represents the Y-axis co-ordinate which starts from the bottom of the document and goes to the top. Namespace to be used: While instantiating, pass the above created ImageData object as a parameter to its constructor, as shown below.

Adding image to the document Add the image object created in the previous step using the add method of the Document class, as shown below.

SAVE PDF PAGE AS IMAGE ITEXTSHARP PDF

Closing the Document Close the document using the close method of the Document class, as shown below. The function returns a string so we can get the width as: But further peeking at imageObject shows a GetDictionary.

Other things we might like to consider is what if the PDF file is encrypted i. Going right back to the PdfReader instance, there is a function IsEncrypted. Well, save pdf page as image itextsharp is over.

IText - Convert PDF to Image

If null then uses same name as PDF file. If null or empty then uses same folder as PDF file. Always increment even if file is not written.

SAVE PDF PAGE AS IMAGE ITEXTSHARP PDF

ProcessContent requires two parameters — the page number easy and an IRenderListener. Lets call this new class PdfImageCollection.

Convert Scanned PDF into Image

So, our original loop becomes: We can dump it to a file, save in a list for later, whatever. For example, using a test pdf with but a single jpg in it, the pdf file happened to be KB. The resulting extracted jpg was KB. Not that I care for my original purpose.

Lets take a closer look at ImageRenderInfo.



Related Post