Printing

From OpenPetra Wiki
Revision as of 06:13, 12 November 2009 by Pokorra (talk | contribs) (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…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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 sounds strange at first, but there seems to be no other option to print HTML with .net System.Drawing.

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?)