PDF SDK Documentation

Comprehensive Guide for Developers: Features, Integration, and API Reference

Loading...
Searching...
No Matches
view.h File Reference

Rendering API. More...

#include <pdfsdk/core.h>
#include <pdfsdk/graphics.h>

Go to the source code of this file.

Classes

struct  PDFRenderMonitor
 The render monitor structure. More...
 
struct  PDFRenderCommonParams
 Contains rendering parameters. More...
 
struct  PDFRenderViewParams
 Contains view-specific parameters, such as zoom level, orientation and annotation settings. More...
 

Typedefs

typedef PDErrCode(PDFSDK_CALLCONV * PDFRenderCancelProc) (void *clientData, bool *pCancelled)
 A user-defined callback function used in the event of a cancellation in the rendering.
 
typedef PDErrCode(PDFSDK_CALLCONV * PDFRenderUpdateProc) (void *clientData)
 A user-defined callback function used in the event of an update in the rendering.
 
typedef uint32_t PDFRenderFlags
 
typedef struct PDFRenderContextRec_ * PDFRenderContext
 

Enumerations

enum  { kPDFRenderPrint = 1 << 0 , kPDFRenderNoContent = 1 << 1 , kPDFRenderNoAnnots = 1 << 2 , kPDFRenderNoMarkupAnnots = 1 << 3 }
 Defines the settings or options that control how the content of a PDF is rendered or displayed. More...
 

Functions

PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFCreateRenderContext (PDFRenderContext *pcontext)
 Initializes a new render context for rendering PDF content.
 
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFRenderContextPurgeCaches (PDFRenderContext context)
 Releases a render context for rendering PDF content.
 
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFDrawPage (PDPage page, GXRenderTarget target, const PDFRenderCommonParams *commonParams, const PDFRenderViewParams *viewParams)
 Renders a PDF page to a specified render target.
 
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFDrawFormXObject (PDEXObject xobject, GXRenderTarget target, const PDFRenderCommonParams *params, const PDMatrix *pageMatrix)
 Paints a Form XObject and renders it to a specified render target.
 
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFDrawContent (PDEContent content, GXRenderTarget target, const PDFRenderCommonParams *params, const PDMatrix *pageMatrix)
 Renders PDF content to a specified render target.
 
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFDrawAnnot (PDAnnot annot, PDAnnotState state, GXRenderTarget target, const PDFRenderCommonParams *commonParams, const PDFRenderViewParams *viewParams, PDRotate pageRotate, const PDMatrix *pageMatrix)
 Renders a single annotation on a PDF page to the specified render target.
 
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFPathToGeometry (PDEElement path, GXGeometry *pgeom)
 Converts a PDF path element into a geometric representation.
 
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFPathToPaintGeometry (PDEElement path, GXGeometry *pgeom)
 Converts a PDF path element into a geometric representation suitable for painting operations.
 
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFTextToGeometry (PDEElement text, GXGeometry *pgeom)
 Converts a PDF text element into a geometric representation.
 
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFInlineImageToBitmap (PDEElement image, PDFRenderContext cache, GXBitmap *pbitmap)
 Converts an inline image within a PDF document into a bitmap image.
 
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFXObjectImageToBitmap (PDEXObject xobject, PDERenderingIntent intent, PDFRenderContext cache, GXBitmap *pbitmap)
 Converts an XObject image within a PDF document into a bitmap image.
 
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFBitmapToXObjectImage (PDDoc doc, GXBitmap bitmap, PDAtom compression, PDEXObject *pxobject)
 Converts a bitmap within a PDF document into a XObject image.
 
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFCreateFontFromFontFace (PDDoc doc, GXFontFace fontface, PDEFont *pfont)
 Creates a new PDF font object from a font face.
 
PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFFontGetRenderFontFace (PDEFont font, GXFontFace *pFontface)
 Retrieves the font face object used for rendering from a PDF font object.
 

Detailed Description

Rendering API.

Typedef Documentation

◆ PDFRenderCancelProc

typedef PDErrCode(PDFSDK_CALLCONV * PDFRenderCancelProc) (void *clientData, bool *pCancelled)

A user-defined callback function used in the event of a cancellation in the rendering.

See also
PDFRenderMonitor.

◆ PDFRenderUpdateProc

typedef PDErrCode(PDFSDK_CALLCONV * PDFRenderUpdateProc) (void *clientData)

A user-defined callback function used in the event of an update in the rendering.

See also
PDFRenderMonitor.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Defines the settings or options that control how the content of a PDF is rendered or displayed.

This enumeration specifies the appearance and behavior of the PDF when it is viewed or printed.

Enumerator
kPDFRenderPrint 

Ensures that the PDF is rendered in a way that is optimized for printing.

