VintaSoft PDF .NET Plug-in Discussions
Questions, comments and suggestions concerning VintaSoft PDF .NET Plug-in.
Board index < VintaSoft Imaging < VintaSoft PDF .NET Plug-in Discussions
----------------------------------------------------------------------------------------------------------------------------------------------
Private imageViewer1 As Vintasoft.Imaging.ImageViewer
Private _fileStream As System.IO.Stream = Nothing
Private _document As Vintasoft.Pdf.PdfDocument
Private _useEmbeddedThumbnails As Boolean = True
Private _titlePrefix As String = "VintaSoft PDF Reader Demo v3.1 {0}"
Private _isFirstOpenedPage As Boolean = False
_fileStream = New System.IO.FileStream(strArchivoPDF, System.IO.FileMode.Open, System.IO.FileAccess.Read)
_document = Vintasoft.Pdf.PdfDocumentController.OpenDocument(_fileStream)
_document.RenderingSettings.DrawPdfAnnotations = True
_document.RenderingSettings.DrawVintasoftAnnotations = True
_document.RenderingSettings.UseEmbeddedThumbnails = _useEmbeddedThumbnails
_fileStream.Position = 0
Dim openFileThread As New System.Threading.Thread(AddressOf OpenFileAsynchronously)
openFileThread.Start()
_isFirstOpenedPage = True
Text = String.Format(_titlePrefix, String.Format("- {0}", System.IO.Path.GetFileName(strArchivoPDF)))
If _document.IsEncrypted Then
Text += " (SECURED)"
End If
' #############################
' Let's go to generate JPG's...
' #############################
firstPage = 1
lastPage = _document.Pages.Count
For pageNo = 1 To _document.Pages.Count
For imageNo as integer = 1 to _document.Pages(pageNo).Images.Count - 1
MsgBox(_document.Pages(pageNo).Images(imageNo).Width)
MsgBox(_document.Pages(pageNo).Images(imageNo).Height)
_document.Pages(pageNo).Images(imageNo).GetImage.Save("c:\Page" & pageNo & " image" & imageNo & ".jpg")
Next
'we need to explore the position (x and y and rounding box) of each image in the PDF file
.../...
Next
----------------------------------------------------------------------------------------------------------------------------------------------
We have been reviewing the help, not just find a way to do this easily ???Imports System.Drawing
Imports Vintasoft.Pdf
Imports Vintasoft.Pdf.Tree
Imports Vintasoft.Pdf.Content.ImageExtraction
Module Module1
Sub Main()
' open existing PDF document
Dim pdfDocument As New PdfDocument("d:\PdfTest.pdf")
' for each PDF page
For i As Integer = 0 To pdfDocument.Pages.Count - 1
Console.WriteLine(String.Format("PDF page {0}", i))
GetInfoAboutImageResourcesOfPdfPage(pdfDocument.Pages(i))
Next
' free resources
pdfDocument.Dispose()
Console.ReadLine()
End Sub
Public Sub GetInfoAboutImageResourcesOfPdfPage(ByVal page As PdfPage)
Dim contentImages As ContentImage() = page.ImageExtractor.Images
For i As Integer = 0 To contentImages.Length - 1
Console.WriteLine(String.Format(" Image X={0}, Y={1}, Width={2}, Height={3}", _
contentImages(i).Region.LeftTop.X, _
contentImages(i).Region.LeftTop.Y, _
contentImages(i).Region.Bounds.Width, _
contentImages(i).Region.Bounds.Height))
Next
End Sub
End Module
Best regards, Alexander