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.
parameters.postscript.colorImages.downsamplingDpi parameters.postscript.monoImages.downsamplingDpi parameters.postscript.grayImages.downsamplingDpi paramaters.postscript.compression parameters.postscript.outputType parameters.office.images.downsamplingDpi paramaters.office.compression parameters.office.taggedPdf parameters.office.outputType
Microsoft Office files
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:
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)
|This parameter sets the resolution for downsampling color images in a PostScript input file to 300 DPI:
Microsoft Office files
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:
|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:
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
|This parameter creates a PDF/A output document from an Office file:
|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
|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
Other = 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:
- 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.