PdfiumViewer
Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties | List of all members
PdfiumViewer.PdfDocument Class Reference

Provides functionality to render a PDF document. More...

Inheritance diagram for PdfiumViewer.PdfDocument:
PdfiumViewer.IPdfDocument

Public Member Functions

void Render (int page, Graphics graphics, float dpiX, float dpiY, Rectangle bounds, bool forPrinting)
 Renders a page of the PDF document to the provided graphics instance. More...
 
void Render (int page, Graphics graphics, float dpiX, float dpiY, Rectangle bounds, PdfRenderFlags flags)
 Renders a page of the PDF document to the provided graphics instance. More...
 
Image Render (int page, float dpiX, float dpiY, bool forPrinting)
 Renders a page of the PDF document to an image. More...
 
Image Render (int page, float dpiX, float dpiY, PdfRenderFlags flags)
 Renders a page of the PDF document to an image. More...
 
Image Render (int page, int width, int height, float dpiX, float dpiY, bool forPrinting)
 Renders a page of the PDF document to an image. More...
 
Image Render (int page, int width, int height, float dpiX, float dpiY, PdfRenderFlags flags)
 Renders a page of the PDF document to an image. More...
 
Image Render (int page, int width, int height, float dpiX, float dpiY, PdfRotation rotate, PdfRenderFlags flags)
 Renders a page of the PDF document to an image. More...
 
void Save (string path)
 Save the PDF document to the specified location. More...
 
void Save (Stream stream)
 Save the PDF document to the specified location. More...
 
PdfMatches Search (string text, bool matchCase, bool wholeWord)
 Finds all occurences of text. More...
 
PdfMatches Search (string text, bool matchCase, bool wholeWord, int page)
 Finds all occurences of text. More...
 
PdfMatches Search (string text, bool matchCase, bool wholeWord, int startPage, int endPage)
 Finds all occurences of text. More...
 
string GetPdfText (int page)
 Get all text on the page. More...
 
IEnumerable< PdfTextAndRectGetPdfTextAndRects (int page)
 Get all text and corresponding bounding box on the page. More...
 
string GetBoundedText (int page, RectangleF rect)
 Get all text which touches hit box. More...
 
string GetPdfText (PdfTextSpan textSpan)
 Get all text matching the text span. More...
 
IList< PdfRectangleGetTextBounds (PdfTextSpan textSpan)
 Get all bounding rectangles for the text span. More...
 
PointF PointToPdf (int page, Point point)
 Convert a point from device coordinates to page coordinates. More...
 
Point PointFromPdf (int page, PointF point)
 Convert a point from page coordinates to device coordinates. More...
 
RectangleF RectangleToPdf (int page, Rectangle rect)
 Convert a rectangle from device coordinates to page coordinates. More...
 
Rectangle RectangleFromPdf (int page, RectangleF rect)
 Convert a rectangle from page coordinates to device coordinates. More...
 
PrintDocument CreatePrintDocument ()
 Creates a PrintDocument for the PDF document. More...
 
PrintDocument CreatePrintDocument (PdfPrintMode printMode)
 Creates a PrintDocument for the PDF document. More...
 
PrintDocument CreatePrintDocument (PdfPrintSettings settings)
 Creates a PrintDocument for the PDF document. More...
 
PdfPageLinks GetPageLinks (int page, Size size)
 Returns all links on the PDF page. More...
 
void DeletePage (int page)
 Delete the page from the PDF document. More...
 
void RotatePage (int page, PdfRotation rotation)
 Set rotation of the page. More...
 
PdfRotation GetPageRotation (int page)
 Get rotation of the page. More...
 
void ImportPages (PdfDocument source, string pageRange, int startDestIndex)
 Import pages from source document. More...
 
void CopyPages (string pageRange, int startDestIndex)
 Copy pages within this document. More...
 
PdfInformation GetInformation ()
 Get metadata information from the PDF document. More...
 
void Dispose ()
 Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. More...
 

Static Public Member Functions

static PdfDocument Load (string path)
 Initializes a new instance of the PdfDocument class with the provided path. More...
 
static PdfDocument Load (string path, string password)
 Initializes a new instance of the PdfDocument class with the provided path. More...
 
static PdfDocument Load (IWin32Window owner, string path)
 Initializes a new instance of the PdfDocument class with the provided path. More...
 
static PdfDocument Load (IWin32Window owner, Stream stream)
 Initializes a new instance of the PdfDocument class with the provided path. More...
 
static PdfDocument Load (Stream stream)
 Initializes a new instance of the PdfDocument class with the provided stream. More...
 
static PdfDocument Load (Stream stream, string password)
 Initializes a new instance of the PdfDocument class with the provided stream. More...
 
static PdfDocument Compose (PdfDocument source, string pageRange)
 Compose new document from existing document and page ranges. More...
 

