HTML Area

The HtmlArea Page Element renders HTML content within a specified area of the PDF page. The tag supports HTML 4.0.1 and CSS 2.1 specification tags and properties with a few limitations (see below).

HtmlArea

An HtmlArea has numerous constructors that allow inputting the HTML from a steam, text, URL, or a file path.

Example

The following example demonstrates the process for adding content from an HTML file into a specified PDF document's page region.

Document document = new Document();
Uri uri = new Uri(@"c:\\temp\\TestPage.html");
HtmlArea htmlArea = new HtmlArea(uri, 0, 0,500,650);
Page page = new Page();
page.Elements.Add(htmlArea);
document.Pages.Add(page);
document.Draw(pdfFilePath);        
Dim MyDocument As Document= New Document()
Dim MyUri As Uri = New Uri("c:\\temp\\TestPage.html")
Dim MyHtmlArea As HtmlArea = New HtmlArea(MyUri, 0, 0, 500, 650)
Dim MyPage As Page = New Page()
page.Elements.Add(MyHtmlArea)
MyDocument.Pages.Add(MyPage)
MyDocument.Draw(pdfFilePath) 

Refer to the HtmlArea API documentation for a complete example.

HTML & CSS Support

DynamicPDF Core Suite supports the following HTML tags and CSS properties.

HTML Tags CSS
a
address
blockquote
center
div
img
br
hr
h1
h2
h3
h4
h5
h6
p
pre
dd
dl
dt
li
ol
ul
table
b
i
q
u
em
tt
big
del
dfn
ins
kbd
sub
sup
var
abbr
cite
code
font
samp
span
small
s
strike
strong
input
textarea
label
button
fieldset
legend
select
acronym
background
color
text-decoration
letter-spacing
text-align
text-indent
text-transform
word spacing
font
border
margin
padding
height
min-height
max-height
width
min-width
max-width
line-height
position
clip
top
right
bottom
left
z-index
list-style
border-collapse
border-spacing
caption-side
empty-cells
table-layout
clear
display
float
visibility
page-break-after
page-break-before

Character Encoding

The HTML passed to an HtmlArea uses the following character encodings.

Limitations

Supported tags and properties are based on HTML 4.0.1 and CSS 2.1 specifications. Refer to the Product Limitations documentation for a complete listing of limitations.

In this topic