public class HtmlHeaderFooter extends Object implements Cloneable
When using HtmlHeaderFooter it is important to set htmlFragment
Merge meta-data into your html using any of these placeholder strings: {page} {total-pages} {url} {date} {time} {html-title} {pdf-title}
See:PdfDocument.addHtmlHeader(HtmlHeaderFooter)
& PdfDocument.addHtmlFooter(HtmlHeaderFooter)
Constructor and Description |
---|
HtmlHeaderFooter()
Instantiates a new Html header footer.
|
HtmlHeaderFooter(String htmlFragment)
Instantiates a new Html header footer.
|
Modifier and Type | Method and Description |
---|---|
Object |
Clone()
Supports
Cloneable . |
String |
getBaseUrl()
The Base URL all URLS in the
htmlFragment " will be relative to. |
String |
getDividerLineColor()
Gets divider line color code.
|
String |
getHtmlFragment()
The Html which will be used to render the Header / Footer.
|
Integer |
getMaxHeight()
Maximum Height of the Html Header / Footer in millimeters.
|
boolean |
isDrawDividerLine()
A horizontal line divider between the header / footer and the page content on every page of the
PDF document.
|
boolean |
isLoadStylesAndCSSFromMainHtmlDocument()
Loads style code blocks and links to CSS style sheets from the main HTML document (which
provides the PDF content) into the
HtmlHeaderFooter . |
void |
setBaseUrl(String value)
The Base URL all URLS in the
htmlFragment " will be relative to. |
void |
setDividerLineColor(String colorCode)
Sets divider line color.
|
void |
setDrawDividerLine(boolean value)
Adds a horizontal line divider between the header / footer and the page content on every page
of the PDF document.
|
void |
setHtmlFragment(String value)
The Html which will be used to render the Header / Footer.
|
void |
setLoadStylesAndCSSFromMainHtmlDocument(boolean value)
Loads style code blocks and links to CSS style sheets from the main HTML document (which
provides the PDF content) into the
HtmlHeaderFooter . |
void |
setMaxHeight(Integer value)
Maximum Height of the Html Header / Footer in millimeters.
|
public HtmlHeaderFooter()
public HtmlHeaderFooter(String htmlFragment)
htmlFragment
- the html fragmentpublic Integer getMaxHeight()
public void setMaxHeight(Integer value)
value
- the valuepublic boolean isDrawDividerLine()
public void setDrawDividerLine(boolean value)
value
- the valuepublic String getDividerLineColor()
public void setDividerLineColor(String colorCode)
colorCode
- color codepublic String getBaseUrl()
htmlFragment
" will be relative to. This includes 'src'
attributes on images, scripts, style-sheets and also hrefs on hyperlinks. Note: A base URL that points to a directory should end with a slash.
Base URL accepts file paths as well as URLS. If no BaseUrl is given, the HtmlHeaderFooter BaseUrl will be inherited from the main HTML document where possible.
public void setBaseUrl(String value)
htmlFragment
" will be relative to. This includes 'src'
attributes on images, scripts, style-sheets and also hrefs on hyperlinks. Note: A base URL that points to a directory should end with a slash.
Base URL accepts file paths as well as URLS. If no BaseUrl is given, the HtmlHeaderFooter BaseUrl will be inherited from the main HTML document where possible.
value
- the valuepublic String getHtmlFragment()
Merge meta-data into the HtmlFragment by putting any of these placeholder strings into the text: {page} {total-pages} {url} {date} {time} {html-title} {pdf-title}. An alternative mail-merge style using the pattern <span class='total-pages'></span> also work
HtmlFragment is a stand alone HTML document which does not inherit styles or settings from
your
main HTML content unless loadStylesAndCSSFromMainHtmlDocument
is set true
public void setHtmlFragment(String value)
Merge meta-data into the HtmlFragment by putting any of these placeholder strings into the text: {page} {total-pages} {url} {date} {time} {html-title} {pdf-title}. An alternative mail-merge style using the pattern <span class='total-pages'></span> also work
HtmlFragment is a stand alone HTML document which does not inherit styles or settings from
your
main HTML content unless loadStylesAndCSSFromMainHtmlDocument
is set true
value
- the valuepublic boolean isLoadStylesAndCSSFromMainHtmlDocument()
HtmlHeaderFooter
. By default, Html Headers and
Footers are stand- alone HTML documents with their own default styles. Setting
loadStylesAndCSSFromMainHtmlDocument
to true will attempt to load all STYLE and LINK
tags from the main HTML document (which renders teh PDF) into the HtmlHeaderFooter
.
If your main HTML document contains complex CSS frameworks, styles the HEAD or BODY element heavily or loads CSS from javascript then this method may not work as intended.
This feature is not available for RenderUrlAsPdf methods. It works for HTMLToPdf and HtmlFileToPdf conversions only.
It is often preferable to load style sheets explicitly
into your HTML Headers and Footers as STYLE and LINK tags within the htmlFragment
for
granular control
public void setLoadStylesAndCSSFromMainHtmlDocument(boolean value)
HtmlHeaderFooter
. By default, Html Headers and
Footers are stand- alone HTML documents with their own default styles. Setting
loadStylesAndCSSFromMainHtmlDocument
to true will attempt to load all STYLE and LINK
tags from the main HTML document (which renders teh PDF) into the HtmlHeaderFooter
.
If your main HTML document contains complex CSS frameworks, styles the HEAD or BODY element heavily or loads CSS from javascript then this method may not work as intended.
This feature is not available for RenderUrlAsPdf methods. It works for HTMLToPdf and HtmlFileToPdf conversions only.
It is often preferable to load style sheets explicitly
into your HTML Headers and Footers as STYLE and LINK tags within the htmlFragment
for
granular control
value
- the valuepublic Object Clone() throws CloneNotSupportedException
Cloneable
. Creates a deep copy of this class instance.CloneNotSupportedException
- the clone not supported exceptionCopyright © 2022–2023 Iron Software. All rights reserved.