Protected Member Functions

void Dispose (bool disposing)
 Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. More...
 

Properties

int PageCount [get]
 Number of pages in the PDF document. More...
 
PdfBookmarkCollection Bookmarks [get]
 Bookmarks stored in this PdfFile More...
 
IList< SizeF > PageSizes [get]
 Size of each page in the PDF document. More...
 
- Properties inherited from PdfiumViewer.IPdfDocument
int PageCount [get]
 Number of pages in the PDF document. More...
 
PdfBookmarkCollection Bookmarks [get]
 Bookmarks stored in this PdfFile More...
 
IList< SizeF > PageSizes [get]
 Size of each page in the PDF document. More...
 

Detailed Description

Provides functionality to render a PDF document.

Member Function Documentation

◆ Compose()

static PdfDocument PdfiumViewer.PdfDocument.Compose ( PdfDocument  source,
string  pageRange 
)
static

Compose new document from existing document and page ranges.

Parameters
sourceThe source document
pageRange1,2-3 and so on, or null for entire
Returns
New document

◆ CopyPages()

void PdfiumViewer.PdfDocument.CopyPages ( string  pageRange,
int  startDestIndex 
)

Copy pages within this document.

Parameters
pageRange1,2-3 and so on, or null for entire
startDestIndexThe destination page index

◆ CreatePrintDocument() [1/3]

PrintDocument PdfiumViewer.PdfDocument.CreatePrintDocument ( )

Creates a PrintDocument for the PDF document.

Returns

Implements PdfiumViewer.IPdfDocument.

◆ CreatePrintDocument() [2/3]

PrintDocument PdfiumViewer.PdfDocument.CreatePrintDocument ( PdfPrintMode  printMode)

Creates a PrintDocument for the PDF document.

Parameters
printModeSpecifies the mode for printing. The default value for this parameter is CutMargin.
Returns

Implements PdfiumViewer.IPdfDocument.

◆ CreatePrintDocument() [3/3]

PrintDocument PdfiumViewer.PdfDocument.CreatePrintDocument ( PdfPrintSettings  settings)

Creates a PrintDocument for the PDF document.

Parameters
settingsThe settings used to configure the print document.
Returns

Implements PdfiumViewer.IPdfDocument.

◆ DeletePage()

void PdfiumViewer.PdfDocument.DeletePage ( int  page)

Delete the page from the PDF document.

Parameters
pageThe page to delete.

Implements PdfiumViewer.IPdfDocument.

◆ Dispose() [1/2]

void PdfiumViewer.PdfDocument.Dispose ( )

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

<filterpriority>2</filterpriority>

◆ Dispose() [2/2]

void PdfiumViewer.PdfDocument.Dispose ( bool  disposing)
protected

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Parameters
disposingWhether this method is called from Dispose.

◆ GetBoundedText()

string PdfiumViewer.PdfDocument.GetBoundedText ( int  page,
RectangleF  rect 
)

Get all text which touches hit box.

Parameters
pageThe page to get the text for.
rectThe hit box
Returns
The text.

◆ GetInformation()

PdfInformation PdfiumViewer.PdfDocument.GetInformation ( )

Get metadata information from the PDF document.

Returns
The PDF metadata.

Implements PdfiumViewer.IPdfDocument.

◆ GetPageLinks()

PdfPageLinks PdfiumViewer.PdfDocument.GetPageLinks ( int  page,
Size  size 
)

Returns all links on the PDF page.

Parameters
pageThe page to get the links for.
sizeThe size of the page.
Returns
A collection with the links on the page.

Implements PdfiumViewer.IPdfDocument.

◆ GetPageRotation()

PdfRotation PdfiumViewer.PdfDocument.GetPageRotation ( int  page)

Get rotation of the page.

Parameters
pageThe page index
Returns
The page rotation

◆ GetPdfText() [1/2]

string PdfiumViewer.PdfDocument.GetPdfText ( int  page)

Get all text on the page.

Parameters
pageThe page to get the text for.
Returns
The text on the page.

Implements PdfiumViewer.IPdfDocument.

◆ GetPdfText() [2/2]

string PdfiumViewer.PdfDocument.GetPdfText ( PdfTextSpan  textSpan)

Get all text matching the text span.

Parameters
textSpanThe span to get the text for.
Returns
The text matching the span.

Implements PdfiumViewer.IPdfDocument.

◆ GetPdfTextAndRects()

IEnumerable<PdfTextAndRect> PdfiumViewer.PdfDocument.GetPdfTextAndRects ( int  page)

Get all text and corresponding bounding box on the page.

Parameters
pageThe page to get the text for.
Returns
The text and rect on the page.

◆ GetTextBounds()

IList<PdfRectangle> PdfiumViewer.PdfDocument.GetTextBounds ( PdfTextSpan  textSpan)

Get all bounding rectangles for the text span.

