C#: Online Guide
How To: PDF SDK

Basic SDK Concept

Home ›› XDoc.PDF ›› C# PDF: Basic SDK Concept

How to C#: Basic SDK Concept of XDoc.PDF


Introductions to Classes and APIs Included in XDoc.PDF for C# Programming




C#.NET PDF document SDK, RasterEdge XDoc.PDF is a mature and reliable third-party document imaging toolkit, designed particularly for manipulating and managing single-page and multi-page PDF document. This PDF document SDK provides Visual C#.NET developers with various APIs to read, create, convert and annotate PDF document from local file or byte stream in C#.NET class applications.


This guide page provides C# users with detailed explainations for basic SDK concepts of XDoc.PDF, which include PDF programming classes and availabel API references. Please see details as below.


Programming Classes


API References




How to C#: XDoc.PDF Programming Classes



In all, four basic C#.NET PDF programming classes will be talked in this part which are PDFDocument, PDFPage, PDFContext, PDFMetadata, and Outline.


Class: PDFDocument


This class refers to a PDF document and it contained all document information of the PDF file. It is an extension of BaseDocument. C# developers can use PDFDocument object to do bulk operations, like loading, saving, converting PDF to images/documents, and looking up PDF metadata. When a PDFDocument object is created, we can easily extract information about pages and other document structures.


Class: PDFPage


This class refers to PDF document page contained in PDFDocument and use BasePage as prototype. Storing page information, you can get images or SVG file out of PDFPage. Also you can add annotations onto PDFPage and save it in the document file format.


Class: PDFContext


This is a class similar to brush. It refers to the operators for PDF page corresponding information.


Class: PDFMetadata


Property

Type

Description

Title

String

Title of PDF document.

Author

String

Name of the person who created PDF document.

Subject

String

Subject of PDF document.

Keywords

String

Keywords associated with PDF document.

Creator

String

Name of the application that created the original PDF document.

Producer

String

Name of the application that converted a original document to PDF.

CreatedDate

DateTime

Date and time when PDF document was created.

ModifiedDate

DateTime

Date and time when PDF document was most recently modified.


Class: Outline


Property

Type

Description

Text

String

Entry text display in PDF outline.

Level

Int

Entry level. Minimum Value: 1.

PageIndex

Int

PDF page index of entry location. Valid: 0 ~ PageCount - 1.

PointF

PointF

Absolute position (in pixels) in PDF page of entry location.




How to C#: XDoc.PDF API References




RasterEdge XDoc.PDF provides users with various robust C#.NET APIs for high performance PDF document manipulations. We will explain all of them by dividing into three classes, which are PDFDocument class, PDFPage class, and PDFContext class.



PDFDocument Class API References


public PDFDocument(String filePath)


public PDFDocument(Stream stream)


public PDFDocument(byte[] dataBytes)


public PDFDocument(REImage image)


public PDFDocument(REImage[] images)


public void Save(String filePath)


public void SaveToStream(Stream stream)


public byte[] SaveToBytes()


public int GetPageCount()


public BasePage GetPage(int pageIndex)


public REOutline GetOutline()


public void SetDescription(PDFMetadata metadata)



API: public PDFDocument(String filePath)


Argument

Type

Description

[filePath]

String

File path of PDF document.


Return is FileType.


API: public PDFDocument(Stream stream)


Argument

Type

Description

[stream]

Stream

PDF document stream.


Return is FileType.


API: public PDFDocument(byte[] dataBytes)


Argument

Type

Description

[dataBytes]

Byte[]

PDF document byte array.


Return is FileType.


API: public PDFDocument(REImage image)


Argument

Type

Description

[image]

REImage

REImage.


Return is FileType.


API: public PDFDocument(REImage[] images)


Argument

Type

Description

[images]

REImage[]

REImage array.


Return is FileType.


API: public void Save(String filePath)


Argument

Type

Description

[filePath]

String

File path of output document.


API: public void SaveToStream(Stream stream)


Argument

Type

Description

[stream]

Stream

PDF document stream.


API: public byte[] SaveToBytes()


Argument

Type

Description

None

Byte[]

-


Return is PDFDocument byte array.


API: public int GetPageCount()


Argument

Type

Description

None

int

-


Return is PDFDocument page count.


API: public BasePage GetPage(int pageIndex)


Argument

Type

Description

[pageIndex]

int

Page index, starting from 0. Valid Range: from 0 to page count -1.


Return is PDFDocument defined page.


API: public REOutline GetOutline()


Argument

Type

Description

None

REOutline

-


Return is PDFDocument outline.


API: public void SetDescription(PDFMetadata metadata)


Argument

Type

Description

[metadata]

PDFMetadata

PDF document metadata.



PDFPage Class API References


public PDFPage(REImage image)


public float GetWidth()


public float GetHeight()


public float GetRotation()


public Bitmap GetBitmap()


public Bitmap GetBitmap(int targetResolution)


public Bitmap GetBitmap(float zoomValue)


public void ConvertToImage(ImageType imageType, String filePath)



API: public PDFPage(REImage image)


Argument

Type

Description

[image]

REImage

REImage.


API: public float GetWidth()


Argument

Type

Description

None

-

-


Return is PDFPage width (float).


API: public float GetHeight()


Argument

Type

Description

None

-

-


Return is PDFPage height (float).


API: public float GetRotation()


Argument

Type

Description

None

-

-


Return is PDFPage rotation angle (float). Valid values: 90, 180, and 270.


API: public Bitmap GetBitmap()


Argument

Type

Description

None

-

-


Return is bitmap.


API: public Bitmap GetBitmap(int targetResolution)


Argument

Type

Description

[targetResolution]

int

Target resolution in pixels per inch.


Return is bitmap.


API: public Bitmap GetBitmap(float zoomValue)


Argument

Type

Description

[zoomValue]

float

Zoom factor that is used to enlarge PDF page and return result image.


Return is bitmap.


API: public void ConvertToImage(ImageType imageType, String filePath)


Arguments

Type

Description

[imageType]

ImageType

Target image type.

[filePath]

String

Output file path.



PDFContext Class API References


public PDFContext()


public int SaveToFile(String filePath)


public void SetWidth(RELength width)


public void SetHeight(RELength height)


public void SetBackGroundColor(Color color)



API: public PDFContext()


Argument

Type

Description

None

-

-


API: public int SaveToFile(String filePath)


Argument

Type

Description

[filePath]

String

PDFPage output file path.


Return is int.


API: public void SetWidth(RELength width)


Argument

Type

Description

[width]

RELength

PDFContext width.


API: public void SetHeight(RELength height)


Argument

Type

Description

[height]

RELength

PDFContext height.


API: public void SetBackGroundColor(Color color)


Argument

Type

Description

[color]

Color

PDFContext background color.