Basics
 
     

HTML and PDF are fundamentally different. HTML was designed to specify the meaning of document content and leave the precise rendering and layout up to the browser. PDF was designed to specify the appearance of a document and ignore the meaning of the document content.

HTML is being changed to allow greater control over the appearance of a document and PDF is being changed to allow the meaning of a document to be better represented. However the fact that the two specifications are based on diametrically opposed concepts does mean that it can be difficult to convert between the two.

ABCpdf uses the Microsoft Internet Explorer HTML rendering engine to convert HTML to a vector form suitable for insertion into your PDF. This provides an extremely accurate rendition of the HTML.

However this method is not suitable for every situation. Interaction with the rendering engine is only available via COM and while ABCpdf takes great care to isolate itself from COM dependencies, rendering a page of HTML is not as fast as building an equivalent page using native ABCpdf rendering methods.

Additionally certain information is not easily available. In particular, images have to be re-compressed and this can mean that your PDFs are rather larger than the source HTML documents. Also links are displayed correctly but are inactive - essentially the source HTML page is converted into a non-interactive image.

 

   
URLs
 
       
 

You can add HTML to your document using the AddImage method. You can either specify a URL or you can provide raw HTML.

URLs are identified by the presence of a protocol specifier. For example:

file://c:\mydocument.htm
http://www.websupergoo.com/

HTML is identified by the fact that the first character in the string is an open angle bracket. For example:

<html>This is some rather basic</html>

Note that you cannot specify local HTML files directly. You must preceed them with a 'file://' protocol specifier so that they can be recognized as URLs.

 

   
Method
 
       
 

The AddImage method renders your document at screen resolution (72 dpi) so that images appear at the optimum size for online viewing. If you want to shrink or enlarge HTML images you can use a Transform to do so.

HTML documents do not have a predefined width and height. The width of an HTML document varies as the client resizes the browser. How far the content flows down the page is dependent on the width of the page.

The width and height of the Doc.Rect are used to determine the width and height at which the HTML should be rendered. It is exactly as if you were displaying your HTML in a browser window of exactly the same size as the Rect.

If the width of the Rect is zero then it will default to a size which shows all the available content without needing to scroll from left to right. If the Rect height is zero then it will default to a size which shows all the available content without needing to scroll up and down.

You can use these defaults to ensure that all your HTML content is visible. Note that - as with all image placement - HTML images are positioned with their bottom left corner at the location specified by the Rect.

 

 

   

 

Browser Based Help. Published by chm2web software.