kPDFRenderNoContent 

Indicates that no content should be rendered or displayed.

kPDFRenderNoAnnots 

Prevents the rendering of annotations such as comments, highlights, and sticky notes.

kPDFRenderNoMarkupAnnots 

Specifically excludes markup annotations like text highlights, underlines, and strikethroughs.

Function Documentation

◆ PDFBitmapToXObjectImage()

PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFBitmapToXObjectImage ( PDDoc doc,
GXBitmap bitmap,
PDAtom compression,
PDEXObject * pxobject )

Converts a bitmap within a PDF document into a XObject image.

Parameters
[in]docThe PDF document into which the XObject image will be embedded.
[in]bitmapThe bitmap image to be converted into a PDF XObject image.
[in]compressionSpecifies the compression method to be used on the bitmap image.
[out]pxobjectA pointer to the newly created XObject image object.
Returns
An error code of type PDErrCode indicating error status.
See also
PDErrCodes kPDErrSuccess for success.

For more information refer to section 8.10 Form XObjects from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.

◆ PDFCreateFontFromFontFace()

PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFCreateFontFromFontFace ( PDDoc doc,
GXFontFace fontface,
PDEFont * pfont )

Creates a new PDF font object from a font face.

Parameters
[in]docThe PDF document into which the font object will be embedded.
[in]fontfaceThe font face object from which the font object will be created.
[out]pfontA pointer to the newly created PDF font object.
Returns
An error code of type PDErrCode indicating error status.
See also
PDErrCodes

◆ PDFCreateRenderContext()

PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFCreateRenderContext ( PDFRenderContext * pcontext)

Initializes a new render context for rendering PDF content.

This function initializes a new render context for rendering operations, environment and settings used to convert the content of a PDF document into a displayable format, such as images or text that can be viewed on a screen. The context will store necessary information such as graphical state and transformations.

Parameters
[out]pcontextA pointer to a PDFRenderContext structure that will be initialized. Ensure that the structure is allocated before calling this function.
Returns
An error code of type PDErrCode indicating error status.
See also
PDErrCodes kPDErrSuccess for success.

◆ PDFDrawAnnot()

PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFDrawAnnot ( PDAnnot annot,
PDAnnotState state,
GXRenderTarget target,
const PDFRenderCommonParams * commonParams,
const PDFRenderViewParams * viewParams,
PDRotate pageRotate,
const PDMatrix * pageMatrix )

Renders a single annotation on a PDF page to the specified render target.

This function renders annotations within a PDF document, providing visual feedback and interactivity to users.

Parameters
[in]annotThe annotation object to be rendered.
[in]stateDefines the visual appearance of an annotation - normal, hovered over, clicked on.
[in]targetWhere the content will be rendered. This could be a bitmap, a display, or any other medium.
[in]commonParamsA pointer to a structure containing common rendering parameters.
[in]viewParamsA pointer to a structure containing view-specific parameters, such as zoom level, orientation and annotation settings.
[in]pageRotateThe rotation angle of the page (0, 90, 180, 270 Deg).
[in]pageMatrixA pointer to the current transformation matrix which controls the position, size and orientation of the annotation in user space.
Returns
An error code of type PDErrCode indicating error status.
See also
PDErrCodes kPDErrSuccess for success.

◆ PDFDrawContent()

PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFDrawContent ( PDEContent content,
GXRenderTarget target,
const PDFRenderCommonParams * params,
const PDMatrix * pageMatrix )

Renders PDF content to a specified render target.

This function is essential for displaying or processing visual content.

Parameters
[in]contentThe object representing the content of the PDF to be rendered. This includes text, images, graphics and other elements.
[in]targetWhere the content will be rendered. This could be a bitmap, a display, or any other medium.
[in]paramsA pointer to a structure containing common rendering parameters.
[in]pageMatrixA pointer to he current transformation matrix which controls the position, size and orientation of the content in user space.
Returns
An error code of type PDErrCode indicating error status.
See also
PDErrCodes kPDErrSuccess for success.

◆ PDFDrawFormXObject()

PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFDrawFormXObject ( PDEXObject xobject,
GXRenderTarget target,
const PDFRenderCommonParams * params,
const PDMatrix * pageMatrix )

Paints a Form XObject and renders it to a specified render target.

This function draws a reusable graphic or image.

For more information refer to section 8.10 Form XObjects from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.

Parameters
[in]xobjectThe object representing the Form XObject.
[in]targetWhere the page will be rendered. This could be a bitmap, a display, or any other medium.
[in]paramsA pointer to a structure containing common rendering parameters.
[in]pageMatrixA pointer to the current transformation matrix which controls the position, size and orientation of the form XObject in user space.
Returns
An error code of type PDErrCode indicating error status.
See also
PDErrCodes kPDErrSuccess for success.

