cete.dynamicpdf.merger.pdfpage
PdfPage
- Namespace: ceTe.DynamicPDF.Merger
- Assemblies: DynamicPDF.NETFramework40.dll, DynamicPDF.NETStandard20.dll
Represents a page from an imported PDF document.
public class PdfPage
Public Class PdfPage
Inheritance: Object → PdfPage
Licensing
This class is a DynamicPDF Merger Standard Edition feature. One of the following licenses is required for non-evaluation usage:
- DynamicPDF Merger for .NET Standard Edition
- DynamicPDF Merger for .NET Professional Edition
- DynamicPDF Merger for .NET Enterprise Edition
- DynamicPDF Core Suite for .NET Professional Edition
- DynamicPDF Core Suite for .NET Enterprise Edition
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.
GetContents()
Returns the uncompressed binary contents of the page.
public Byte[] GetContents()
Function GetContents() As Byte()
Returns
A byte array containing the pages contents.
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.
GetDimensions()
Gets the page dimensions of the page.
public PageDimensions GetDimensions()
Function GetDimensions() As PageDimensions
Returns
A PageDimensions object.
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 .
GetText()
Gets the text in the page.
public string GetText()
Function GetText() As String
Returns
A string containing the text in the page.
Licensing
This method is a DynamicPDF Merger Professional Edition feature. One of the following licenses is required for non-evaluation usage:
- DynamicPDF Merger for .NET Professional Edition
- DynamicPDF Merger for .NET Enterprise Edition
- DynamicPDF Core Suite for .NET Professional Edition
- DynamicPDF Core Suite for .NET Enterprise Edition
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.
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.
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.
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 .