OpenPetra
Free Administration Software for Non-Profits
Ict.Common.Printing.TPrinterHtml Class Reference

a class that renders HTML, ie. prints HTML to Screen or PDF More...

Inheritance diagram for Ict.Common.Printing.TPrinterHtml:
Ict.Common.Printing.TPrinterLayout

Public Member Functions

 TPrinterHtml (string AHtmlDocument, string APath, TPrinter APrinter)
 constructor More...
 
 TPrinterHtml (string AHtmlFile, TPrinter APrinter)
 constructor More...
 
override bool GetPageSize (out PaperKind APaperKind, out Margins AMargins, out float AWidthInPoint, out float AHeightInPoint)
 get the page size defined in the css styles of body More...
 
override void StartPrintDocument ()
 todoComment More...
 
override void PrintPageHeader ()
 todoComment More...
 
override void PrintPageBody ()
 print one page of the HTML, one body tag per page??? TODO: or until div with page break? More...
 
override void PrintPageFooter ()
 todoComment More...
 
override float RenderContent (float AXPos, float AWidthAvailable, ref XmlNode curNode)
 interpret HTML code More...
 

Static Public Member Functions

static XmlDocument ParseHtml (string AHtmlDocument)
 try to parse HTML document More...
 
static float Pixel2Inch (Int32 APixel)
 the px value from an HTML document is converted to an inch value for printing More...
 
static string GetTableRow (string ATemplate, string ASearchFor, out string ATemplateRow)
 find the <tr> tag that contains the ASearchFor, and return the full tr tag and contents More...
 
static string GetTableRowByDetailComment (string ATemplate, out string ATemplateRow)
 find section that starts with BEGIN detail comment and ends with END detail comment More...
 
static string GetTitle (string AHtmlMessage)
 returns the title of the html document More...
 
static string RemoveDivWithName (string AHtmlMessage, string ADivName)
 remove a div with the given name More...
 
static string RemoveDivWithClass (string AHtmlMessage, string ADivClass)
 remove all divs of the given class More...
 
static string RemoveElement (string AHtmlMessage, string AElementName, string AAttributeName, string ADivID, out string AElementCode)
 remove all elments with given name or class More...
 

Protected Member Functions

string HtmlToText (string sOrig)
 special codes need to be converted from HTML to printable text More...
 
float PrintTable (float AXPos, float AWidthAvailable, ref XmlNode curNode)
 print an html table More...
 

Protected Attributes

TPrinter FPrinter
 todoComment More...
 
XmlDocument FHtmlDoc
 todoComment More...
 
XmlNode FCurrentNodeNextPage
 todoComment More...
 
string FPath
 path for embedded images More...
 
bool FHasMorePages = false
 local version used for preprinting HTML to discover total number of pages More...
 

Detailed Description

a class that renders HTML, ie. prints HTML to Screen or PDF

Constructor & Destructor Documentation

◆ TPrinterHtml() [1/2]

Ict.Common.Printing.TPrinterHtml.TPrinterHtml ( string  AHtmlDocument,
string  APath,
TPrinter  APrinter 
)
inline

constructor

Parameters
AHtmlDocument
APathUsed for embedding images
APrinter

◆ TPrinterHtml() [2/2]

Ict.Common.Printing.TPrinterHtml.TPrinterHtml ( string  AHtmlFile,
TPrinter  APrinter 
)
inline

constructor

Parameters
AHtmlFile
APrinter

Member Function Documentation

◆ GetPageSize()

override bool Ict.Common.Printing.TPrinterHtml.GetPageSize ( out PaperKind  APaperKind,
out Margins  AMargins,
out float  AWidthInPoint,
out float  AHeightInPoint 
)
inlinevirtual

get the page size defined in the css styles of body

Parameters
APaperKind
AMargins
AWidthInPoint
AHeightInPoint
Returns

Implements Ict.Common.Printing.TPrinterLayout.

◆ GetTableRow()

static string Ict.Common.Printing.TPrinterHtml.GetTableRow ( string  ATemplate,
string  ASearchFor,
out string  ATemplateRow 
)
inlinestatic

find the <tr> tag that contains the ASearchFor, and return the full tr tag and contents

Parameters
ATemplate
ASearchFor
ATemplateRowtemplate for one row
Returns
modified template, replace tr tag with #ROWTEMPLATE

