PDFsharp & MigraDoc Forum https://forum.pdfsharp.net/ |
|
Extract Tiff Images From PDF https://forum.pdfsharp.net/viewtopic.php?f=2&t=2657 |
Page 1 of 1 |
Author: | dsenthil19 [ Wed Nov 20, 2013 11:53 am ] |
Post subject: | Extract Tiff Images From PDF |
Dear Team, I have loaded pdf document (tifflzw decoded) using pdf sharp . I would like to extract image from pdf. I am using below code. I can able to extract jpeg decoded images from pdf but tiff decoded images could not. How to achieve this. Code: Dim document As PdfSharp.Pdf.PdfDocument = PdfSharp.Pdf.IO.PdfReader.Open(tpath) Dim imageCount As Integer = 0 ' Iterate pages For Each page As PdfSharp.Pdf.PdfPage In document.Pages Dim resources As PdfSharp.Pdf.PdfDictionary = page.Elements.GetDictionary("/Resources") If resources IsNot Nothing Then ' Get external objects dictionary Dim xObjects As PdfSharp.Pdf.PdfDictionary = resources.Elements.GetDictionary("/XObject") If xObjects IsNot Nothing Then Dim items As ICollection(Of PdfSharp.Pdf.PdfItem) = xObjects.Elements.Values ' Iterate references to external objects For Each item As PdfSharp.Pdf.PdfItem In items Dim reference As PdfSharp.Pdf.Advanced.PdfReference = TryCast(item, PdfSharp.Pdf.Advanced.PdfReference) If reference IsNot Nothing Then Dim xObject As PdfSharp.Pdf.PdfDictionary = TryCast(reference.Value, PdfSharp.Pdf.PdfDictionary) ' Is external object an image? If xObject IsNot Nothing AndAlso xObject.Elements.GetString("/Subtype") = "/Image" Then ExportImage(xObject, imageCount) End If End If Next End If End If Next Thanks in advance, Senthil D |
Author: | Thomas Hoevel [ Wed Nov 20, 2013 2:43 pm ] |
Post subject: | Re: Extract Tiff Images From PDF |
This thread might be helpful: viewtopic.php?p=4544#p4544 |
Author: | dsenthil19 [ Fri Nov 22, 2013 12:48 pm ] |
Post subject: | Re: Extract Tiff Images From PDF |
Hi Thomas, Thanks for the thread provided. I had gone through that and it was helpful for png format. Can you help me for tiff format ? Thank you, Senthil D |
Author: | dsenthil19 [ Mon Nov 25, 2013 3:57 am ] |
Post subject: | Re: Extract Tiff Images From PDF |
Hi Team, Could you please help us on above query ?. Thank you, Senthil D |
Author: | Thomas Hoevel [ Mon Nov 25, 2013 9:02 am ] |
Post subject: | Re: Extract Tiff Images From PDF |
"TIFF images" are left as an exercise for the reader. PDFsharp implements the encoding, but not the decoding. BTW: PDF files contain JPEG images and PDF images. It's up to you to convert them to PNG or TIFF. We don't have code that does it. |
Author: | calosteward [ Fri Aug 28, 2015 2:21 am ] |
Post subject: | Re: Extract Tiff Images From PDF |
I also want to get a code sample for extraction of TIFF from PDF, but I only find resource for extracting other image from PDF. Are there any resource for it now? Any help will be appreciated. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |