Foxit PDF SDK
FSDK.VectorGraphics Class Reference

Class for inserting vector graphics (SVG, WMF/EMF) into PDF files. More...

Static Public Member Functions

static Initialize (library_path)
 Initialize the vector graphics module by loading the fxvectorgraphics shared library. More...
 
static InsertSVGToPage (pdf_path, svg_path, out_pdf_path, page_index, x, y, width, height, dpi)
 Insert an SVG file into a rectangular area on an existing PDF page. More...
 
static InsertSVGToPDF (pdf_path, svg_path, out_pdf_path, page_index, page_width_pt, page_height_pt, dpi)
 Insert an SVG file as a new page into a PDF document. More...
 
static InsertWMFToPage (pdf_path, wmf_path, out_pdf_path, page_index, x, y, width, height, dpi)
 Insert a WMF/EMF file into a rectangular area on an existing PDF page. More...
 
static InsertWMFToPDF (pdf_path, wmf_path, out_pdf_path, page_index, page_width_pt, page_height_pt, dpi)
 Insert a WMF/EMF file as a new page into a PDF document. More...
 
static Release ()
 Release all resources allocated by the vector graphics module. More...
 

Detailed Description

Class for inserting vector graphics (SVG, WMF/EMF) into PDF files.

This class provides methods for inserting SVG vector graphics and WMF/EMF metafiles into PDF document. The target PDF is opened, modified, and saved entirely within the fxvectorgraphics shared library, so the caller never needs to open the document with Foxit PDF SDK itself. The output file preserves the structural characteristics of the input PDF (linearization, cross-reference stream, etc.) automatically.

Before calling any other method in this class, call FSDK.VectorGraphics.Initialize to load the fxvectorgraphics shared library. Call FSDK.VectorGraphics.Release when the module is no longer needed.

Currently, this feature is not supported on the Linux x86/ARM and Mac ARM platform.

Member Function Documentation

◆ Initialize()

static FSDK.VectorGraphics.Initialize (   library_path)
inlinestatic

Initialize the vector graphics module by loading the fxvectorgraphics shared library.

During the life-cycle of the "vector graphics" module, this function should be called once before any other function in this class. The library remains loaded until FSDK.VectorGraphics.Release is called.

Parameters
[in]library_pathFull path to the fxvectorgraphics shared library file. This should not be an empty string.
Returns
None.
Note
If module "Conversion" is not defined in the license information which is used in function FSDK.Library.Initialize, that means user has no right in using vector graphics related functions and this function will throw exception FSDK.e_ErrNoConversionModuleRight.

◆ InsertSVGToPage()

static FSDK.VectorGraphics.InsertSVGToPage (   pdf_path,
  svg_path,
  out_pdf_path,
  page_index,
  x,
  y,
  width,
  height,
  dpi 
)
inlinestatic

Insert an SVG file into a rectangular area on an existing PDF page.

The SVG graphic is rendered into the specified rectangle on the given page of the source PDF. The result is written to out_pdf_path. The structural characteristics of the source PDF (linearization, XRef stream, etc.) are preserved automatically.

Parameters
[in]pdf_pathPath of the source PDF file. This should not be an empty string.
[in]svg_pathPath of the SVG file. This should not be an empty string.
[in]out_pdf_pathPath of the output PDF file. This should not be an empty string.
[in]page_indexZero-based index of the page to insert the SVG into. Valid range: from 0 to (page_count-1).
[in]xX coordinate of the left edge of the target rectangle, in points.
[in]yY coordinate of the bottom edge of the target rectangle, in points.
[in]widthWidth of the target rectangle, in points. Must be greater than 0.
[in]heightHeight of the target rectangle, in points. Must be greater than 0.
[in]dpiRendering resolution in dots per inch. Must be greater than 0.
Returns
None.

◆ InsertSVGToPDF()

static FSDK.VectorGraphics.InsertSVGToPDF (   pdf_path,
  svg_path,
  out_pdf_path,
  page_index,
  page_width_pt,
  page_height_pt,
  dpi 
)
inlinestatic

Insert an SVG file as a new page into a PDF document.

A new page of the specified size is inserted at page_index and the SVG graphic is rendered onto it. The result is written to out_pdf_path.

Parameters
[in]pdf_pathPath of the source PDF file. If this is an empty string or the specified file does not exist, a new PDF document will be created using out_pdf_path.
[in]svg_pathPath of the SVG file. This should not be an empty string.
[in]out_pdf_pathPath of the output PDF file. This should not be an empty string.
[in]page_indexZero-based index at which the new page is inserted. If less than 0, inserted at the beginning; if >= page_count, appended.
[in]page_width_ptWidth of the new page, in points. Must be greater than 0.
[in]page_height_ptHeight of the new page, in points. Must be greater than 0.
[in]dpiRendering resolution in dots per inch. Must be greater than 0.
Returns
None.

◆ InsertWMFToPage()

static FSDK.VectorGraphics.InsertWMFToPage (   pdf_path,
  wmf_path,
  out_pdf_path,
  page_index,
  x,
  y,
  width,
  height,
  dpi 
)
inlinestatic

Insert a WMF/EMF file into a rectangular area on an existing PDF page.

The WMF/EMF graphic is rendered into the specified rectangle on the given page of the source PDF. The result is written to out_pdf_path. The structural characteristics of the source PDF are preserved automatically.

Parameters
[in]pdf_pathPath of the source PDF file. This should not be an empty string.
[in]wmf_pathPath of the WMF/EMF file. This should not be an empty string.
[in]out_pdf_pathPath of the output PDF file. This should not be an empty string.
[in]page_indexZero-based index of the page to insert the WMF/EMF into. Valid range: from 0 to (page_count-1).
[in]xX coordinate of the left edge of the target rectangle, in points.
[in]yY coordinate of the bottom edge of the target rectangle, in points.
[in]widthWidth of the target rectangle, in points. Must be greater than 0.
[in]heightHeight of the target rectangle, in points. Must be greater than 0.
[in]dpiRendering resolution in dots per inch. Must be greater than 0.
Returns
None.

◆ InsertWMFToPDF()

static FSDK.VectorGraphics.InsertWMFToPDF (   pdf_path,
  wmf_path,
  out_pdf_path,
  page_index,
  page_width_pt,
  page_height_pt,
  dpi 
)
inlinestatic

Insert a WMF/EMF file as a new page into a PDF document.

A new page of the specified size is inserted at page_index and the WMF/EMF graphic is rendered onto it. The result is written to out_pdf_path.

Parameters
[in]pdf_pathPath of the source PDF file. If this is an empty string or the specified file does not exist, a new PDF document will be created using out_pdf_path.
[in]wmf_pathPath of the WMF/EMF file. This should not be an empty string.
[in]out_pdf_pathPath of the output PDF file. This should not be an empty string.
[in]page_indexZero-based index at which the new page is inserted. If less than 0, inserted at the beginning; if >= page_count, appended.
[in]page_width_ptWidth of the new page, in points. Must be greater than 0.
[in]page_height_ptHeight of the new page, in points. Must be greater than 0.
[in]dpiRendering resolution in dots per inch. Must be greater than 0.
Returns
None.

◆ Release()

static FSDK.VectorGraphics.Release ( )
inlinestatic

Release all resources allocated by the vector graphics module.

When the user no longer needs the "vector graphics" module, this function should be called to unload the shared library and release all associated resources.

Returns
None.