cete.dynamicpdf.merger.pdfpage
PdfPage
- Namespace: ceTe.DynamicPDF.Merger
- Assemblies: DynamicPDF.CoreSuite.dll
Represents a page from an imported PDF document.
public class PdfPage
Public Class PdfPage
Inheritance: Object → PdfPage
Licensing Info
This class is a DynamicPDF Core Suite Essentials feature. One of the following is required for non-evaluation usage:
- Any active DynamicPDF Subscription (Essentials, Professional, Professional Plus or Ultimate).
- A DynamicPDF Core Suite for .NET v12.X Essentials license.
- It can also be used for free with a public link back to www.dynamicpdf.com and with the DynamicPDF Essentials message displaying on the bottom of each page.
Methods
Equals(Object)
Determines whether the specified Object is equal to the current Object . (Inherited from Object)
public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean
Parameters
- obj: Object
The Object to compare with the current Object .
Returns
true if the specified Object is equal to the current Object ; otherwise, false.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Get3DImages()
Gets the informaton of all the 3D images present in the page.
public ImageInformation3D[] Get3DImages()
Function Get3DImages() As ImageInformation3D[]
Returns
An array of ImageInformation3D object for all the images present in the page.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
GetContents()
Returns the uncompressed binary contents of the page.
public Byte[] GetContents()
Function GetContents() As Byte()
Returns
A byte array containing the pages contents.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
GetDictionaryValue(String)
Returns the value of a given page dictionary key.
public string GetDictionaryValue(string key)
Function GetDictionaryValue(key As String) As String
Parameters
- key: String
The dictionaries key.
Returns
The dictionary key's value as a string.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
GetDimensions()
Gets the page dimensions of the page.
public PageDimensions GetDimensions()
Function GetDimensions() As PageDimensions
Returns
A PageDimensions object.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
GetFonts()
Gets the informaton of all the fonts present in the page.
public FontInformation[] GetFonts()
Function GetFonts() As FontInformation[]
Returns
An array of the FontInformation .
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
GetHashCode()
Serves as a hash function for a particular type. (Inherited from Object)
public int GetHashCode()
Function GetHashCode() As Integer
Returns
A hash code for the current Object .
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
GetImages()
Gets the informaton of all the images present in the page.
public ImageInformation[] GetImages()
Function GetImages() As ImageInformation[]
Returns
An array of ImageInformation object for all the images present in the page.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example will extract the images in the specified page in the given PDF document.
Imports System
Imports System.IO
Imports ceTe.DynamicPDF.Merger
Module MyModule
Sub Main()
' Create PDF document object
Dim pdfA As PdfDocument = New PdfDocument( "C:\Input.pdf")
' Call GetText method from PDF document object to get the text from the document
Dim imageInfoList As ImageInformation() = pdfA.Pages.Item(1).GetImages()
For i As Integer = 0 To imageInfoList.Length - 1 Dim extractedImageData As ExtractedImageData = imageInfoList(i).GetImage() Dim data As Byte() = Nothing Dim extension As String = ""
If extractedImageData.ExtractedImageType = ExtractedImageType.Png Then extension = ".png" Else extension = ".jpg" End If
data = extractedImageData.Data File.WriteAllBytes("C:\Output\image" & i & extension, data)
Next
End Sub
End Module
using System;
using System.IO;
using ceTe.DynamicPDF.Merger;
public class Example
{
public static void GetText(string inputPath, string outputPath)
{
// Create PDF document object
PdfDocument pdfA = new PdfDocument(inputPath);
// Call GetImages method from PDF document object to get the images from the document
ImageInformation[] imageInfoList = pdf.Pages[0].GetImages();
for (int i = 0; i < imageInfoList.Length; i++)
{
ExtractedImageData extractedImageData = imageInfoList[i].GetImage();
byte[] data = null;
string extension = "";
if (extractedImageData.ExtractedImageType == ExtractedImageType.Png)
extension = ".png";
else
extension = ".jpg";
data = extractedImageData.Data;
File.WriteAllBytes(outputPath + i + extension, data);
}
}
}
GetNoteAnnotations()
Gets the note annotations from the the PDF page.
public PdfNoteAnnotation[] GetNoteAnnotations()
Function GetNoteAnnotations() As PdfNoteAnnotation[]
Returns
A array of note annotations present in the PDF page.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
GetText()
Gets the text in the page.
public string GetText()
Function GetText() As String
Returns
A string containing the text in the page.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example will extract the entire text of the specified page in the given PDF documents.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.Merger
Module MyModule
Sub Main()
' Create PDF document object
Dim pdfA As PdfDocument = New PdfDocument( "C:\Invoice.pdf")
' Call GetText method from PDF document object to get the text from the document
Dim extractedText As String = pdfA.Pages.Item(1).GetText()
End Sub
End Module
using System;
using ceTe.DynamicPDF.Merger;
public class Example
{
public static void GetText(string inputPath)
{
// Create PDF document object
PdfDocument pdfA = new PdfDocument(inputPath);
// Call GetText method from PDF document object to get the text from the document
string extractedText = pdfA.Pages[0].GetText();
}
}
Remarks
This method can be used to extract the text in the same order the pdf operators are loaded. Text extraction skips characters that are morethan 2 bytes. With some of the .Net runtimes (example: .Net Core 2.0), Text extraction will give the error "No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.". To resolve this error refer the user manual page Encoding Considerations.
GetText(Single, Single, Single, Single)
Gets the text in the specified rectangle of the page.
public string GetText(float x, float y, float width, float height)
Function GetText(x As Single, y As Single, width As Single, height As Single) As String
Parameters
- x: Single
X coordinate of the rectangle.
- y: Single
Y coordinate of the rectangle.
- width: Single
Width of the rectangle.
- height: Single
Height of the rectangle.
Returns
A string containing the text in the specified rectangle of the page.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Remarks
This method can be used to extract the text in the same order the pdf operators are loaded. Text extraction skips characters that are morethan 2 bytes.
GetText(Single, Single, Single, Single, TextExtractionOrder)
Gets the text in the specified rectangle of the page.
public string GetText(float x, float y, float width, float height, TextExtractionOrder textExtractionOrder)
Function GetText(x As Single, y As Single, width As Single, height As Single, textExtractionOrder As TextExtractionOrder) As String
Parameters
- x: Single
X coordinate of the rectangle.
- y: Single
Y coordinate of the rectangle.
- width: Single
Width of the rectangle.
- height: Single
Height of the rectangle.
- textExtractionOrder: TextExtractionOrder
Order in which text has to be extracted.
Returns
A string containing the text in the specified rectangle of the page.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Remarks
This method can be used to extract the text in the same order the pdf operators are loaded. Text extraction skips characters that are morethan 2 bytes.
GetText(TextExtractionOrder)
Gets the text in the page.
public string GetText(TextExtractionOrder textExtractionOrder)
Function GetText(textExtractionOrder As TextExtractionOrder) As String
Parameters
- textExtractionOrder: TextExtractionOrder
Order in which text has to be extracted.
Returns
A string containing the text in the page.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example will extract the entire text of the specified page in the given PDF documents.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.Merger
Module MyModule
Sub Main()
' Create PDF document object
Dim pdfA As PdfDocument = New PdfDocument( "C:\Invoice.pdf")
' Call GetText method from PDF document object to get the text from the document
Dim extractedText As String = pdfA.Pages.Item(1).GetText()
End Sub
End Module
using System;
using ceTe.DynamicPDF.Merger;
public class Example
{
public static void GetText(string inputPath)
{
// Create PDF document object
PdfDocument pdfA = new PdfDocument(inputPath);
// Call GetText method from PDF document object to get the text from the document
string extractedText = pdfA.Pages[0].GetText();
}
}
Remarks
This method can be used to extract the text in the same order the pdf operators are loaded. Text extraction skips characters that are morethan 2 bytes. With some of the .Net runtimes (example: .Net Core 2.0), Text extraction will give the error "No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.". To resolve this error refer the user manual page Encoding Considerations.
GetType()
Gets the Type of the current instance. (Inherited from Object)
public Type GetType()
Function GetType() As Type
Returns
The Type instance that represents the exact runtime type of the current instance.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
ToString()
Returns a String that represents the current Object . (Inherited from Object)
public string ToString()
Function ToString() As String
Returns
A String that represents the current Object .
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.