FLIP2PDF includes a simple C language API for converting input files into PDF documents for both Windows and Linux platforms.
Note that the structure used by the API header file for FLIP2PDF follows the pattern of the JSON profile file used for the FLIP2PDF command line utility.
The FLIP2PDF API declarations are found in the header file FLIP2PDFAPI.h. Under the FLIP2PDFParameters control structure we offer a series of other control structures for PostScript and Microsoft Office files.
The product does not offer any settings for processing image files being converted into PDF output documents, such as JPG, BMP, or PNG files. The API uses the resolution defined in the input graphic file, and assigns a default compression method, jpeg for JPG files and Flate for all other file types.
When you convert HTML to PDF, the PDF output is not tagged, and the output is a standard PDF file by default. It is not possible to convert HTML content to PDF/A.
Parameter Syntax
parameters.postscript.colorImages.downsamplingDpi parameters.postscript.monoImages.downsamplingDpi parameters.postscript.grayImages.downsamplingDpi parameters.postscript.colorImages.compression parameters.postscript.monoImages.compression parameters.postscript.grayImages.compression parameters.postscript.outputType
parameters.office.images.downsamplingDpi parameters.office.images.compression parameters.office.taggedPdf parameters.office.outputType parameters.office.password parameters.office.encrypt
parameters.html.images.downsamplingDpi parameters.html.images.compression parameters.html.webLayout parameters.html.pageSize parameters.html.pageMargin parameters.html.pageOrientation
Settings
Parameters | Description | Values |
ImageDownsamplingDpi_t | PostScript files Microsoft Office files HTML files and web pages Select a resolution value in Dots per Inch to reduce the resolution of graphics embedded in the input. The options are 75, 150, 300, 600, and 1200 DPI. The default value is set to 300 DPI. Changing the resolution of images in the input file may result in a smaller PDF output document.To disable the feature to downsample images in a file, use this parameter setting: ImageDownsamplingDpi_Disabled = -1 If downsampling is disabled, FLIP2PDF copies any images found in an import file to the PDF output file without reducing the resolution. |
Disabled = -1 300 = 0 (default) 75 150 600 1200 |
This parameter sets the resolution for downsampling color images in a PostScript input file to 300 DPI:parameters.postscript.colorImages.downsamplingDpi = ImageDownsamplingDpi_300; |
||
ImageCompression_t | PostScript files Microsoft Office files HTML and web pages |
JPEG= 0 Flate = 1 |
Select a compression method to use for graphics images in the input file, JPEG or Flate. | ||
This parameter sets the compression method for images in an Office input file to Flate:parameters.office.images.compression = ImageCompression_Flate; |
||
Parameters | Description | Values |
TaggedPDF_t | Microsoft Office files only | |
Set to ON to enable. Defaults to OFF.
This parameter creates a tagged PDF document for an input file. If you enable TaggedPDF, FLIP2PDF creates a tagged PDF document corresponding to the semantic structures found in the Office source file. Titles, headings, lists and other structures in the document are expressed in the output PDF. |
OFF = 0 ON = 1 |
|
This parameter creates a tagged PDF output document from an Office file:parameters.office.taggedPdf = TaggedPDF_ON; |
||
PDFOutputType_t | PostScript files Microsoft Office Files |
|
Select an output type. Defaults to PDF.
PDFA1 (PDF Archive) is only available for Office files. PDFX3 is only available for PostScript files. If you select PDFOutputType_PDFA1, to generate a PDF/A output file, the software will generate a tagged PDF document as the output file. It will ignore the setting for the TaggedPDF parameter |
PDF = 0 PDFA1 PDFX3 |
|
This parameter creates a PDF/A output document from an Office file:parameters.office.outputType = PDFOutputType_PDFA1; |
||
Parameters | Description | Values |
Password_t | Microsoft Office files only
If an input do1cument has a password, you can include this value to provide a password so that FLIP2PDF can read and open that file. |
Password term |
This parameter allows the system to open a password-protected input Office file:parameters.office.password = Password_Fischer@27; |
||
Encrypt_t | Microsoft Office files only
Use this value to assign a password to a PDF output document. |
Password term |
This parameter allows the system to assign a password to a PDF output document based on an Office file:parameters.office.encrypt = Encrypt_Fischer@27; |
||
WebLayout_t | HTML/web sites only
Select a display target for the PDF output document, based on the device used to display the source web page |
desktop tablet mobile |
This parameter allows the system to configure the PDF output document based on the device to use to display that output document, in this example, for a tablet:parameters.html.webLayout = WebLayout_Tablet; |
||
Parameters | Description | Values |
PageSize_t | HTML/web sites only
Use this value to define the paper size to use for the PDF output file. |
letter legal ledger A3 A4 A5 |
This parameter allows the system to set the page size to A4, the European standard:parameters.html.pageSize = PageSize_A4; |
||
PageMargin_t | HTML/web sites only
Use this value to define page margins in the PDF output file. |
Number of inches or millimeters with "in" or "mm" |
This parameter directs the system to set the page margins to 10 millimeters, rather than the default of one inch:parameters.html.pageMargin = PageMargin_10mm; |
||
PageOrientation_t | HTML/web sites only
Use this value to set the page orientation to landscape rather than portrait. |
portrait or landscape |
This parameter allows the system to set the page orientation sideways, to landscape:parameters.html.pageOrientation = PageOrientation_Landscape; |
Functions
Parameters | Description | Values |
FLIP2PDFInitialize() | The API must be initialized before use. The API can only be initialized once for a process. | |
FLIP2PDFInitParameters() | The FLIP2PDFParameters block must be initialized before the block can be used. | |
FLIP2PDFConvert() | Convert the input document into a PDF file | Parameters Path to the input file Path to the PDF file to be generated Path to a URL for a web site |
FLIP2PDFShutdown() | This method shuts down and releases resources. It should be called before the program exits. | |
DetermineFileTypeFormat() | Define the type of input file. | Office binary file (doc, xls, ppt) = 0 Office Open XML (docx, xlsx, pptx) = 1 PostScript = 2 Encapsulated PostScript = 3 Binary Encapsulated PostScript = 4 BMP = 5 JPG = 6 PNG = 7 TIFF = 8 HTML = 9 |
IsFilePathPresent() | Determine if an input file or directory exists so that FLIP2PDF can access the input file and process it. | File path not found = 0
File path exists = 1 |
The FLIP2PDF sample program
We provide the Conversion sample program to demonstrate how to work with the FLIP2PDF API to convert documents to PDF files. You can use this code as a model for creating your own programs, or simply copy and paste this sample code to use as your own.
Note that Microsoft Visual Studio 2017 or later is required to build the FLIP2PDF sample program.
This program calls the Initialize and Shutdown functions once, as an example. Every call to Initialize should be matched with a Shutdown call.
The sample allows you to specify the names of the input files and the output PDF document. You can also change settings in this sample to complete a variety of processing steps when generating a PDF document, such as:
- setting up an Office input file to use Flate compression for embedded graphics images
- downsampling images in an Office input file to 150 DPI
- generating a PDF/X-3 output file from a PostScript input file
Important dependencies for building your own application
The sample projects that are included in the installation package are set up to produce the file structure required by FLIP2PDF to execute correctly. When building your own application for the FLIP2PDF library, the following files and folders must be located at the same level as the application executable:
- PS.VM
- superatm.db
- startupNORM.ps
- flip2pdf_pro.lic or flip2pdf_premium.lic (for subscription-based versions only)
- ICCProfiles directory
- Fonts directory
- Resources directory
The FLIP2PDF library file finds the directory where the application executable is stored and looks for these files and folders in that directory.
If you have installed the Linux version of FLIP2PDF, when you run the makefile to build the Conversion sample program, it copies the required files and folders to Samples/Conversion, as well as the license file. The Windows solution file will place the Conversion executable at the top level install directory where the dependencies can be found.