OCREngineInitialize
ASBool OCREngineInitialize(void)Initializes the OCREngine Plug-in.
Parameters
: void
Returns
An ASBool value.
33 items
ASBool OCREngineInitialize(void)Initializes the OCREngine Plug-in.
: voidAn ASBool value.
: voidvoidvoid.
OCREngine PDOCRCreateEngine(OCRParams params)Create an opaque OCREngine from the supplied parameters.
params: OCRParamsIN OCRParams object used to configure the engine.
An OCREngine that must be released with PDOCRReleaseEngine.
PDEForm PDOCRCreateForm(OCREngine engine, PDDoc doc, PDEImage image, ASInt32 resolution, OCRMissingFontStrategy strategy)Recognizes Text in a PDEImage, at a specified resolution, creating a PDEForm with the Image and Text underneath it. Knowing the image's resolution can enhance recognition. NOTE: Determining the resolution of the image is the caller's responsibility. Creates a PDEForm element containing the image, and additional text underneath. The PDEForm element has a transformation matrix which makes it directly substitutable for the image in a Content stream. The PDEForm will be created in the specified document, sharing fonts with the results of recognizing text in other images. If a font that will represent all the characters in a word can't be found, the missingFontStrategy will determine the behavior to employ.
engine: OCREngineIN OCREngine object
doc: PDDocIN PDDoc object
image: PDEImageresolution: ASInt32IN image resolution for PDEImage object, in DPI
strategy: OCRMissingFontStrategyIN specifies the behavior to take if a Font isn't available to represent the Text
a PDEForm composing the supplied image with the recognized text underneath
OCRParams PDOCRDefaultParams(void)Return a reference to a set of OCRParams, already configured with defaults.
: voidA fresh copy of the OCRParams.
Get the Languages installed as an array of OCRLanguage elements. This array isn't modifiable. The length is given by PDOCRGetNumLanguagesInstalled().
: voidan array of OCRLanguage elements.
: voidnumber of languages installed.
ASAtom * PDOCRParamsGetCandidateFonts(OCRParams params)Get the Candidate Fonts used to try to match recognized text, as an array of ASAtoms. Each ASAtom represents a name for a font to try to use for text recognition. The default list should work well in most cases. If you're using text that isn't represented by Latin fonts, or by Chinese, Japanese, or Korean fonts, then retrieve this list, add the font that can represent that text, then set that new list on OCRParams. Enough font names must be supplied to cover the expected languages/scripts in use. The code selects a font to represent each word. If a word code-switches between different scripts, for instance, if it contains non-Latin text and Arabic numerals, then make sure to supply the name of a font family that can handle both the text and the numerals. The quality of the results depends on the font choice. The list is searched in order until a font works for a particular word. To make the text fit better, it's recommended to list proportional fonts before fixed-width fonts. Decorative fonts with flourishes, like Zapf Chancery, deliver poor results. Generally, supply a font that would be used in block text, such as in a newspaper or work of literature, such as Times Roman, or a font already in the list, like MinionPro. If the PDOCRCreateForm() function can't identify a font that covers the whole text of a word, it will follow the policy set by the OCRMissingFontStrategy parameter. A candidate font that is not installed is skipped. The default list names only fonts APDFL supplies. To recognize a script APDFL supplies no font for, use PDOCRParamsSetCandidateFonts() to add a font that covers it and that you have the right to embed. Each element is an ASAtom corresponding to a string representing a candidate font. This array can only be modified by calling PDOCRParamsSetCandidateFonts(). The length is given by PDOCRParamsGetNumCandidateFonts().
params: OCRParamsIN OCRParams object
an array of ASAtoms
Get the number of engine-specific configuration parameters currently set.
params: OCRParamsIN OCRParams object to query.
Number of key-value pairs, or 0 if params is NULL.
const char * PDOCRParamsGetConfigParameterKey(OCRParams params, ASInt32 index)Get an engine-specific configuration parameter key by index.
const char *The key string, or NULL if params is NULL or index is out of range.
const char * PDOCRParamsGetConfigParameterValue(OCRParams params, ASInt32 index)Get an engine-specific configuration parameter value by index.
const char *The value string, or NULL if params is NULL or index is out of range.
Get the Languages configured to be recognized, as an array of OCRLanguage elements. This array can only be modified by calling PDOCRParamsSetLanguagesConfigured(). The length is given by PDOCRParamsGetNumLanguagesConfigured().
params: OCRParamsIN OCRParams object
an array of OCRLanguage elements.
Get the Number of Candidate Fonts to try to match recognized text. The default list should work well in most cases. If you're using text that isn't represented by Latin fonts, or by Chinese, Japanese, or Korean fonts, then retrieve this list, add the font that can represent that text, then set that new list on OCRParams. Enough font names must be supplied to cover the expected languages/scripts in use. The code selects a font to represent each word. If a word code-switches between different scripts, for instance, if it contains non-Latin text and Arabic numerals, then make sure to supply the name of a font family that can handle both the text and the numerals. The quality of the results depends on the font choice. The list is searched in order until a font works for a particular word. To make the text fit better, it's recommended to list proportional fonts before fixed-width fonts. Decorative fonts with flourishes, like Zapf Chancery, deliver poor results. Generally, supply a font that would be used in block text, such as in a newspaper or work of literature, such as Times Roman, or a font already in the list, like MinionPro. If the PDOCRCreateForm() function can't identify a font that covers the whole text of a word, it will follow the policy set by the OCRMissingFontStrategy parameter. A candidate font that is not installed is skipped. The default list names only fonts APDFL supplies. To recognize a script APDFL supplies no font for, use PDOCRParamsSetCandidateFonts() to add a font that covers it and that you have the right to embed.
params: OCRParamsIN OCRParams object
the number of candidate font members in the OCRParams
Get the Number of Languages configured to be recognized.
params: OCRParamsIN OCRParams object
the number of languages currently configured in the OCRParams object
Get the page segmentation mode parameter for an OCRParams object. Specifies how the OCR engine will view the page, and how it detects text segments.
params: OCRParamsIN OCRParams object
the OCRPageSegmentationMode value set in the OCRParams object.
params: OCRParamsIN OCRParams object
the OCRPerformance value set in the OCRParams object.
Get the Preprocessing setting. Indicates if image preprocessing (including rescaling, denoising, and deskewing) is enabled before OCR to improve character recognition.
params: OCRParamsIN OCRParams object
the state of the preprocess flag
void PDOCRParamsResetConfigParameters(OCRParams params)Clear all previously set engine-specific configuration parameters.
params: OCRParamsIN OCRParams object to be modified.
voidvoid PDOCRParamsSetCandidateFonts(OCRParams params, ASAtom *fonts, ASInt32 numFonts)Set the Candidate Fonts used to try to match recognized text. The default list should work well in most cases. If you're using text that isn't represented by Latin fonts, or by Chinese, Japanese, or Korean fonts, then retrieve this list, add the font that can represent that text, then set that new list on OCRParams. Enough font names must be supplied to cover the expected languages/scripts in use. The code selects a font to represent each word. If a word code-switches between different scripts, for instance, if it contains non-Latin text and Arabic numerals, then make sure to supply the name of a font family that can handle both the text and the numerals. The quality of the results depends on the font choice. The list is searched in order until a font works for a particular word. To make the text fit better, it's recommended to list proportional fonts before fixed-width fonts. Decorative fonts with flourishes, like Zapf Chancery, deliver poor results. Generally, supply a font that would be used in block text, such as in a newspaper or work of literature, such as Times Roman, or a font already in the list, like MinionPro. If the PDOCRCreateForm() function can't identify a font that covers the whole text of a word, it will follow the policy set by the OCRMissingFontStrategy parameter. A candidate font that is not installed is skipped. The default list names only fonts APDFL supplies. To recognize a script APDFL supplies no font for, use PDOCRParamsSetCandidateFonts() to add a font that covers it and that you have the right to embed. Each element is an ASAtom corresponding to a string representing a candidate font.
voidASBool PDOCRParamsSetConfigParameter(OCRParams params, const char *key, const char *value)Set an engine-specific configuration parameter. Multiple calls accumulate parameters. Calling with the same key replaces the previous value. These parameters are passed through to the underlying OCR engine (e.g., Tesseract) as engine-specific settings. See the OCR engine documentation for valid parameter names and values.
params: OCRParamsIN OCRParams object to be modified.
key: const char *IN Parameter name (will be copied). Must not be NULL.
value: const char *IN Parameter value (will be copied). Must not be NULL.
true on success, false on failure (e.g., NULL params/key/value or memory allocation failure).
void PDOCRParamsSetLanguagesConfigured(OCRParams params, OCRLanguage *languages, ASInt32 numLanguages)Set the Languages configured to be recognized, as an array of OCRLanguage elements.
params: OCRParamsIN OCRParams object
languages: OCRLanguage *IN languages to configure OCREngine with
numLanguages: ASInt32the size of the languages array
voidvoid PDOCRParamsSetPageSegmentationMode(OCRParams params, OCRPageSegmentationMode pageSegmentationMode)Set the page segementation mode parameter for an OCRParams object. Specifies how the OCR engine will view the page, and how it detects text segments.
params: OCRParamsIN OCRParams object to be modified.
pageSegmentationMode: OCRPageSegmentationModevoidvoid PDOCRParamsSetPerformance(OCRParams params, OCRPerformance performance)Set the performance parameter for an OCRParams object.
params: OCRParamsIN OCRParams object to be modified.
performance: OCRPerformanceIN the OCRPerformance value to set on the OCRParams object.
voidvoid PDOCRParamsSetPreprocessing(OCRParams params, ASBool preprocessing)Set the Preprocessing setting. Indicates if image preprocessing (including rescaling, denoising, and deskewing) is enabled before OCR to improve character recognition.
voidvoid PDOCRRecognizePage(PDPage page, OCREngine engine, OCRMissingFontStrategy strategy)Run optical character recognition (OCR) on a page.
page: PDPageIN The page being OCR'd
engine: OCREngineIN Configured OCREngine object
strategy: OCRMissingFontStrategyIN specifies the behavior to take if a Font isn't available to represent the Text
voidvoid PDOCRReleaseEngine(OCREngine engine)Release an OCREngine created with PDOCRCreateEngine.
engine: OCREngineIN OCREngine to be released.
voidvoid PDOCRReleaseParams(OCRParams params)Release an OCRParams obtained with PDOCRDefaultParams.
params: OCRParamsIN OCRParams object to be released.
voidEnumeration to specify how to handle missing fonts during OCR.
Raise an exception.
Ignore the missing font and continue recognizing the next word of text.
Replace the characters of text with the Unicode replacement Character. NOTE: the CandidateFontsNames member of the OCRParams instance must include a Font that can represent this character or an exception will be raised.
Enumeration to specify how the OCR engine will view the page, and how it detects text segments.
Orientation and script detection (OSD).
Automatic page segmentation with OSD.
Automatic without OSD.
Assume a single column of text.
Assume a single block of vertically aligned text.
Assume a single block of text.
Assume a single line of text.
Assume a single word.
Assume a single word in a circle.
Assume a single char.
Find all text in no particular order.
Sparse text with OSD.
Treat as a raw line with no input processing.
Default performance.
The default performance is useful for most scenarios and is a reasonable tradeoff of speed vs. accuracy, thus suitable for most languages.
Blend accuracy with speed.
Favor accuracy over speed.
Best possible accuracy.
22 items
OfficeToPDFResult OfficeToPDFConvertFromMemory(const unsigned char *inputBytes, ASSize_t inputLength, const OfficeToPDFParamsRec *params)Converts a Word document held in memory, and returns the PDF as bytes on the result, read with OfficeToPDFResultGetOutput(). The plug-in spools the document through a directory of its own in the system's temporary directory, which on Linux and macOS only the converting user can enter, and removes it before it returns.
inputBytes: const unsigned char *The .docx's bytes.
inputLength: ASSize_tHow many bytes there are.
params: const OfficeToPDFParamsRec *The parameters, or NULL for the defaults.
The conversion's result, which the host releases.
OfficeToPDFResult OfficeToPDFConvertToDocument(const char *inputPath, PDDoc *outDocument, const OfficeToPDFParamsRec *params)Converts a Word document, and returns the PDF as an open document the host owns. The host can merge, stamp, sign or save the document through the library, and closes it when it is done. The plug-in keeps no reference to it. The document is ready to save as it is: every font carries its ToUnicode map and widths, and the document is marked PDF 1.7. A save without PDSaveKeepModDate stamps the system clock as the /ModDate, in place of the conversion's.
inputPath: const char *The .docx to convert, as a UTF-8 path.
outDocument: PDDoc *Receives the document, or NULL when the conversion fails. When it is NULL itself, nothing is converted, and the status is kOfficeToPDFErrorDestinationNotWritable, whatever the input; only the checks every conversion makes first, that the plug-in is initialized and the library is started on the thread, come before it.
params: const OfficeToPDFParamsRec *The parameters, or NULL for the defaults.
The conversion's result, which the host releases.
OfficeToPDFResult OfficeToPDFConvertToFile(const char *inputPath, const char *outputPath, const OfficeToPDFParamsRec *params)Converts a Word document, and writes the PDF to a file. On success the file holds the complete PDF, replacing any file that was there. On failure nothing is written, and a file that was there is left as it was.
inputPath: const char *The .docx to convert, as a UTF-8 path.
outputPath: const char *Where to write the PDF, as a UTF-8 path.
params: const OfficeToPDFParamsRec *The parameters, or NULL for the defaults.
The conversion's result, which the host releases.
const char * OfficeToPDFGetVersionString(void)The plug-in's version, "MAJOR.MINOR.PATCH": never NULL, and the same version the plug-in's file carries. A host can check it before it relies on a diagnostic kind or a behaviour its header predates. It is not the table's version, OfficeToPDFHFTVersion.
: voidconst char *void OfficeToPDFInitParams(OfficeToPDFParams params)Fills a parameters record with the defaults: the system clock, and comments omitted. Set params->size to sizeof(OfficeToPDFParamsRec) first. The plug-in writes only the first size bytes, so a plug-in newer than the host's header never writes past the record, and it leaves size as the host set it.
params: OfficeToPDFParamsThe record to fill. NULL is ignored.
voidASBool OfficeToPDFInitialize(void)Initializes the plug-in, and returns true when it is ready. The library initializes the plug-in when it loads it, so a host that has the table finds the plug-in ready, and again on each thread that starts the library afterwards; neither lifts an OfficeToPDFTerminate() the host called, which only this selector does. It may run any number of times, including after OfficeToPDFTerminate(). A host that links the plug-in directly (OfficeToPDFCalls.h) calls it before converting. It never initializes Adobe PDF Library: the host starts the library on each thread it converts on.
: voidconst char * OfficeToPDFResultGetDiagnosticAsset(OfficeToPDFResult result, ASSize_t index)What a diagnostic is about, such as an image's relationship id or a font's family: never NULL. "" for a NULL result or an index out of range.
result: OfficeToPDFResultThe result to read.
index: ASSize_tThe diagnostic, counting from 0.
const char *How many per-asset diagnostics a conversion reported. 0 for a NULL result.
result: OfficeToPDFResultThe result to read.
OfficeToPDFDiagnosticKind OfficeToPDFResultGetDiagnosticKind(OfficeToPDFResult result, ASSize_t index)A diagnostic's kind. kOfficeToPDFDiagPlaceholderImage for a NULL result or an index out of range.
result: OfficeToPDFResultThe result to read.
index: ASSize_tThe diagnostic, counting from 0.
const char * OfficeToPDFResultGetDiagnosticMessage(OfficeToPDFResult result, ASSize_t index)A diagnostic's detail, for a log: never NULL. "" for a NULL result or an index out of range.
result: OfficeToPDFResultThe result to read.
index: ASSize_tThe diagnostic, counting from 0.
const char *const char * OfficeToPDFResultGetMessage(OfficeToPDFResult result)A conversion's message, for a log: never NULL, and empty on success. It is not a stable contract. Branch on the status and the diagnostic kinds, not on this text. "" for a NULL result.
result: OfficeToPDFResultThe result to read.
const char *ASBool OfficeToPDFResultGetOutput(OfficeToPDFResult result, const unsigned char **outBytes, ASSize_t *outLength)The PDF's bytes, from a memory conversion that succeeded. The bytes belong to the result.
result: OfficeToPDFResultThe result to read.
outBytes: const unsigned char **Receives the bytes.
outLength: ASSize_t *Receives how many there are.
True when the result holds bytes. False, with both outputs left as they were, for a file or document conversion, a failed one, a NULL result or a NULL output.
A conversion's status. kOfficeToPDFErrorConversionFailed for a NULL result.
result: OfficeToPDFResultThe result to read.
void OfficeToPDFResultRelease(OfficeToPDFResult result)Releases a result and everything it owns. Call it once for each result.
result: OfficeToPDFResultThe result to release. NULL is ignored.
voidvoid OfficeToPDFTerminate(void)Terminates the plug-in. Until OfficeToPDFInitialize() runs again, a conversion does nothing and returns kOfficeToPDFErrorNotInitialized, on every thread, including one that starts the library afterwards. Results the host holds stay valid. It may run any number of times, and before any OfficeToPDFInitialize(). It never terminates Adobe PDF Library.
: voidvoidtypedef OfficeToPDFParamsRec* OfficeToPDFParamsA parameters record, as OfficeToPDFInitParams() takes it to fill.
struct OfficeToPDFParamsRecA conversion's parameters. Set size to sizeof(OfficeToPDFParamsRec), then call OfficeToPDFInitParams() for the defaults: the system clock, and comments omitted. The record only grows at its end, and the plug-in writes and reads only the first size bytes, taking the default for any member past them, so a host built against an older header keeps working with a newer plug-in. A conversion given a NULL record takes every default. One record serves any number of conversions.
size: ASSize_tThe record's size in bytes. The host sets it; the plug-in never changes it.
useConversionTime: ASBoolWhen true, conversionTime is stamped as the PDF's /CreationDate and /ModDate and used for the document's DATE and TIME fields, so every conversion of a document carries the same dates and field text. When false, the default, the system clock is used.
conversionTime: OfficeToPDFTimestampThe instant used when useConversionTime is true.
comments: OfficeToPDFCommentRenderingHow the document's comments appear. The default is kOfficeToPDFCommentsOmit.
typedef struct _t_OfficeToPDFResult* OfficeToPDFResultOne conversion's result: its status, its message, its per-asset diagnostics and, for a memory conversion, the PDF's bytes. The plug-in allocates a result and the host releases it, once, with OfficeToPDFResultRelease(). Everything an accessor returns belongs to the result and stays valid until the release, so copy what you keep. A result stays valid after OfficeToPDFTerminate(). Release every result before the library unloads the plug-in, because the code that releases a result is unloaded with it. A conversion returns NULL only when it cannot allocate its result. Every accessor, and the release, accept NULL.
struct OfficeToPDFTimestampA civil instant, with no time zone.
The default: the PDF carries no trace of the comments.
Word's printed markup: a markup area beside each page, with each comment in a box joined to its anchor.
PDF annotations: a note at each comment's anchor, carrying its author, its time and its text. The pages draw as with kOfficeToPDFCommentsOmit.
What a per-asset diagnostic reports, read with OfficeToPDFResultGetDiagnosticKind(). A diagnostic describes something the conversion approximated or replaced; it does not change the status, and a successful conversion can report several. A kind above the highest this header names comes from a newer plug-in: treat it as other, and read the diagnostic's asset and message.
A placeholder was drawn for content that could not be rendered: an image that would not decode, a SmartArt diagram with nothing to draw, or a graphic of no known kind.
A font was not available, and another was used.
A font embedded in the document was used.
A font lacked the bold or italic face asked for, and one was synthesized.
An equation could not be drawn as math, and a placeholder was drawn.
No usable OpenType MATH font was available, so default math metrics were used.
A chart was drawn; the message names how.
A chart could not be drawn, and a placeholder was drawn.
A hyperlink's text was drawn, but the link was not made clickable.
A graphic was left out, and nothing was drawn in its place.
A custom note separator could not be used, and the default rule was drawn.
A note referenced from a header or footer was clipped.
A note reference inside another note was drawn as plain content.
A note ran past the pages it may continue on, and the rest was clipped.
A shape was drawn as an approximation of its geometry, fill or 3-D scene.
Arabic-script text or a ligature could not take its shaped form, and was drawn one code point at a time.
A watermark was drawn degraded, or not drawn.
A picture's styling was drawn as an approximation.
A picture's theme reference could not be resolved.
The placement of floating objects and notes did not settle, so a floating object may sit on a page next to its anchor's, or a note area may overlap body text.
A section's page geometry left no body area, and a minimum was used.
A Word comment was left out or degraded.
A floating object could not be placed where the layout planned it, or has no visible area on its page. It is still drawn.
A run asked for a variant of a character, through a variation selector, that its font does not define, or the font's variation table could not be read. The character was drawn in its default form. The asset is the PostScript name of the font that drew it, e.g. KozMinPr6N-Regular, which may be a font substituted for the document's; the message names the sequence's code points. Reported once per font and sequence.
A conversion's outcome, read with OfficeToPDFResultGetStatus(). Each failure has its own code, so a host can handle each cause its own way.
A valid PDF was produced.
The source does not exist or cannot be read.
The source is not a valid .docx document.
The source is password-protected.
The destination cannot be written. Nothing was written to it.
The conversion failed on a valid source, or the calling thread has not started Adobe PDF Library.
The plug-in is not initialized, and nothing was done. Either OfficeToPDFTerminate() ran, or a host that links the plug-in directly has not called OfficeToPDFInitialize().
14 items
ASBool PDFlattenerConvert(PDDoc aPDDoc, PDFlatten flattenParams, float transQuality, ASUns32 firstPage, ASUns32 lastPage, ASUns32 *numFlattenedPages, ASUns32 flags)Flatten a PDF file.
aPDDoc: PDDocThe input PDDoc which we want to Flatten. The output will be in the same PDDoc.
flattenParams: PDFlattenInput parameters for flattening.
transQuality: floatfirstPage: ASUns32The first page of aPDDoc which we want to Flatten.
lastPage: ASUns32The last page of aPDDoc which we want to Flatten.
numFlattenedPages: ASUns32 *set to the number of pages that are flattened.
flags: ASUns32Kept for future use. Default to 0.
1 on success.
ASBool PDFlattenerConvertEx(PDDoc aPDDoc, PDFlatten flattenParams, float transQuality, ASUns32 firstPage, ASUns32 lastPage, ASUns32 *numFlattenedPages, ASUns32 flags, FlattenProgressMonitor FlattenProgress, void *progressClientData)Flatten a PDF file.
aPDDoc: PDDocThe input PDDoc which we want to Flatten. The output will be in the same PDDoc.
flattenParams: PDFlattenInput parameters for flattening.
transQuality: floatfirstPage: ASUns32The first page of aPDDoc which we want to Flatten.
lastPage: ASUns32The last page of aPDDoc which we want to Flatten.
numFlattenedPages: ASUns32 *set to the number of pages that are flattened.
flags: ASUns32Kept for future use. Default to 0.
FlattenProgress: FlattenProgressMonitorthe callback which we want to register with the plug-in.
progressClientData: void *any client data which client wants to get back with the callback for its own reference.
1 on success.
ASBool PDFlattenerConvertEx2(PDDoc aPDDoc, ASUns32 firstPage, ASUns32 lastPage, ASUns32 *numFlattenedPages, PDFlattenerUserParams userParams)Flatten a PDF file.
aPDDoc: PDDocThe input PDDoc which we want to Flatten. The output will be in the same PDDoc.
firstPage: ASUns32The first page of aPDDoc which we want to Flatten.
lastPage: ASUns32The last page of aPDDoc which we want to Flatten.
numFlattenedPages: ASUns32 *set to the number of pages that are flattened.
userParams: PDFlattenerUserParamsA structure object defined for user set parameters e.g flattenParams, transquality, Blending Colorspace profile, progress monitor and Compression Settings.
1 on success.
ASBool PDFlattenerConvertEx3(PDDoc aPDDoc, ASUns32 firstPage, ASUns32 lastPage, ASUns32 *numFlattenedPages, PDFlattenerUserParams userParams, ASBool embedFlattenerProfiles)Flatten a PDF file.
aPDDoc: PDDocThe input PDDoc which we want to Flatten. The output will be in the same PDDoc.
firstPage: ASUns32The first page of aPDDoc which we want to Flatten.
lastPage: ASUns32The last page of aPDDoc which we want to Flatten.
numFlattenedPages: ASUns32 *set to the number of pages that are flattened.
userParams: PDFlattenerUserParamsA structure object defined for user set parameters e.g flattenParams, transquality, Blending Colorspace profile, progress monitor and Compression Settings.
embedFlattenerProfiles: ASBoolembed Flattener color profiles.
1 on success.
ASBool PDFlattenerInitialize(void)Initialises the PDFlattener Plug-in.
: voidAn ASBool value.
void PDFlattenerTerminate(void)Terminates the PDFlattener Plug-in.
: voidvoidvoid.
typedef ASBool(*) FlattenProgressMonitor(ASInt32 pageNum, ASInt32 totalPages, float current, ASInt32 reserved, void *clientData)(ASInt32 pageNum, ASInt32 totalPages, float current, ASInt32 reserved, void *clientData)Prototype of the callback which is registered by the client with the plug-in
typedef struct PDFlattenerUserParamsRec * PDFlattenerUserParamssize: size_tSet this to be the size of this struct.
flattenParams: PDFlattenFlatten Params Input parameters for flattening.
transQuality: floatRaster/Vector Balance.
flattenProgress: FlattenProgressMonitorClient registered progress monitor callback which will be called to report the progress.
progressClientData: void *Client registered data send back along with the progress monitor callback.
profileDesc: ASTextProfile Descriptions for use with this parameter can be found with ACMakeProfileList and ACProfileListItemDescription.
The best practice, however, is generally to leave this parameter as null so that defaults can be used.
If this parameter is set, it overrides the values set by PDPageSetBlendingProfile and PDPresetDefaultBlendingProfile, and will be used as the blending space for each page prior to flattening. It will override any existing page blending spaces.
This will be true regardless of how the existing page blending space was defined.
If the parameter is null, the blending space for each page will be either the value previously set by PDPageSetBlendingSpace, or the value contained in the Group entry of the page, which defines it's Blending space.
If neither of these has been used, it will be the value in PDPresefSetDefaultBlendingColorSpace if this is set.
If none of the above are true, it will be the Working Space for CMYK.
If that working space is not used, the profile for U.S. Web Coated SWOP (v2) will be used.
Note that within a page, there may be transparency groups. These groups will contain their own blending profile, and their contents will blend via that profile. The group as a whole will then blend into the page using the page's blending profile.
colorCompression: PDFlattenerColorCompSetColor Compression Setting for Flattened color Images.
grayCompression: PDFlattenerGrayscaleCompSetCompression Setting for Flattened Grayscale Images.
monoCompression: PDFlattenerMonochromeCompSetCompression Setting for Flattened Monochrome Images.
colorImageQuality: PDFlattenerQualitySettingQuality Setting for Flattened JPEG and JPEG2000 colored Images. This is valid only if the value of colorCompression is equal to kPDFlattenerJpegCompression or kPDFlattenerJpeg2000Compression
grayImageQuality: PDFlattenerQualitySettingQuality Setting for Flattened JPEG and JPEG2000 gray scale Images. This is valid only if the value of grayCompression is equal to kPDFlattenerGrayJpegCompression or kPDFlattenerGrayJpeg2000Compression
Enumeration for setting compression scheme for flattened color images.
Enumeration for setting the compression scheme for the Flattened Grayscale images.
Enumeration for setting the compression scheme for the Flattened Monochrome images.
Enumeration for setting the Quality setting for the JPEG or JPEG2000 images.
Setting this flag will choose the ZIP compression scheme (Flate encoding) for compressing the color images. Otherwise we will stick to the current default behavior and try to use JPEG compression wherever possible.
16 items
ASBool PDFProcessorConvertAndSaveToPDFA(PDDoc srcPDDoc, ASPathName outputFilePath, ASFileSys outputFileSystem, PDFProcessorPDFAConversionOption option, PDFProcessorPDFAConvertParams userParams)Processes a PDF file, converts it to a PDF/A standard, and saves the output document to disk .
srcPDDoc: PDDocInput PDDoc to be converted.
outputFilePath: ASPathNameOutput file path complete with the name of the PDF file we want to save the output to.
outputFileSystem: ASFileSysoption: PDFProcessorPDFAConversionOptionDefine the PDF/A conversion option.
userParams: PDFProcessorPDFAConvertParamsParameters to control the conversion. @Return True if conversion is successful. Will throw an exception in case of errors.
ASBool PDFProcessorConvertAndSaveToPDFX(PDDoc srcPDDoc, ASPathName outputFilePath, ASFileSys outputFileSystem, PDFProcessorPDFXConversionOption option, PDFProcessorPDFXConvertParams userParams)Processes a PDF file, converts it to a PDF/X standard and saves it to disk.
srcPDDoc: PDDocInput PDDoc to be converted.
outputFilePath: ASPathNameOutput file path complete with the name of the PDF file we want to save the output to.
outputFileSystem: ASFileSysoption: PDFProcessorPDFXConversionOptionDefine the PDF/X conversion option.
userParams: PDFProcessorPDFXConvertParamsParameters to control the conversion. @Return True if conversion is successful. Will throw an exception in case of errors.
ASBool PDFProcessorConvertToPDFA(PDDoc srcPDDoc, PDDoc *outPDDoc, PDFProcessorPDFAConversionOption option, PDFProcessorPDFAConvertParams userParams, PDDocSaveParams outSaveParams)Processes a PDF file and provides a pointer to the converted PDDoc.
srcPDDoc: PDDocInput PDDoc to be converted.
outPDDoc: PDDoc *option: PDFProcessorPDFAConversionOptionDefine the PDF/A conversion option.
userParams: PDFProcessorPDFAConvertParamsParameters to control the conversion.
outSaveParams: PDDocSaveParamsASBool PDFProcessorConvertToPDFX(PDDoc srcPDDoc, PDDoc *outPDDoc, PDFProcessorPDFXConversionOption option, PDFProcessorPDFXConvertParams userParams, PDDocSaveParams outSaveParams)Processes a PDF file, and provides a pointer to the converted PDDoc.
srcPDDoc: PDDocInput PDDoc to be converted.
outPDDoc: PDDoc *option: PDFProcessorPDFXConversionOptionDefine the PDF/X conversion option.
userParams: PDFProcessorPDFXConvertParamsParameters to control the conversion.
outSaveParams: PDDocSaveParamsASBool PDFProcessorInitialize(void)Initialises the PDFProcessor Plug-in.
: voidAn ASBool value.
void PDFProcessorTerminate(void)Terminates the PDFProcessor Plug-in.
: voidvoidvoid.
typedef ASBool(*) PDFProcessorProgressMon(ASInt32 pageNum, ASInt32 totalPages, float current, void *clientData)(ASInt32 pageNum, ASInt32 totalPages, float current, void *clientData)Prototype of the callback which is registered by the client with the plug-in
typedef struct PDFProcessorPDFAConvertParamsRec * PDFProcessorPDFAConvertParamssize: ASSize_tThe size of the structure. Set it to sizeof(PDFProcessorRec).
removeAllAnnotations: ASBoolRemove all annotations or actions regardless of what is allowed by a particular PDF/A version. The different PDF/A standards have different requirements as what types of annotations and actions are prohibited in order to comply with those standards.
If false we will filter out all illegal annotations and actions (according to the standard being used) while retaining the legal ones. If true this will remove all annotations and actions from the output PDF/A file.
noRasterizationOnFontErrors: ASBoolIf we encounter any errors like unembeddable fonts etc while conversion then we try to rasterize the current page on which the error occured. However the client can modify this behavior by setting the value of this parameter to true in which case we will throw an error if we encounter any problems while conversion. By default we will rasterize the page on error.
If false we will try to rasterize the current page if any error occured. If true we will abort and throw an exception if any error occured.
abortIfXFAPresent: ASBoolThe presence of XFA can result in some loss of data in output PDF/A-1 file as the PDFProcessor does not support XFA. However you can choose to abort the conversion if XFA is present by setting this parameter to true. By default we will not abort if XFA is present for PDF/A-1.
If false we will convert even if XFA is found. If true we will abort the process if XFA is found.
colorCompression: PDFProcessorColorCompressionSetColor Compression Setting for Color Images. NOTE: This setting will be honored for images when possible, in some cases however when not supported Images will default to Flate compression.
grayCompression: PDFProcessorGrayscaleCompressionSetColor Compression Setting for Grayscale Images. NOTE: This setting will be honored for images when possible, in some cases however when not supported Images will default to Flate compression.
monoCompression: PDFProcessorMonochromeCompressionSetCompression Setting for Monochrome Images.
progMon: PDFProcessorProgressMonClient registered progress monitor callback which will be called to report the progress.
progMonData: void *Client registered data sent back along with the progress monitor callback.
noValidationErrors: ASBoolWhen true, PDF implementation limits (as defined in the PDF Specification of the PDF/A target) of the page are ignored. When false, PDF implementation limits of the page are checked and if violated will cause the page to be rasterized as a fallback mechanism when noRasterizationOnFontErrors is false or simply raise an error if noRasterizationOnFontErrors is true.
rasterizationResolution: ASUns16When this value is zero, we will rasterize at 72 DPI (Legacy Behaviour). Otherwise, we will interpret the value as the desired resolution.
OutputIntentName: ASTextAdd an ASText object, which, when present, will carry the name of a profile to use as output intent
Note: If this is specified, it must include the description of a valid ICC profile, which is a CMYK space for PDF/X-1a or a CMYK or RGB space for PDF/X-3.
validateImplementationLimitsOfDocument: ASBoolValidate PDF implementation limits (as defined in the PDF Specification of the PDF/A target) of the document. When true. PDF implementation limits are checked and if violated raise an error. When false, PDF implementation limits are not checked. Note this option applies to the whole document versus only pages in the noValidationErrors option.
Note: : It's recommended noValidationErrors be set to false, noRasterizationOnFontErrors be set to true, and validateImplementationLimitsOfDocument be set to true for getting the best quality output that adheres to the specification.
customOutputIntentProfile: AC_ProfileSpecify to use a custom ICC profile for the /OutputIntent, when specified the OutputIntentName member is ignored. NOTE: The ICC profile must be valid and match the target conversion option's underlying space.
typedef struct PDFProcessorPDFXConvertParamsRec * PDFProcessorPDFXConvertParamssize: ASSize_tThe size of the structure. Set it to sizeof(PDFProcessorRec).
removeAllAnnotations: ASBoolSome of the standards like PDF/X prohibit the presence of some types of annotations and actions in order to comply with those standards.
If false we will filter out all illegal annotations and actions (according to the standard being used) while retaining the legal ones. If true this will remove all annotations and actions from the output PDF/X file.
abortIfXFAPresent: ASBoolPresence of XFA can result in some loss of data in output PDF/X file as PDFProcessor do not support XFA. However client can choose to abort the conversion in case XFA is present by setting this parameter to true. By default we will not abort if XFA is present.
If false we will convert even if we detect the XFA form entry in PDDoc If true we will abort the process.
colorCompression: PDFProcessorColorCompressionSetColor Compression Setting for Color Images.
grayCompression: PDFProcessorGrayscaleCompressionSetCompression Setting for Grayscale Images.
monoCompression: PDFProcessorMonochromeCompressionSetCompression Setting for Monochrome Images.
progMon: PDFProcessorProgressMonClient registered progress monitor callback which will be called to report the progress.
progMonData: void *Client registered data sent back along with the progress monitor callback.
OutputIntentName: ASTextAdd an ASText object, which, when present, will carry the name of a profile to use as output intent
Note: If this is specified, it must include the description of a valid ICC profile, which is a CMYK space.
noValidationErrors: ASBoolWhen true, PDF implementation limits (as defined in the PDF Specification of the PDF/X target) of the page are ignored. When false, PDF implementation limits of the page are checked and if violated will raise an error.
ignoreColorConversion: ASBoolNormally colors are changed to a CMYK-based space since this is the most desirable target output for print and is based on the historical limitation of PDF/X-1A. However the more recent PDF/X standards allow non-CMYK so if this option is set, colors aren't converted in the document. This is for the case when you know you don't need to change any colors to achieve compliance.
destOutputProfileURL: ASTextThe URL from which the output intent ICC profile can be retrieved, required by kPDFProcessorConvertToPDFX5pg2010 and ignored by every other conversion option. PDF/X-4p, which PDF/X-5pg builds on, replaces the embedded DestOutputProfile with a DestOutputProfileRef whose URLS array names where the profile lives (ISO 15930-7:2010, Annex A.2). A URL cannot be inferred from the source document, so a PDF/X-5pg conversion raises an error when this is absent.
destOutputProfilePath: ASPathNameA local copy of the output intent ICC profile, used only to derive the DestOutputProfileRef values that ISO 15930-7:2010, Annex A.2 requires: ProfileName, ProfileCS, ICCVersion, the CheckSum, and for PDF/X-5n the ColorantTable. The profile itself is not embedded.
kPDFProcessorConvertToPDFX5n2010 requires this, because the PDF Reference forbids embedding an n-colorant profile, leaving no in-document copy to read. For kPDFProcessorConvertToPDFX5pg2010 it is optional: when absent the embedded profile the conversion produced is used instead.
Enumeration for setting compression scheme for Color Images.
Enumeration for setting compression scheme for Grayscale Images.
Enumeration for setting compression scheme for Monochrome Images.
This is used to select which particular PDF/A standard we want to convert to.
Convert to PDF/A-1a RGB
Convert to PDF/A-1a CMYK
Convert to PDF/A-1b RGB
Convert to PDF/A-1b CMYK
Convert to PDF/A-2a RGB
Convert to PDF/A-2a CMYK
Convert to PDF/A-2b RGB
Convert to PDF/A-2b CMYK
Convert to PDF/A-2u RGB
Convert to PDF/A-2u CMYK
Convert to PDF/A-3a RGB
Convert to PDF/A-3a CMYK
Convert to PDF/A-3b RGB
Convert to PDF/A-3b CMYK
Convert to PDF/A-3u RGB
Convert to PDF/A-3u CMYK
Convert to PDF/A-4 RGB
Convert to PDF/A-4 CMYK
Convert to PDF/A-4e RGB
Convert to PDF/A-4e CMYK
Convert to PDF/A-4f RGB
Convert to PDF/A-4f CMYK
This is used to select which particular PDF/X standard we want to convert to.
Convert to PDF/X-1a 2001
Convert to PDF/X-3 2003
Convert to PDF/X-4 2010
Convert to PDF/X-6 2020
Convert to PDF/X-5g 2010, the PDF/X-5 conformance level for externally referenced graphical content (ISO 15930-8, 8.1).
Convert to PDF/X-5pg 2010, the PDF/X-5 conformance level combining externally referenced graphical content with an externally referenced output intent profile (ISO 15930-8, Clause 9). Requires destOutputProfileURL.
Convert to PDF/X-5n 2010, the PDF/X-5 conformance level for an n-colorant printing condition (ISO 15930-8, Clause 7). Requires destOutputProfilePath and destOutputProfileURL naming an xCLR ICC profile; the PDF Reference forbids embedding an n-colorant profile, so it can only ever be referenced.
Convert to PDF/X-4p 2010 (ISO 15930-7, Annex A): PDF/X-4 conformance with the output intent ICC profile referenced externally rather than embedded. Requires destOutputProfileURL.
28 items
WebToPDFResultCode WebToPDFConvertFileTree(const char *rootPath, const char *indexFile, const char *outputPath, WebToPDFParams params)Convert a local directory to PDF.
rootPath: const char *Path to the root directory (UTF-8 encoded).
indexFile: const char *Entry-point file name (e.g. "index.html"), or NULL for auto-detect.
outputPath: const char *Path to the output PDF file (UTF-8 encoded).
params: WebToPDFParamsConversion parameters, or NULL for defaults.
A WebToPDFResultCode indicating success or failure.
WebToPDFResultCode WebToPDFConvertHTML(const char *htmlContent, const char *baseURL, const char *outputPath, WebToPDFParams params)Convert an HTML string to PDF.
htmlContent: const char *The HTML content to convert (UTF-8 encoded).
baseURL: const char *Base URL for resolving relative resources, or NULL.
outputPath: const char *Path to the output PDF file (UTF-8 encoded).
params: WebToPDFParamsConversion parameters, or NULL for defaults.
A WebToPDFResultCode indicating success or failure.
WebToPDFResultCode WebToPDFConvertURL(const char *inputURL, const char *outputPath, WebToPDFParams params)Convert a URL to PDF.
outputPath: const char *Path to the output PDF file (UTF-8 encoded).
params: WebToPDFParamsConversion parameters, or NULL for defaults.
A WebToPDFResultCode indicating success or failure.
WebToPDFResultCode WebToPDFConvertURLW(const wchar_t *inputURL, const wchar_t *outputPath, WebToPDFParams params)Convert a URL to PDF (wide-string version).
inputURL: const wchar_t *The URL to convert (UTF-16 encoded).
outputPath: const wchar_t *Path to the output PDF file (UTF-16 encoded).
params: WebToPDFParamsConversion parameters, or NULL for defaults.
A WebToPDFResultCode indicating success or failure.
info: WebToPDFConversionInfoPointer to a WebToPDFConversionInfoRec to populate.
true if info was filled, false if no conversion has occurred.
ASInt32 WebToPDFGetLastError(char *buffer, ASInt32 bufferSize)Get a detailed error message from the last failed operation.
buffer: char *Buffer to receive the error message.
bufferSize: ASInt32Size of buffer in bytes.
The actual length of the error message (may exceed bufferSize if truncated).
: voidVersion packed as (major << 16 | minor << 8 | patch).
void WebToPDFInitParams(WebToPDFParams params)Initialize a parameters structure with default values.
params: WebToPDFParamsPointer to a WebToPDFParamsRec to fill with defaults.
voidASBool WebToPDFInitialize(void)Initialize the WebToPDF plugin. Must be called once before any other WebToPDF functions. Sets up the Chromium Embedded Framework and internal plugin state.
: voidtrue on success, false on failure.
void WebToPDFShutdown(void)Permanently shut down the plugin's CEF runtime (final, synchronous). Joins the Chromium thread pool via CefShutdown() before returning. Unlike WebToPDFTerminate() (a repeatable per-session no-op), this is one-shot. Call once, at end-of-life, before the host unloads the plugin.
: voidvoidvoid WebToPDFTerminate(void)Terminate the WebToPDF plugin. Must be called when done using the plugin to release all resources, including the CEF runtime.
: voidvoidtypedef void(*) WebToPDFLogCallback(ASInt32 level, const char *message, void *clientData)(ASInt32 level, const char *message, void *clientData)Logging callback function prototype. Called to deliver log messages generated during conversion. The callback is invoked on the conversion thread, so implementations should be thread-safe or dispatch to the appropriate thread.
typedef ASBool(*) WebToPDFProgressCallback(ASInt32 pageNum, ASInt32 totalPages, float progress, void *clientData)(ASInt32 pageNum, ASInt32 totalPages, float progress, void *clientData)Progress callback function prototype. Called periodically during conversion to report progress. The callback may return false to request cancellation of the current operation.
typedef struct WebToPDFConversionInfoRec * WebToPDFConversionInfostruct WebToPDFConversionInfoRecInformation about a completed conversion. Populated by WebToPDFGetConversionInfo() after a successful conversion. String pointers (title, sourceURL) remain valid until the next conversion call or until the plugin is terminated.
size: ASSize_tStructure size for versioning. Set this to sizeof(WebToPDFConversionInfoRec) before calling WebToPDFGetConversionInfo(); only the leading size bytes are written.
pageCount: ASInt32Number of pages in the output PDF.
conversionTimeMs: ASInt32Wall-clock conversion time in milliseconds.
title: const char *Page title extracted from the HTML, or NULL. UTF-8 encoded.
sourceURL: const char *The resolved source URL that was converted, or NULL. UTF-8 encoded.
top: doubleTop margin in inches.
right: doubleRight margin in inches.
bottom: doubleBottom margin in inches.
left: doubleLeft margin in inches.
struct WebToPDFPageDimensionsCustom page dimensions in points (72 points = 1 inch). Used when WebToPDFParamsRec::pageSize is kWebToPDFPageSizeCustom.
width: doublePage width in points.
height: doublePage height in points.
struct WebToPDFParamsRecMain parameters structure for web-to-PDF conversion. Clients should call WebToPDFInitParams() to fill this structure with sensible defaults before modifying individual fields. The size field is used for versioning and must always be set to sizeof(WebToPDFParamsRec).
size: ASSize_tStructure size for versioning (must be first field).
Set this to sizeof(WebToPDFParamsRec)
before calling WebToPDFInitParams(), and leave it alone afterwards. The struct only ever grows at the end, so this is what lets a library build newer than your headers avoid reading or writing past the end of your allocation: it fills and consults only the leading size bytes and applies its own defaults to anything beyond them. A value too small to describe any released layout makes the conversion functions fail with kWebToPDFErrorInvalidParams.
struct WebToPDFViewportDimensionsCustom viewport dimensions in pixels. Used when WebToPDFParamsRec::viewportSize is kWebToPDFViewportCustom.
Downsampling resolution options for raster images in the output PDF. Images whose native resolution exceeds the chosen threshold are downsampled to reduce file size.
Disable downsampling; preserve original resolution.
Downsample to 300 DPI (default).
Downsample to 75 DPI (screen quality).
Downsample to 150 DPI.
Downsample to 600 DPI (high quality print).
Downsample to 1200 DPI (very high quality).
Image compression modes for raster images embedded in the output PDF. DeprecatedNot supported and has no effect. Conversion is performed by the CEF PDF generator, which exposes no image-compression control, so the compression of the raster images Chromium embeds cannot be selected. The enum is retained so the ABI stays compatible. Setting anything other than kWebToPDFCompressionJPEG emits a warning through WebToPDFParamsRec::logCallback.
Lossy JPEG compression (smaller file size). Not honored.
Lossless compression (larger file, pixel-perfect). Not honored.
Portrait orientation (taller than wide).
Landscape orientation (wider than tall).
Standard page sizes for the output PDF. Choose kWebToPDFPageSizeCustom and populate WebToPDFParamsRec::customPageSize to specify exact dimensions in points.
US Letter (8.5 x 11 in).
US Legal (8.5 x 14 in).
US Ledger / Tabloid (11 x 17 in).
ISO A3 (297 x 420 mm).
ISO A4 (210 x 297 mm).
ISO A5 (148 x 210 mm).
Custom dimensions specified in WebToPDFParamsRec::customPageSize.
Result codes returned by WebToPDF conversion operations. Every conversion function returns one of these codes to indicate success or the specific category of failure. Use WebToPDFGetLastError() to obtain a human-readable description when a non-success code is returned.
Operation completed successfully.
An input or output file path is invalid or inaccessible.
The CEF rendering engine reported an internal error.
CEF could not be initialized (missing binaries, sandbox failure, etc.).
The supplied URL is malformed or uses an unsupported scheme.
The conversion exceeded the configured timeout.
The output PDF file could not be written.
WebToPDFInitialize() has not been called yet.
The conversion was cancelled via the progress callback.
The parameter block's size field is not a size this library can interpret.
Viewport size presets used when rendering web content. Controls the virtual browser viewport dimensions during rendering. Choose kWebToPDFViewportCustom and populate WebToPDFParamsRec::customViewport to specify exact pixel dimensions.
Desktop viewport (default 1280x1024).
Mobile viewport (e.g. 375x812).
Tablet viewport (e.g. 768x1024).
Custom dimensions specified in WebToPDFParamsRec::customViewport.
3 items
ASInt32 XPS2PDFConvert(ASCab inSettings, ASInt32 conversionFlags, ASPathName inPath, ASFileSys inFileSys, PDDoc *outPDDoc, void *clientData)Converts aa XPS file into a PDF file.
inSettings: ASCabconversionFlags: ASInt32Kept for future use. Default to 0.
inPath: ASPathNameFolder path where the input XPS files are kept.
inFileSys: ASFileSysFile system
outPDDoc: PDDoc *The output PDDoc which we want to make from XPS.
clientData: void *Kept for future use. Default to NULL.
: voidAn ASBool value.
: voidvoidvoid.