Printing: Difference between revisions

From OpenPetra Wiki
Jump to navigation Jump to search
(Created page with '= Printing from HTML template = The idea is that form letters and other reports should be easily adjustable. To achieve this goal, we had to write our own HTML printer, which so…')
 
Tag: Replaced
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
The idea is that form letters and other reports should be easily adjustable.
The idea is that form letters and other reports should be easily adjustable.


To achieve this goal, we had to write our own HTML printer, which sounds strange at first, but there seems to be no other option to print HTML with .net System.Drawing.
To achieve this goal, we are now using [https://wkhtmltopdf.org/ wkhtmltopdf].
 
== Testing project ==
Please see the testing project Tests.Common.Printing in solution Testing.sln; this project comes with a sample HTML file, and an editor for the HTML file, and the preview screen for the print result, with comparison to display in an HTML browser.
 
== Features ==
Obviously, not all features of HTML could be implemented.
 
Generally, we limit ourselves to XHTML, which makes it easier to parse the document.
 
We support:
*tables: table, th, tr, td, tbody, colgroup, col width.  
** Tables are automatically split across pages, and the line with th elements is repeated each time.
** td: align with values right or left or center
** td: nowrap="nowrap" avoids wrapping of lines
*special div with class PageHeader: this is repeated for each page
** #PAGENR and #PAGETOTAL in the HTML text will be replaced automatically with appropriate numbers
*font size: change the relative size
*b: bold text
*page margins:
** currently only supported: <body style="margin-left:0px, margin-right:0px"
** without this, a default margin for normal letters is used (approx 2cm margin?)

Latest revision as of 21:02, 11 Mayıs 2022

Printing from HTML template

The idea is that form letters and other reports should be easily adjustable.

To achieve this goal, we are now using wkhtmltopdf.