◆ PDFDrawPage()

PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFDrawPage ( PDPage page,
GXRenderTarget target,
const PDFRenderCommonParams * commonParams,
const PDFRenderViewParams * viewParams )

Renders a PDF page to a specified render target.

This function renders PDF content to an output device or medium.

Parameters
[in]pageThe object representing the PDF page to be rendered.
[in]targetWhere the page will be rendered. This could be a bitmap, a display, or any other medium.
[in]commonParamsA pointer to a structure containing common rendering parameters.
[in]viewParamsA pointer to a structure containing view-specific parameters, such as zoom level, orientation and annotation settings.
Returns
An error code of type PDErrCode indicating error status.
See also
PDErrCodes kPDErrSuccess for success.

◆ PDFFontGetRenderFontFace()

PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFFontGetRenderFontFace ( PDEFont font,
GXFontFace * pFontface )

Retrieves the font face object used for rendering from a PDF font object.

Parameters
[in]fontThe PDF font object from which the font face object will be retrieved.
[out]pFontfaceA pointer to the font face object.
Returns
An error code of type PDErrCode indicating error status.
See also
PDErrCodes

◆ PDFInlineImageToBitmap()

PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFInlineImageToBitmap ( PDEElement image,
PDFRenderContext cache,
GXBitmap * pbitmap )

Converts an inline image within a PDF document into a bitmap image.

This function is used for rendering or extracting the image data for further processing, because the inline format gives the PDF processor less flexibility in managing the image data.

Parameters
[in]imageThe inline image element within the PDF document to be converted.
[in]cacheThe rendering context used for caching and rendering operations. This context helps manage resources and optimize rendering performance.
[out]pbitmapA pointer to a structure where the converted bitmap image will be stored.
Returns
An error code of type PDErrCode indicating error status.
See also
PDErrCodes kPDErrSuccess for success.

For more information refer to section 8.9.7 Inline images from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.

◆ PDFPathToGeometry()

PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFPathToGeometry ( PDEElement path,
GXGeometry * pgeom )

Converts a PDF path element into a geometric representation.

Parameters
[in]pathThe element that includes the path data, such as lines, curves, and shapes within the PDF document.
[out]pgeomA pointer to the structure where the geometric representation of the path will be stored.
Returns
An error code of type PDErrCode indicating error status.
See also
PDErrCodes kPDErrSuccess for success.

◆ PDFPathToPaintGeometry()

PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFPathToPaintGeometry ( PDEElement path,
GXGeometry * pgeom )

Converts a PDF path element into a geometric representation suitable for painting operations.

Parameters
[in]pathThe element that includes the path data, such as lines, curves, and shapes within the PDF document.
[out]pgeomA pointer to the structure where the geometric representation of the path to be painted will be stored.
Returns
An error code of type PDErrCode indicating error status.
See also
PDErrCodes kPDErrSuccess for success.

For more information refer to section 8.5.3 Path-painting operators from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.

◆ PDFRenderContextPurgeCaches()

PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFRenderContextPurgeCaches ( PDFRenderContext context)

Releases a render context for rendering PDF content.

This function cleans the context cache.

Parameters
[in]contextThe context of type PDFRenderContext that will be destroyed.
Returns
An error code of type PDErrCode indicating error status.
See also
PDErrCodes kPDErrSuccess for success.

◆ PDFTextToGeometry()

PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFTextToGeometry ( PDEElement text,
GXGeometry * pgeom )

Converts a PDF text element into a geometric representation.

Parameters
[in]textThe text element to be converted. It includes its position, font, size, and other attributes.
[out]pgeomA pointer to the structure where the geometric representation of the text will be stored.
Returns
An error code of type PDErrCode indicating error status.
See also
PDErrCodes kPDErrSuccess for success.

◆ PDFXObjectImageToBitmap()

PDF_CORE_API PDErrCode PDFSDK_CALLCONV PDFXObjectImageToBitmap ( PDEXObject xobject,
PDERenderingIntent intent,
PDFRenderContext cache,
GXBitmap * pbitmap )

Converts an XObject image within a PDF document into a bitmap image.

Parameters
[in]xobjectThe XObject image element within the PDF document to be converted.
[in]intentThe rendering intent used for the conversion process. This can affect how the image is processed and rendered in terms of color representation.
[in]cacheThe rendering context used for caching and rendering operations. This context helps manage resources and optimize rendering performance.
[out]pbitmapA pointer to a structure where the converted bitmap image will be stored.
Returns
An error code of type PDErrCode indicating error status.
See also
PDErrCodes kPDErrSuccess for success.

For more information refer to sections 8.9.5 Image dictionaries and 8.10 Form XObjects from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.