Application Settings - PDF Viewer

Applies to HTML Viewer, IE Browser publications.

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.

Displaying PDF documents in your ebook or publication

imgTo enable the built-in PDF viewer, go to Application Settings => PDF Viewer and turn on: "Use the built-in PDF viewer in this publication".

imgIf 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:

<a href="mydoc.pdf" target="_heopenit">Open my PDF document</a>

This will force the publication to open the "mydoc.pdf" file in the default PDF reader.

About the Built-in PDF Viewer

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.

img

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.

Features available with the Built-in PDF Viewer

img

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.

PDF Demo

imgThumbnails, 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.

imgNon-Latin characters are supported.

imgPDFs 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 on a search result.

imgYou can link to specific pages by number or named locations:

  • For a specific page by number: <a href="file.pdf#page=3">Link text</a>
  • For a named location (destination): <a href="file.pdf#nameddest=TOC">Link text</a>

imgSecurity profiles can be applied to PDF documents too: you can restrict access to PDF documents, define user rights like text copying, page printing...

imgThe PDF engine displays the document title (read from PDF metadata) in the title bar and in search results.

imgHyperlinks 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.

imgPDF files can be used in the Table of Contents.

Loading external PDF files with HEScript

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; 

Sending commands to the PDF viewer engine

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)

Command IDDescription
54Select the paper color. Param is a RGB value.
141Choose 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.
30Show printer selection and setup dialog. Param = 0
32Show the printer dialog. Param = 0
22Go 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;
 

About

This is the online documentation of HTML Executable.

About HTML Executable

HTML Executable is a versatile HTML compiler and ebook compiler: it lets you create secure ebooks and desktop applications with your websites, HTML or PDF documents.

You can easily create attractive ebooks, full-featured HTML applications (RIA) and software, digital publications from your websites, PDF files and HTML documents for online or offline distribution.

Learn more - Free Trial