get_html_preview_url2( page_num=1, scale_percent=150 )
Generate a simple HTML preview of a single page of the translated PDF.
The preview is not a complete HTML page but just a <div> containing an image plus an image map. The image map contains area definitions for the locations of every paragraph on the page.
This information could be used in a graphical user interface to link paragraphs (whose ID's are given in the XLIFF) to their locations on the page and vice-versa. The second demonstration in main.py includes an example in which each paragraph area is highlighted as the mouse hovers over the page.
Example content of the HTML preview:
width="1216.0635" height="892.914" usemap="#pagerender" alt="" />
<area shape="rect" coords="1172,51,1182,90" alt="38"/>
<area shape="rect" coords="55,28,551,65" alt="37"/>
<area shape="rect" coords="925,365,1098,389" alt="36"/>
<area shape="rect" coords="650,339,880,376" alt="32"/>
<area shape="rect" coords="650,379,899,560" alt="33"/>
The alt tag in each image map area defines the corresponding paragraph ID taken from the XLIFF.
The page number in the original PDF upon which the preview should be based. Page numbers start at 1 which is also the default if the parameter is not supplied.
By default the page is rendered at 150% of its original size (based on PDF resolution of 72dpi). Supply alternative scale factors in order to achieve a zoom functionality.
A 3-tuple of (url, width, height):
The URL for the HTML preview. The preview remains on the transpdf server.
The dimensions of the rendered image generated for the preview.