public PDFDocumentPageCollection Pages { get; }
public java.util.List<PDFDocumentPage> getPages();
public:
property PDFDocumentPageCollection^ Pages {
PDFDocumentPageCollection^ get();
}
Pages # get (PDFDocument)
A collection of PDFDocumentPage objects, containing an item for each page in the PDF file associated with this PDFDocument object. The default value is null.
The value of Pages will be automatically populated with the pages collection after a PDFDocument is created.
Each item in the collection corresponds to a page in the PDF file. To the number of pages in the document is Pages.Count and the item at index 0 is the properties of page 1, item at index 1 is the properties of page 2 and so on.
The PDFDocumentPage class contains the width and height of the page in PDF units which is read from the PDF file directly. PDF units are in 1/72 of an inch units, so a page size of 612 by 792 corresponds to 8.5 by 11 inches (612/72 by 792/72). For more information, refer to PDF Coordinate System.
PDFDocumentPageCollection is a read-only collection of PDFDocumentPage objects. The PDFDocument class is a read-only view of a PDF file, you cannot insert or delete pages into this object, instead, use the methods of the PDFFile class to achieve that.
To parse the objects of a PDF page, such as text items (characters), images, rectangles, annotations, form fields, digital signatures, fonts and hyperlinks, use the ParsePages method.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Controls;
using Leadtools.Pdf;
using Leadtools.Svg;
using Leadtools.WinForms;
public void PDFDocumentExample()
{
string pdfFileName = Path.Combine(LEAD_VARS.ImagesDir, @"Leadtools.pdf");
// Create a PDF document for file
using (PDFDocument document = new PDFDocument(pdfFileName))
{
// Show the file type and properties
Console.WriteLine("File type is : {0}", document.FileType);
Console.WriteLine("Contains : {0} pages", document.Pages.Count);
Console.WriteLine("----------:");
foreach (PDFDocumentPage page in document.Pages)
{
Console.WriteLine("Page: {0}, size: {1} by {2} ({3} by {4} inches)", page.PageNumber, page.Width, page.Height, page.WidthInches, page.HeightInches);
}
PDFDocumentProperties props = document.DocumentProperties;
Console.WriteLine("Properties:");
Console.WriteLine("----------:");
Console.WriteLine("Title: {0}", props.Title);
Console.WriteLine("Author: {0}", props.Author);
Console.WriteLine("Subject: {0}", props.Subject);
Console.WriteLine("Keywords: {0}", props.Keywords);
Console.WriteLine("Creator: {0}", props.Creator);
Console.WriteLine("Producer: {0}", props.Producer);
Console.WriteLine("Created: {0}", props.Created);
Console.WriteLine("Modified: {0}", props.Modified);
}
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}
import java.io.BufferedWriter;
import java.io.Console;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.nio.Buffer;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import javax.xml.validation.Schema;
import org.apache.lucene.store.Directory;
import org.junit.*;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import static org.junit.Assert.*;
import leadtools.*;
import leadtools.barcode.*;
import leadtools.codecs.*;
import leadtools.pdf.*;
import leadtools.svg.*;
public void pdfDocumentExample() {
String LEAD_VARS_ImagesDir = "C:\\LEADTOOLS23\\Resources\\Images";
String pdfFileName = combine(LEAD_VARS_ImagesDir, "Leadtools.pdf");
// Create a PDF document for file
PDFDocument document = new PDFDocument(pdfFileName);
// Show the file type and properties
System.out.println("File type is : " + document.getFileType());
int numPages = 0;
for (PDFDocumentPage page : document.getPages()) {
numPages++;
}
System.out.println("Contains : " + numPages + " pages");
System.out.println("----------:");
for (PDFDocumentPage page : document.getPages()) {
System.out.println("Page: " + page.getPageNumber() + ", size: " + page.getWidth() + " by " + page.getHeight()
+ " (" + page.getWidthInches() + " by " + page.getHeightInches() + " inches)");
}
PDFDocumentProperties props = document.getDocumentProperties();
System.out.println("Properties:");
System.out.println("----------:");
System.out.println("Title: " + props.getTitle());
System.out.println("Author: " + props.getAuthor());
System.out.println("Subject: " + props.getSubject());
System.out.println("Keywords: " + props.getKeywords());
System.out.println("Creator: " + props.getCreator());
System.out.println("Producer: " + props.getProducer());
System.out.println("Created: " + props.getCreated());
System.out.println("Modified: " + props.getModified());
assertTrue(props != null);
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document