◆ GetTableRowByDetailComment()

static string Ict.Common.Printing.TPrinterHtml.GetTableRowByDetailComment ( string  ATemplate,
out string  ATemplateRow 
)
inlinestatic

find section that starts with BEGIN detail comment and ends with END detail comment

Parameters
ATemplate
ATemplateRowtemplate for one row
Returns
modified template, replace detail block with #ROWTEMPLATE

◆ GetTitle()

static string Ict.Common.Printing.TPrinterHtml.GetTitle ( string  AHtmlMessage)
inlinestatic

returns the title of the html document

Parameters
AHtmlMessage
Returns

◆ HtmlToText()

string Ict.Common.Printing.TPrinterHtml.HtmlToText ( string  sOrig)
inlineprotected

special codes need to be converted from HTML to printable text

Parameters
sOrig
Returns

◆ ParseHtml()

static XmlDocument Ict.Common.Printing.TPrinterHtml.ParseHtml ( string  AHtmlDocument)
inlinestatic

try to parse HTML document

◆ Pixel2Inch()

static float Ict.Common.Printing.TPrinterHtml.Pixel2Inch ( Int32  APixel)
inlinestatic

the px value from an HTML document is converted to an inch value for printing

Parameters
APixel
Returns

◆ PrintPageBody()

override void Ict.Common.Printing.TPrinterHtml.PrintPageBody ( )
inlinevirtual

print one page of the HTML, one body tag per page??? TODO: or until div with page break?

Returns
void

Implements Ict.Common.Printing.TPrinterLayout.

◆ PrintPageFooter()

override void Ict.Common.Printing.TPrinterHtml.PrintPageFooter ( )
inlinevirtual

todoComment

Implements Ict.Common.Printing.TPrinterLayout.

◆ PrintPageHeader()

override void Ict.Common.Printing.TPrinterHtml.PrintPageHeader ( )
inlinevirtual

todoComment

Implements Ict.Common.Printing.TPrinterLayout.

◆ PrintTable()

float Ict.Common.Printing.TPrinterHtml.PrintTable ( float  AXPos,
float  AWidthAvailable,
ref XmlNode  curNode 
)
inlineprotected

print an html table

Returns
the height of the table

◆ RemoveDivWithClass()

static string Ict.Common.Printing.TPrinterHtml.RemoveDivWithClass ( string  AHtmlMessage,
string  ADivClass 
)
inlinestatic

remove all divs of the given class

◆ RemoveDivWithName()

static string Ict.Common.Printing.TPrinterHtml.RemoveDivWithName ( string  AHtmlMessage,
string  ADivName 
)
inlinestatic

remove a div with the given name

Parameters
AHtmlMessage
ADivName
Returns

◆ RemoveElement()

static string Ict.Common.Printing.TPrinterHtml.RemoveElement ( string  AHtmlMessage,
string  AElementName,
string  AAttributeName,
string  ADivID,
out string  AElementCode 
)
inlinestatic

remove all elments with given name or class

◆ RenderContent()

override float Ict.Common.Printing.TPrinterHtml.RenderContent ( float  AXPos,
float  AWidthAvailable,
ref XmlNode  curNode 
)
inlinevirtual

interpret HTML code

Parameters
AXPosthe X position to start the content
AWidthAvailableAWidthAvailable
curNode
Returns
the height of the content

Reimplemented from Ict.Common.Printing.TPrinterLayout.

◆ StartPrintDocument()

override void Ict.Common.Printing.TPrinterHtml.StartPrintDocument ( )
inlinevirtual

todoComment

Implements Ict.Common.Printing.TPrinterLayout.

Member Data Documentation

◆ FCurrentNodeNextPage

XmlNode Ict.Common.Printing.TPrinterHtml.FCurrentNodeNextPage
protected

todoComment

◆ FHasMorePages

bool Ict.Common.Printing.TPrinterHtml.FHasMorePages = false
protected

local version used for preprinting HTML to discover total number of pages

◆ FHtmlDoc

XmlDocument Ict.Common.Printing.TPrinterHtml.FHtmlDoc
protected

todoComment

◆ FPath

string Ict.Common.Printing.TPrinterHtml.FPath
protected

path for embedded images

◆ FPrinter

TPrinter Ict.Common.Printing.TPrinterHtml.FPrinter
protected

todoComment


The documentation for this class was generated from the following file: