Command Line Syntax
To run PDF Alchemist from the command line, type:
- the program name
- the name of the file in quotes
- the name of the output directory where the program will write the output EPUB or HTML and associated files
These are the only required parameters.
In this example, the output directory is called “export” under C:\Alchemist:
C:\Alchemist\pdfalchemist "pathfinder.pdf" c:\alchemist\export
The input PDF file does not need to be in the same directory as the program. Also, as long as you include in quotes the path and file name for the input PDF, and the path name for the export files, it doesn’t matter if the name of the directories feature blank spaces:
C:\Alchemist\pdfalchemist "E:\SJonesPDF AlchemistPDF Alchemist test doc.PDF" "E:\SJonesPDF AlchemistExport files"
Add any optional commands to the end of the statement, one after the other, with a space in between each command. Also include a space between each command and the variable (generally “true”), as in “-keepEmbeddedFont true”.
In this example, the command would convert a PDF document called Pathfinder.PDF to HTML and store the output in a folder called “/export.” It will also include references to fonts in the HTML file, so that the HTML file will look for fonts already available on the local machine. It will not export fonts embedded in the PDF source file and then call those fonts from the export directory (we describe “keepEmbeddedFont” in more detail below).
C:\Alchemist\pdfalchemist "pathfinder.pdf" c:\alchemistexport -keepEmbeddedFont true
Make sure you include a dash (“-keepEmbeddedFont”) in front of each parameter name.
If you simply type:
and don’t enter the name of an input file or an output directory, the program will display a summary of the command syntax, with a list of the optional parameters.
We describe these parameters below.
Command Line Options
We describe these parameters below.
|-blackText||Boolean “true” or “false”||By default, PDF Alchemist exports text from a PDF document in its native color. That is usually black, but if a PDF has a different color text against a colored background, such as white text on a dark blue page, the original text might not be visible in the HTML export file. This option allows a user to make it so that any text drawn from a PDF document is always rendered as black text in the export file.
Defaults to False. PDF Alchemist exports text from PDF documents in its native color, and does not convert it to black.
|-cmap||path or directory name||A folder containing PDF format character code map (CMap) files used for converting text in character ID (CID) form to Unicode in the HTML output. The folder name must have a trailing slash character. To learn more about cMAP see the description in Frequently Asked Questions.
|-enableBookmarks||Boolean “true” or “false”||The destinations found in the PDF outline in the source document (the table of contents) are exported to the output HTML file as a series of bookmarks. This HTML file contains a frame view of the generated PDF with the generated table of contents in one pane and the generated HTML content in a main viewing pane. This feature allows you to create a table of contents in your HTML output file based on the outline provided in the PDF source file. You can turn this feature off by setting the enableBookmarks value to False.
Defaults to True. Will happen automatically.
|-enableCaptions||Boolean “true” or “false”||By default, PDF Alchemist does not look for caption text under images that appear in a PDF document. Set this option to “true” to tell the software to look for text appearing under images and define that text, when found, as a caption.
Defaults to False. PDF Alchemist never looks for captions under graphics.
|-enableInfographicDetection||Boolean “true” or “false”||By default, PDF Alchemist seeks to detect infographic content, such as charts and diagrams, and render them as separate export image files. But this process can interfere with how PDF Alchemist formats tables and hyperlinks. This option allows a user to turn this feature off.
Defaults to True. PDF Alchemist detects infographic contents.
|-flattenForms||Boolean “true” or “false”||PDF Alchemist converts PDF Forms by default to interactive HTML forms in fixed layout format. In other words, you can use PDF Alchemist to turn a PDF form document created using Adobe Acrobat into a matching HTML form. The text fields and check boxes and other interactive features work. But if you set “flattenForms” to “True” PDF Alchemist will instead convert your Acrobat PDF Form into a flattened HTML document. The content will appear but it will not be interactive. PDF Alchemist will use the normal appearance stream defined for each form element.
Defaults to False. Acrobat PDF forms will be converted to HTML forms.
|-htmlLinkStyleUnspecified||Boolean “true” or “false”||Make hyperlinks appear as standard HTML links. The feature will ignore any link styles found in the source PDF document. If set to True the use the default style of the browser for presenting links.
Defaults to False. The style of any links found in the source PDF document will be preserved.
|-imageDPI||A whole number from 12 to 2400||Enter a number to specify the target resolution (in Dots per Inch) for images in the PDF document that you want to export to rasterized graphic files. If you want to improve the resolution of graphics drawn from the PDF document you could for example set this at 600 or 1000 DPI and the resulting image will look better in a browser. But the graphic file will also be larger. Or if you wanted the export PNG graphic files to be smaller you could set the DPI to 72. The permitted range is from 12 DPI to 2400 DPI.
Defaults to 200 for 200 DPI
|-keepBackground||Boolean “true” or “false”||By default PDF Alchemist discards images that are determined to be background images. If this option is specified as “True” images that PDF Alchemist detects as background images will be retained in the output.
Defaults to False. Background images are discarded during conversion.
|-keepEmbeddedFonts||Boolean “true” or “false”||By default PDF Alchemist emits fonts that are embedded in the PDF input to font files in the output directory. The product adds references to those fonts in its generated HTML. If this option is specified as “True” PDF Alchemist will not emit these font files. Instead PDF Alchemist will emit references for the font names found in the PDF file. This will cause fonts installed on the local target processing/ viewing environment to be used when the HTML file is opened.
Defaults to False. Emit fonts embedded in the PDF as font files so that the HTML file will reference these generated fonts.
|-keepHeaderFooter||Boolean “true” or “false”||By default PDF Alchemist discards page contents that it can determine are page headers and/or footers. This includes page numbers and titles. If this option is specified as “True” PDF Alchemist will preserve header and footer text in the output.
Defaults to False. Headers and footers are discarded during conversion.
|-logging||Boolean “true” or “false”||If set to “True” additional information is output to the console during conversion. This information is of limited interest to users and should only be used when instructed by a representative from Datalogics.
Defaults to False. Only critical messages will be written to the console during execution.
|-mergeSpan||Boolean “true” or “false”||If set to “True” the product discards HTML style values when exporting content to XML output files. Examples include references to fonts/indented text/and color. Any <span> tags needed to define where these style values apply are also removed. The result will be cleaner text sent to the output file. The text will be easier to parse for content.
Defaults to False. HTML style information and <span> tags will be preserved.
|-ocrLanguage||Type: string, “deu” / “eng” / “fra” / “ita” / “nld” / “por” / “spa”||If you are using Optical Character Recognition (OCR) to pull text from images in an input PDF document (see -ocrMode), the OCR utility defaults to English language text. But the OCR utility supports other languages. Use this parameter to select German (deu), French (fra), Italian (ita), Dutch (nld), Portuguese (por) or Spanish (spa) if your input files use one of these languages instead. Note you can only select one language at a time for this option.
Default: eng (English)
|-ocrMode||Type: string, “off” / “tag” / “replace”||By default, PDF Alchemist passes images in PDF files through to its output without looking for text in these images.
If the -ocrMode option is set to “tag,” PDF Alchemist uses optical character recognition (OCR) to scan images when converting PDF files. Any text found within an image is embedded in the image reference alt attributes.
If the -ocrMode option is set to “replace,” the OCR feature is turned on and the OCR text replaces the original image in the output file. The process creates selectable text in the HTML or XML output, and the source image is removed. The text is also tagged as OCR text within the export file. This allows the person reviewing the output file to know where the text came from, and it also serves as a warning, as the OCR text might not be rendered perfectly. For an HTML or EPUB output file, any text generated from an image in the PDF input file using OCR is marked with this tag:
For an XML file, the tag looks like this:
Note: OCR processing can lead to substantial increases in processing time and should be enabled only when desired.
Default: off – No OCR processing is performed during conversion.
|-outputFormat||String “html” or “epub” or “xml”||Specify the type of output file–HTML, XML, or EPUB.
Defaults to “html” to generate HTML output.
|-purpose||String “indexing” or “balanced”||The type of output you generate using PDF Alchemist can vary depending on your goals. You may want to extract the content from a PDF document so that you can index the content as text for later searching. In that case it may not be important to you what the content looks like after the conversion process is complete. Or you may prefer instead to convert the content in a PDF document to HTML but preserve as much of the layout and appearance of the original PDF as possible.
PDF Alchemist supports two modes for the –purpose” option in the command-line interface:
indexing. PDF Alchemist will not rasterize any text. This preserves text for searching and indexing workflows. But the appearance of the output might differ significantly from the appearance of the input PDF.
balanced. The product creates output targeted to general purpose workflows. In this case the need for searchable output is balanced with the need for visually correct output. Text may be rasterized when required to preserve the visual appearance and ordering of text in relation to other elements.
Defaults to “balanced” to preserve original appearance if output is to HTML or EPUB.
|-reflowForms||Boolean “true” or “false”||PDF Alchemist emits PDF forms documents as fixed-layout HTML forms by default. If this parameter is set to True PDF Alchemist will instead convert PDF forms to reflowable HTML forms. This parameter is currently experimental. reflowForms may generate unwanted results for forms where the appearance of the form is a mix of PDF page elements and PDF form elements.
Defaults to False to emit fixed-layout HTML forms.
|-removeHyphen||Boolean “true” or “false”||By default PDF Alchemist leaves in place hyphens that end lines in the PDF document. These hyphens are commonly used to divide words at syllables but can also be used for phrases. Set the option “-removeHyphen” to True if you want the product to remove these hyphens in the output file.
Note that this algorithm does not interpret the text involved. It simply removes hyphens wherever they appear. Therefore enabling this option will cause hyphenated phrases that span lines to be combined.
|-singleFile||Boolean “true” or “false”||By default PDF Alchemist outputs separate HTML and CSS files. If set to “True” the PDF to HTML conversion will instead generate a single HTML file with the CSS style information included within that HTML file. Fonts and images will still be emitted as separate files in their respective
Defaults to False. Emit separate files for HTML and CSS information.
|-splitByBookmarkDepth||Positive integer||PDF Alchemist will generate output content in one section that contains all of the generated output.
But you can direct the product to generate output in sections based on the bookmarks (table of contents entries) found in the source PDF document. The number you enter for this setting will determine the levels of the sections to use. If you enter “1” the output file will break the content into sections based on the first level of the table of contents (Heading 1 for example). If you enter “2” the output file will break into two sections (Heading 1 and Heading 2). Enter “3” for three sections levels (Heading 1 Heading 2 and Heading 3).
For HTML defaults to 0, do not split output.
|-splitByEveryNumberofPages||Positive integer||PDF Alchemist will generate output content in one section that contains all of the generated output. Enter a number for this value if you want to split the content into sections based on the page breaks found in the original PDF input document. For example you could enter “3” and PDF Alchemist would take three pages from the PDF input file and put them into a single output file. Then it will take the next three pages from the input PDF document and place them into a second HTML output file. The product would continue to create new sections for the output content (output HTML files) until all of the content in the input PDF document is converted.
Defaults to 0, do not split output.