HTML Executable lets you integrate a stand-alone PDF viewer in your publications and ebooks. Your end users can view and read PDF documents compiled in your publication without the need of Adobe Reader or any other PDF reader.
Using the built-in PDF viewer lets you keep your PDF documents as secure as possible: they are not unpacked to the hard disk, so they cannot be copied by your users.
To enable the built-in PDF viewer, go to Application Settings ⇒ PDF Viewer and turn on: “Use the built-in PDF viewer in this publication”.
If the built-in PDF viewer is not used, the default PDF reader installed on the end user's computer may be used:
In cases you are unable to display PDF documents correctly, add the "_heopenit" target to the anchor tag as shown in the following HTML code:
This will force the publication to open the “mydoc.pdf” file in the default PDF reader.
The built-in PDF engine handles almost all PDF documents fine: PDF files created by popular printer drivers, Adobe Acrobat, Microsoft Office or OpenOffice should be displayed and printed fine. However, PDF files created by imaging and advanced publishing tools may not be properly displayed. If this is the case, printing your PDF document using a printer driver such as PDF Creator may help.
Please keep in mind that the PDF engine is small and it cannot compete with professional reader tools like Adobe Reader. The primary goal of the PDF engine is to display simple documents. Anyway, if you get troubles with a PDF file, you can submit it to our technical support team for review. We do not guarantee however that we can come up with a solution in all cases. However, the defect PDF file may be used to improve the engine.
HTML Executable comes with a sample named “PDF Viewer” that illustrates the following features. You can compile this sample either by going to the “HTML Executable\Samples\PDF Sample” folder on your hard drive, or choose “Samples ⇒ PDF Viewer” when you start HTML Executable.
Thumbnails, bookmarks, text selection, page printing, page navigation, page rotation, zoom in and out functions are available.
Note: you can disable the “page rotation” feature in the Application Settings ⇒ PDF Viewer page. Page rotation is not compatible with text selection.
It is possible to enable the display of the navigation bookmark panel at startup: when the PDF is loaded, its bookmarks are automatically listed. You can disable this feature at any time thanks to the HEShowPDFBookmarks global variable.
Thumbnails are enabled by default. If you want to disable them, enable “Disable Page Thumbnails panel”.
Non-Latin characters are supported.
PDFs are indexed by the search engine like HTML pages and included in search results if you enable “Index content from PDF files with the search engine” option in the Application Settings ⇒ PDF Viewer page. Specific PDF files can be excluded from the search thanks to File Properties - Security. It is possible to index PDF files even if the built-in PDF viewer engine is disabled. In that case, the default PDF reader will be used to display documents when a user clicks a search result.
However, after a search process, results from PDF documents will appear at the end of the list. If you want results from PDF documents to be treated as HTML ones when sorting by relevance, you need to turn this other option on: “Take PDF files into account while sorting search results by relevance”. But note that this will automatically make your publication bigger (more or less depending on the size of your PDFs), since HTML Executable must convert PDF documents to raw text data and store this data into the publication. By default, this option is turned off to keep publications small.
You can link to specific pages by number or named locations:
Security profiles can be applied to PDF documents too: you can restrict access to PDF documents, define user rights like text copying, page printing…
The PDF engine displays the document title (read from PDF metadata) in the title bar and in search results.
Hyperlinks are supported by the PDF viewer. By default, these hyperlinks are highlighted (their background is grey) to inform the user they can be clicked (no hand cursor is displayed because the engine does not handle it). You can prevent this highlighting by checking the “Do not highlight hyperlinks in PDF files” option.
PDF files can be used in the Table of Contents.
You can load external PDF files directly in the publication thanks to the HEScript command named ”LoadPDFFromFile”. Example:
procedure OpenPDFDialog; var Path: String; begin Path := OpenFileDialog("Choose the PDF to open", "*.pdf", "*.pdf", "PDF Files (*.pdf)", ""); if Path = "" then exit; LoadPDFFromFile(Path); end;
When the PDF viewer engine loads a PDF document, it triggers the OnPDFDisplay event. You can then pass commands thanks to the built-in HEScript functions named PDFViewerCommand and PDFViewerCommandStr.
List of available commands (and description / parameter value for PDFViewerCommand)
|54||Select the paper color. Param is a RGB value.|
|141||Choose the renderer for screen display. The default is Param=1 which selects the GDI+ Renderer, Param=0 selects the AGG Renderer. The latter produces better looking letters and better scaled images (antialias), but implements only basic clipping. See code example below.|
|30||Show printer selection and setup dialog. Param = 0|
|32||Show the printer dialog. Param = 0|
|22||Go to the page number specified by Param. The first page has number 0.|
The following script example lets you switch to the AGG renderer (insert it in UserMain)
procedure OnPDFDisplay(PDFPath: String); begin PDFViewerCommand(141, 0); end;