GetImages() Метод (PdfDocument)
Возвращает коллекцию ресурсов изображений этого PDF документа.
Return Value
Коллекция, содержащая все ресурсы изображений этого PDF документа.
Вот пример, показывающий, как получить информацию обо всех ресурсах изображений PDF страницы:
''' <summary>
''' Prints information about image-resources of PDF document.
''' </summary>
''' <param name="pdfFilename">The filename of PDF document.</param>
Public Shared Sub GetPdfImagesInfo(pdfFilename As String)
' open PDF document
Using document As New Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename)
' get collection of image-resources of PDF document
Dim images As Vintasoft.Imaging.Pdf.Tree.PdfImageResource() = document.GetImages()
' print count of image-resource
System.Console.WriteLine("Images count: {0}", images.Length)
' for each image-resource
For Each image As Vintasoft.Imaging.Pdf.Tree.PdfImageResource In images
' print information about image-resource
System.Console.WriteLine(vbTab & "{0,4}x{1,-4} {2,5}bpp {3}", image.Width, image.Height, image.BitsPerPixel, image.Compression)
Next
End Using
End Sub
' This code example produces the following output:
Images count: 11
189x41 24bpp Jpeg
120x50 24bpp Jpeg
122x56 24bpp Jpeg
143x41 24bpp Jpeg
216x21 24bpp Jpeg
106x49 8bpp Zip
209x30 24bpp Jpeg
189x24 24bpp Jpeg
122x42 24bpp Jpeg
5x7 24bpp Zip
817x292 24bpp Jpeg
/// <summary>
/// Prints information about image-resources of PDF document.
/// </summary>
/// <param name="pdfFilename">The filename of PDF document.</param>
public static void GetPdfImagesInfo(string pdfFilename)
{
// open PDF document
using (Vintasoft.Imaging.Pdf.PdfDocument document =
new Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename))
{
// get collection of image-resources of PDF document
Vintasoft.Imaging.Pdf.Tree.PdfImageResource[] images = document.GetImages();
// print count of image-resource
System.Console.WriteLine("Images count: {0}", images.Length);
// for each image-resource
foreach (Vintasoft.Imaging.Pdf.Tree.PdfImageResource image in images)
{
// print information about image-resource
System.Console.WriteLine("\t{0,4}x{1,-4} {2,5}bpp {3}", image.Width, image.Height,
image.BitsPerPixel, image.Compression);
}
}
}
/* This code example produces the following output:
Images count: 11
189x41 24bpp Jpeg
120x50 24bpp Jpeg
122x56 24bpp Jpeg
143x41 24bpp Jpeg
216x21 24bpp Jpeg
106x49 8bpp Zip
209x30 24bpp Jpeg
189x24 24bpp Jpeg
122x42 24bpp Jpeg
5x7 24bpp Zip
817x292 24bpp Jpeg
*/
Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5