Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>iTextSharp should handle that. Exit on the first image</p> <p>example here <a href="http://www.vbforums.com/showthread.php?t=530736" rel="nofollow">http://www.vbforums.com/showthread.php?t=530736</a></p> <p>Edit:</p> <p>Copied code from the thread by stanav</p> <pre><code>Public Shared Function ExtractImages(ByVal sourcePdf As String) As List(Of Image) Dim imgList As New List(Of Image) Dim raf As iTextSharp.text.pdf.RandomAccessFileOrArray = Nothing Dim reader As iTextSharp.text.pdf.PdfReader = Nothing Dim pdfObj As iTextSharp.text.pdf.PdfObject = Nothing Dim pdfStrem As iTextSharp.text.pdf.PdfStream = Nothing Try raf = New iTextSharp.text.pdf.RandomAccessFileOrArray(sourcePdf) reader = New iTextSharp.text.pdf.PdfReader(raf, Nothing) For i As Integer = 0 To reader.XrefSize - 1 pdfObj = reader.GetPdfObject(i) If Not IsNothing(pdfObj) AndAlso pdfObj.IsStream() Then pdfStrem = DirectCast(pdfObj, iTextSharp.text.pdf.PdfStream) Dim subtype As iTextSharp.text.pdf.PdfObject = pdfStrem.Get(iTextSharp.text.pdf.PdfName.SUBTYPE) If Not IsNothing(subtype) AndAlso subtype.ToString = iTextSharp.text.pdf.PdfName.IMAGE.ToString Then Dim bytes() As Byte = iTextSharp.text.pdf.PdfReader.GetStreamBytesRaw(CType(pdfStrem, iTextSharp.text.pdf.PRStream)) If Not IsNothing(bytes) Then Try Using memStream As New System.IO.MemoryStream(bytes) memStream.Position = 0 Dim img As Image = Image.FromStream(memStream) imgList.Add(img) End Using Catch ex As Exception 'Most likely the image is in an unsupported format 'Do nothing 'You can add your own code to handle this exception if you want to End Try End If End If End If Next reader.Close() Catch ex As Exception MessageBox.Show(ex.Message) End Try Return imgList End Function </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload