Class PdfRenderer
Represents the root element of the PDF viewer in Syncfusion.PdfViewer.Portable library.
Inheritance
Implements
Namespace: Syncfusion.EJ2.PdfViewer
Assembly: Syncfusion.EJ2.PdfViewer.dll
Syntax
public class PdfRenderer : Object, IDisposable
Constructors
PdfRenderer()
Initializes a new instance of Syncfusion.EJ2.PdfViewer class.
Declaration
public PdfRenderer()
PdfRenderer(IDistributedCache)
Declaration
public PdfRenderer(IDistributedCache cache)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.Caching.Distributed.IDistributedCache | cache |
PdfRenderer(IDistributedCache, Int32)
Declaration
public PdfRenderer(IDistributedCache cache, int slidingTime)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.Caching.Distributed.IDistributedCache | cache | |
System.Int32 | slidingTime |
PdfRenderer(IMemoryCache)
Initializes a new instance of Syncfusion.EJ2.PdfViewer class with Cache object for rendering PDF document in PDF Viewer.
Declaration
public PdfRenderer(IMemoryCache cache)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.Caching.Memory.IMemoryCache | cache |
PdfRenderer(IMemoryCache, IDistributedCache)
Declaration
public PdfRenderer(IMemoryCache memoryCache, IDistributedCache distributedCache)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.Caching.Memory.IMemoryCache | memoryCache | |
Microsoft.Extensions.Caching.Distributed.IDistributedCache | distributedCache |
PdfRenderer(IMemoryCache, IDistributedCache, Int32)
Declaration
public PdfRenderer(IMemoryCache memoryCache, IDistributedCache distributedCache, int slidingTime)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.Caching.Memory.IMemoryCache | memoryCache | |
Microsoft.Extensions.Caching.Distributed.IDistributedCache | distributedCache | |
System.Int32 | slidingTime |
PdfRenderer(IMemoryCache, Int32)
Declaration
public PdfRenderer(IMemoryCache cache, int slidingTime)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.Caching.Memory.IMemoryCache | cache | |
System.Int32 | slidingTime |
Properties
CacheManager
Set the cache object for storing and retrieving PDF document data in the cache.
Declaration
public ICacheManager CacheManager { get; set; }
Property Value
Type |
---|
ICacheManager |
FallbackFontCollection
It is used to import the custom fonts into PDF Viewer.
Declaration
public Dictionary<string, Stream> FallbackFontCollection { get; set; }
Property Value
Type |
---|
System.Collections.Generic.Dictionary<System.String, System.IO.Stream> |
PageCount
Gets the page count of the PDF document
Declaration
public int PageCount { get; }
Property Value
Type |
---|
System.Int32 |
ReferencePath
Specifics the pdfium reference path to the PDF Viewer.
Declaration
public static string ReferencePath { get; set; }
Property Value
Type |
---|
System.String |
ScaleFactor
Scales the page while rendering in the PDF Viewer control for improving the quality of the image. Positive float values can be set. Recommended Value is 1 or 1.5f. If the value is greater than the recommended value, there might be any distortion in the performance of the PDF Viewer.
Declaration
public float ScaleFactor { get; set; }
Property Value
Type |
---|
System.Single |
Methods
ClearCache(Dictionary<String, String>)
Clear the Cache objects while closing the PdfViewer.
Declaration
public void ClearCache(Dictionary<string, string> jsonObject)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | jsonObject |
Dispose()
Dispose the PDF document resources while closing the PdfViewer.
Declaration
public void Dispose()
Dispose(Boolean)
Dispose the PDF document resources while closing the PdfViewer.
Declaration
public void Dispose(bool isClearCurrentDocument)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isClearCurrentDocument | If true clears current PDF stream |
ExportAnnotation(Dictionary<String, String>)
Gets the XFdf annotation as base64 string
Declaration
public string ExportAnnotation(Dictionary<string, string> jsonObject)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | jsonObject | Current object from the client |
Returns
Type | Description |
---|---|
System.String | Returns the XFdf annotation as base64 string. |
ExportAsImage(Int32)
Exports the specified page as Image
Declaration
public SKBitmap ExportAsImage(int pageIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | The page index to be converted into image |
Returns
Type | Description |
---|---|
SkiaSharp.SKBitmap | Returns the specified page as Image |
ExportAsImage(Int32, SizeF, Boolean)
Exports the specified page as Image
Declaration
public SKBitmap ExportAsImage(int pageIndex, SizeF customSize, bool keepAspectRatio)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | The page index to be converted into image |
Syncfusion.Drawing.SizeF | customSize | The custom size of the converted image |
System.Boolean | keepAspectRatio | Whether need to keep the aspect ratio of the page |
Returns
Type | Description |
---|---|
SkiaSharp.SKBitmap | Returns the image with custom size |
ExportAsImage(Int32, SizeF, Boolean, Boolean)
Exports the specified page as Image
Declaration
public SKBitmap ExportAsImage(int pageIndex, SizeF customSize, bool keepAspectRatio, bool isSkipAnnotations)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | The page index to be converted into image |
Syncfusion.Drawing.SizeF | customSize | The custom size of the converted image |
System.Boolean | keepAspectRatio | Whether need to keep the aspect ratio of the page |
System.Boolean | isSkipAnnotations | Whether need to keep the annotation of the page |
Returns
Type | Description |
---|---|
SkiaSharp.SKBitmap | Returns the image with custom size |
ExportAsImage(Int32, Boolean)
Exports the specified page as Image
Declaration
public SKBitmap ExportAsImage(int pageIndex, bool isSkipAnnotations)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | The page index to be converted into image |
System.Boolean | isSkipAnnotations | Whether need to keep the annotation of the page |
Returns
Type | Description |
---|---|
SkiaSharp.SKBitmap | Returns the specified page as Image |
ExportAsImage(Int32, Int32)
Exports the specified pages as Images
Declaration
public SKBitmap[] ExportAsImage(int startIndex, int endIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | startIndex | The starting page index |
System.Int32 | endIndex | The ending page index |
Returns
Type | Description |
---|---|
SkiaSharp.SKBitmap[] | Returns the specified pages as Images |
ExportAsImage(Int32, Int32, SizeF, Boolean)
Exports the specified pages as Images
Declaration
public SKBitmap[] ExportAsImage(int startIndex, int endIndex, SizeF customSize, bool keepAspectRatio)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | startIndex | The starting page index |
System.Int32 | endIndex | The ending page index |
Syncfusion.Drawing.SizeF | customSize | The custom size of the converted image |
System.Boolean | keepAspectRatio | Whether need to maintain the pdf page size |
Returns
Type | Description |
---|---|
SkiaSharp.SKBitmap[] | Returns the specified pages as images with custom size |
ExportAsImage(Int32, Int32, SizeF, Boolean, Boolean)
Exports the specified pages as Images
Declaration
public SKBitmap[] ExportAsImage(int startIndex, int endIndex, SizeF customSize, bool keepAspectRatio, bool isSkipAnnotations)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | startIndex | The starting page index |
System.Int32 | endIndex | The ending page index |
Syncfusion.Drawing.SizeF | customSize | The custom size of the converted image |
System.Boolean | keepAspectRatio | Whether need to maintain the pdf page size |
System.Boolean | isSkipAnnotations | Whether need to keep the annotation of the page |
Returns
Type | Description |
---|---|
SkiaSharp.SKBitmap[] | Returns the specified pages as images with custom size |
ExportAsImage(Int32, Int32, Boolean)
Exports the specified pages as Images
Declaration
public SKBitmap[] ExportAsImage(int startIndex, int endIndex, bool isSkipAnnotations)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | startIndex | The starting page index |
System.Int32 | endIndex | The ending page index |
System.Boolean | isSkipAnnotations | Whether need to keep the annotation of the page |
Returns
Type | Description |
---|---|
SkiaSharp.SKBitmap[] | Returns the specified pages as Images |
ExportAsImage(Int32, Single, Int32, Int32, Int32, Int32)
Exports the specified page as tile Image
Declaration
public SKBitmap ExportAsImage(int pageIndex, float zoomFactor, int tileXCount, int tileYCount, int tileX, int tileY)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | Specifies the page Number |
System.Single | zoomFactor | Specifies the zoom Factor |
System.Int32 | tileXCount | Specifies the tiles x dimension of page |
System.Int32 | tileYCount | Specifies the tiles y dimension of page |
System.Int32 | tileX | Specifies the x co-orindate of the tiles matrix of page |
System.Int32 | tileY | Specifies the y co-orindate of the tiles matrix of page |
Returns
Type | Description |
---|---|
SkiaSharp.SKBitmap | Returns the specified page as Image |
ExportFormFields(Dictionary<String, String>)
Export the form fields value from the PDF documents
Declaration
public string ExportFormFields(Dictionary<string, string> jsonObject)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | jsonObject | Current object from the client |
Returns
Type | Description |
---|---|
System.String | Returns the form fields value as JSON base64 string. |
ExtractText(Int32, out List<TextData>)
Extracts text along with its format.
Declaration
public string ExtractText(int pageIndex, out List<TextData> textDataCollection)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | |
System.Collections.Generic.List<TextData> | textDataCollection |
Returns
Type | Description |
---|---|
System.String | Returns the extracted text for the provided page |
ExtractText(Int32, out List<TextData>, Boolean)
Extracts text along with its format.
Declaration
public string ExtractText(int pageIndex, out List<TextData> textDataCollection, bool isLayout)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | |
System.Collections.Generic.List<TextData> | textDataCollection | |
System.Boolean | isLayout |
Returns
Type | Description |
---|---|
System.String | Returns the extracted text for the provided page |
ExtractTextWithPageSize(Int32, out Dictionary<Int32, PageTextData>)
extracts text along with its format.
Declaration
public string ExtractTextWithPageSize(int pageIndex, out Dictionary<int, PageTextData> pageTextDataCollection)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | |
System.Collections.Generic.Dictionary<System.Int32, PageTextData> | pageTextDataCollection |
Returns
Type | Description |
---|---|
System.String | Returns the extracted text for the provided page |
GetAnnotationComments(Dictionary<String, String>)
Gets the annotation comments of the document
Declaration
public object GetAnnotationComments(Dictionary<string, string> jsonObject)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | jsonObject | Current object from the client |
Returns
Type | Description |
---|---|
System.Object | Returns the annotations comments as Json object |
GetBookmarks(Dictionary<String, String>)
Gets the Bookmark Details
Declaration
public object GetBookmarks(Dictionary<string, string> jsonObject)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | jsonObject | Current object from the client |
Returns
Type | Description |
---|---|
System.Object | Returns the Bookmark Details |
GetDocumentAsBase64(Dictionary<String, String>)
Gets the PDF document as base64 string
Declaration
public string GetDocumentAsBase64(Dictionary<string, string> jsonObject)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | jsonObject | Current object from the client |
Returns
Type | Description |
---|---|
System.String | Returns the PDF document as base64 string. |
GetDocumentText(Dictionary<String, String>)
Gets the PDF document text details
Declaration
public object GetDocumentText(Dictionary<string, string> jsonObject)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | jsonObject | Current object from the client |
Returns
Type | Description |
---|---|
System.Object | Returns PDF document text details |
GetPage(Dictionary<String, String>)
Gets the specified page as Image
Declaration
public object GetPage(Dictionary<string, string> jsonObject)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | jsonObject | Current object from the client |
Returns
Type | Description |
---|---|
System.Object | Returns the specified page as Json object |
GetPageDetails(Int32, Single)
Gets the specified page details
Declaration
public object GetPageDetails(int pageNumber, float zoomFactor)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageNumber | Specifies the page Number |
System.Single | zoomFactor | Specifies the zoom Factor |
Returns
Type | Description |
---|---|
System.Object | Returns the specified page details as object |
GetPageDetails(Int32, Single, Int32, Int32, Int32, Int32)
Gets the specified page details
Declaration
public object GetPageDetails(int pageNumber, float zoomFactor, int tileXCount, int tileYCount, int tileX, int tileY)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageNumber | Specifies the page Number |
System.Single | zoomFactor | Specifies the zoom Factor |
System.Int32 | tileXCount | Specifies the tiles x dimension of page |
System.Int32 | tileYCount | Specifies the tiles y dimension of page |
System.Int32 | tileX | Specifies the x co-orindate of the tiles matrix of page |
System.Int32 | tileY | Specifies the y co-orindate of the tiles matrix of page |
Returns
Type | Description |
---|---|
System.Object | Returns the specified page details as object |
GetPrintImage(Dictionary<String, String>)
Gets the page as Image
Declaration
public object GetPrintImage(Dictionary<string, string> jsonObject)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | jsonObject | Current object from the client |
Returns
Type | Description |
---|---|
System.Object | Returns the page as base64 String |
GetTaggedElements(Dictionary<String, String>)
Returns a list of tagged elements in a PDF document for the given page index, which is zero-based.
Declaration
public List<object> GetTaggedElements(Dictionary<string, string> jsonObject)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | jsonObject | Current object from the client |
Returns
Type |
---|
System.Collections.Generic.List<System.Object> |
GetThumbnailImages(Dictionary<String, String>)
Gets the thumbnail images of the document.
Declaration
public object GetThumbnailImages(Dictionary<string, string> jsonObject)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | jsonObject | Current object from the client |
Returns
Type |
---|
System.Object |
ImportAnnotation(Dictionary<String, String>)
Gets the annotation from the document
Declaration
public object ImportAnnotation(Dictionary<string, string> jsonObject)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | jsonObject | Current object from the client |
Returns
Type | Description |
---|---|
System.Object | Returns the annotations collections as Json object |
ImportFormFields(Dictionary<String, String>)
Import the form fields value to the PDF documents
Declaration
public object ImportFormFields(Dictionary<string, string> jsonObject)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | jsonObject | Form fields value from the client |
Returns
Type | Description |
---|---|
System.Object | Returns the form fields value as JSON string. |
Load(Byte[])
Loads the PDF document from the specified byte Array.
Declaration
public object Load(byte[] byteArray)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | byteArray | The byte Array that contains the data of the PDF document |
Returns
Type |
---|
System.Object |
Load(Byte[], String)
Loads the encrypted PDF document from the specified byte Array.
Declaration
public object Load(byte[] byteArray, string password)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | byteArray | The byte Array that contains the data of the PDF document |
System.String | password | password for the PDF document |
Returns
Type |
---|
System.Object |
Load(Stream)
Loads the PDF document from the specified stream.
Declaration
public object Load(Stream fileStream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | fileStream | The stream that contains the data of the PDF document |
Returns
Type |
---|
System.Object |
Load(Stream, Dictionary<String, String>)
Loads the PDF document from the specified stream.
Declaration
public object Load(Stream fileStream, Dictionary<string, string> jsonObject)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | fileStream | The stream that contains the data of the PDF document |
System.Collections.Generic.Dictionary<System.String, System.String> | jsonObject | Current object from the client |
Returns
Type |
---|
System.Object |
Load(Stream, String)
Loads the encrypted PDF document from the specified stream.
Declaration
public object Load(Stream fileStream, string password)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | fileStream | The stream that contains the data of the PDF document |
System.String | password | password for the PDF document |
Returns
Type |
---|
System.Object |
Load(String)
Loads a PDF document with the specified filepath
Declaration
public object Load(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The path for the Pdf document. |
Returns
Type |
---|
System.Object |
Load(String, Dictionary<String, String>)
Loads a PDF document with the specified filepath
Declaration
public object Load(string filePath, Dictionary<string, string> jsonObject)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The path for the Pdf document. |
System.Collections.Generic.Dictionary<System.String, System.String> | jsonObject | Current object from the client |
Returns
Type |
---|
System.Object |
Load(String, String)
Loads the encrypted PDF document with the specified filepath
Declaration
public object Load(string filePath, string password)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The path for the Pdf document. |
System.String | password | Password for the pdf document. |
Returns
Type |
---|
System.Object |
LoadLibrary(String)
Loads external library
Declaration
public void LoadLibrary(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | library path |