The algorithm used to get the bounding rectangles tries to join adjacent character bounds into larger rectangles.

Parameters
textSpanThe span to get the bounding rectangles for.
Returns
The bounding rectangles.

Implements PdfiumViewer.IPdfDocument.

◆ ImportPages()

void PdfiumViewer.PdfDocument.ImportPages ( PdfDocument  source,
string  pageRange,
int  startDestIndex 
)

Import pages from source document.

Parameters
sourceThe source document
pageRange1,2-3 and so on, or null for entire
startDestIndexThe destination page index

◆ Load() [1/6]

static PdfDocument PdfiumViewer.PdfDocument.Load ( IWin32Window  owner,
Stream  stream 
)
static

Initializes a new instance of the PdfDocument class with the provided path.

Parameters
ownerWindow to show any UI for.
streamStream for the PDF document.

◆ Load() [2/6]

static PdfDocument PdfiumViewer.PdfDocument.Load ( IWin32Window  owner,
string  path 
)
static

Initializes a new instance of the PdfDocument class with the provided path.

Parameters
ownerWindow to show any UI for.
pathPath to the PDF document.

◆ Load() [3/6]

static PdfDocument PdfiumViewer.PdfDocument.Load ( Stream  stream)
static

Initializes a new instance of the PdfDocument class with the provided stream.

Parameters
streamStream for the PDF document.

◆ Load() [4/6]

static PdfDocument PdfiumViewer.PdfDocument.Load ( Stream  stream,
string  password 
)
static

Initializes a new instance of the PdfDocument class with the provided stream.

Parameters
streamStream for the PDF document.
passwordPassword for the PDF document.

◆ Load() [5/6]

static PdfDocument PdfiumViewer.PdfDocument.Load ( string  path)
static

Initializes a new instance of the PdfDocument class with the provided path.

Parameters
pathPath to the PDF document.

◆ Load() [6/6]

static PdfDocument PdfiumViewer.PdfDocument.Load ( string  path,
string  password 
)
static

Initializes a new instance of the PdfDocument class with the provided path.

Parameters
pathPath to the PDF document.
passwordPassword for the PDF document.

◆ PointFromPdf()

Point PdfiumViewer.PdfDocument.PointFromPdf ( int  page,
PointF  point 
)

Convert a point from page coordinates to device coordinates.

Parameters
pageThe page number where the point is from.
pointThe point to convert.
Returns
The converted point.

Implements PdfiumViewer.IPdfDocument.

◆ PointToPdf()

PointF PdfiumViewer.PdfDocument.PointToPdf ( int  page,
Point  point 
)

Convert a point from device coordinates to page coordinates.

Parameters
pageThe page number where the point is from.
pointThe point to convert.
Returns
The converted point.

Implements PdfiumViewer.IPdfDocument.

◆ RectangleFromPdf()

Rectangle PdfiumViewer.PdfDocument.RectangleFromPdf ( int  page,
RectangleF  rect 
)

Convert a rectangle from page coordinates to device coordinates.

Parameters
pageThe page where the rectangle is from.
rectThe rectangle to convert.
Returns
The converted rectangle.

Implements PdfiumViewer.IPdfDocument.

◆ RectangleToPdf()

RectangleF PdfiumViewer.PdfDocument.RectangleToPdf ( int  page,
Rectangle  rect 
)

Convert a rectangle from device coordinates to page coordinates.

Parameters
pageThe page where the rectangle is from.
rectThe rectangle to convert.
Returns
The converted rectangle.

Implements PdfiumViewer.IPdfDocument.

◆ Render() [1/7]

Image PdfiumViewer.PdfDocument.Render ( int  page,
float  dpiX,
float  dpiY,
bool  forPrinting 
)

Renders a page of the PDF document to an image.

Parameters
pageNumber of the page to render.
dpiXHorizontal DPI.
dpiYVertical DPI.
forPrintingRender the page for printing.
Returns
The rendered image.

Implements PdfiumViewer.IPdfDocument.

◆ Render() [2/7]

Image PdfiumViewer.PdfDocument.Render ( int  page,
float  dpiX,
float  dpiY,
PdfRenderFlags  flags 
)

Renders a page of the PDF document to an image.

Parameters
pageNumber of the page to render.
dpiXHorizontal DPI.
dpiYVertical DPI.
flagsFlags used to influence the rendering.
Returns
The rendered image.

Implements PdfiumViewer.IPdfDocument.

◆ Render() [3/7]

void PdfiumViewer.PdfDocument.Render ( int  page,
Graphics  graphics,
float  dpiX,
float  dpiY,
Rectangle  bounds,
bool  forPrinting 
)

Renders a page of the PDF document to the provided graphics instance.

Parameters
pageNumber of the page to render.
graphicsGraphics instance to render the page on.
dpiXHorizontal DPI.
dpiYVertical DPI.
boundsBounds to render the page in.
forPrintingRender the page for printing.

Implements PdfiumViewer.IPdfDocument.

◆ Render() [4/7]

void PdfiumViewer.PdfDocument.Render ( int  page,
Graphics  graphics,
float  dpiX,
float  dpiY,
Rectangle  bounds,
PdfRenderFlags  flags 
)

Renders a page of the PDF document to the provided graphics instance.

Parameters
pageNumber of the page to render.
graphicsGraphics instance to render the page on.
dpiXHorizontal DPI.
dpiYVertical DPI.
boundsBounds to render the page in.
flagsFlags used to influence the rendering.

Implements PdfiumViewer.IPdfDocument.

◆ Render() [5/7]

Image PdfiumViewer.PdfDocument.Render ( int  page,
int  width,
int  height,
float  dpiX,
float  dpiY,
bool  forPrinting 
)

Renders a page of the PDF document to an image.

Parameters
pageNumber of the page to render.
widthWidth of the rendered image.
heightHeight of the rendered image.
dpiXHorizontal DPI.
dpiYVertical DPI.
forPrintingRender the page for printing.
Returns
The rendered image.

Implements PdfiumViewer.IPdfDocument.

◆ Render() [6/7]

Image PdfiumViewer.PdfDocument.Render ( int  page,
int  width,
int  height,
float  dpiX,
float  dpiY,
PdfRenderFlags  flags 
)

Renders a page of the PDF document to an image.

Parameters
pageNumber of the page to render.
widthWidth of the rendered image.
heightHeight of the rendered image.
dpiXHorizontal DPI.
dpiYVertical DPI.
flagsFlags used to influence the rendering.
Returns
The rendered image.

Implements PdfiumViewer.IPdfDocument.

◆ Render() [7/7]

Image PdfiumViewer.PdfDocument.Render ( int  page,
int  width,
int  height,
float  dpiX,
float  dpiY,
PdfRotation  rotate,
PdfRenderFlags  flags 
)

Renders a page of the PDF document to an image.

Parameters
pageNumber of the page to render.
widthWidth of the rendered image.
heightHeight of the rendered image.
dpiXHorizontal DPI.
dpiYVertical DPI.
rotateRotation.
flagsFlags used to influence the rendering.
Returns
The rendered image.

Implements PdfiumViewer.IPdfDocument.

◆ RotatePage()

void PdfiumViewer.PdfDocument.RotatePage ( int  page,
PdfRotation  rotation 
)

Set rotation of the page.

Parameters
pageThe page to rotate.
rotationThe page rotation.

Implements PdfiumViewer.IPdfDocument.

◆ Save() [1/2]

void PdfiumViewer.PdfDocument.Save ( Stream  stream)

Save the PDF document to the specified location.

Parameters
streamStream to save the PDF document to.

Implements PdfiumViewer.IPdfDocument.

◆ Save() [2/2]

void PdfiumViewer.PdfDocument.Save ( string  path)

Save the PDF document to the specified location.

Parameters
pathPath to save the PDF document to.

Implements PdfiumViewer.IPdfDocument.

◆ Search() [1/3]

PdfMatches PdfiumViewer.PdfDocument.Search ( string  text,
bool  matchCase,
bool  wholeWord 
)

Finds all occurences of text.

Parameters
textThe text to search for.
matchCaseWhether to match case.
wholeWordWhether to match whole words only.
Returns
All matches.

Implements PdfiumViewer.IPdfDocument.

◆ Search() [2/3]

PdfMatches PdfiumViewer.PdfDocument.Search ( string  text,
bool  matchCase,
bool  wholeWord,
int  page 
)

Finds all occurences of text.

Parameters
textThe text to search for.
matchCaseWhether to match case.
wholeWordWhether to match whole words only.
pageThe page to search on.
Returns
All matches.

Implements PdfiumViewer.IPdfDocument.

◆ Search() [3/3]

PdfMatches PdfiumViewer.PdfDocument.Search ( string  text,
bool  matchCase,
bool  wholeWord,
int  startPage,
int  endPage 
)

Finds all occurences of text.

Parameters
textThe text to search for.
matchCaseWhether to match case.
wholeWordWhether to match whole words only.
startPageThe page to start searching.
endPageThe page to end searching.
Returns
All matches.

Implements PdfiumViewer.IPdfDocument.

Property Documentation

◆ Bookmarks

PdfBookmarkCollection PdfiumViewer.PdfDocument.Bookmarks
get

Bookmarks stored in this PdfFile

◆ PageCount

int PdfiumViewer.PdfDocument.PageCount
get

Number of pages in the PDF document.

◆ PageSizes

IList<SizeF> PdfiumViewer.PdfDocument.PageSizes
get

Size of each page in the PDF document.


The documentation for this class was generated from the following file: