# Wijmo.Printdocument

## Content

<div class="content__tsd">
						<div style="display:flex;justify-content:space-between;align-items:center">
							<h1>
								PrintDocument Class
							</h1>
						</div>
						<section class="tsd-comment">
							<div class="tsd-comment">
								<div class="lead">
									<p>Class that enables the creation of custom documents for printing.</p>
								</div>
								<p>The <a href="wijmo.printdocument.html">PrintDocument</a> class makes it easy to create documents
									for printing or exporting to PDF. Most browsers allow you to select
									the paper size, orientation, margins, and whether to include page
								headers and footers.</p>
								<p>To use, instantiate a <a href="wijmo.printdocument.html">PrintDocument</a>, add content using the
									<a href="wijmo.printdocument.html#append">append</a> method, and finish by calling the <a href="wijmo.printdocument.html#print">print</a>
								method.</p>
								<p>For example:</p>
								<pre><code class="language-typescript"><span class="hljs-keyword">import</span> { PrintDocument } <span class="hljs-keyword">from</span> <span class="hljs-string">'@mescius/wijmo'</span>;

<span class="hljs-comment">// create the document</span>
<span class="hljs-keyword">var</span> doc = <span class="hljs-keyword">new</span> PrintDocument({
  title: <span class="hljs-string">'PrintDocument Test'</span>
});

<span class="hljs-comment">// add some simple text</span>
doc.append(<span class="hljs-string">'&amp;lt;h1&amp;gt;Printing Example&amp;lt;/h1&amp;gt;'</span>);
doc.append(<span class="hljs-string">'&amp;lt;p&amp;gt;This document was created using the &amp;lt;b&amp;gt;PrintDocument&amp;lt;/b&amp;gt; class.&amp;lt;/p&amp;gt;'</span>);

<span class="hljs-comment">// add some existing elements</span>
doc.append(<span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'gaugeControl'</span>));

<span class="hljs-comment">// print the document (or export it to PDF)</span>
doc.print();</code></pre>
								<p>The example below shows how you can create a printer-friendly version of
									a document which can be printed or exported to PDF and other formats
								directly from the browser:</p>
								<p><a href="/wijmo/demos/Core/PrintDocument" target="_blank">Example</a></p>
							</div>
						</section>
						<section class="tsd-hierarchy">
							<h3>Heirarchy</h3>
							<ul class="tsd-hierarchy">
								<li>
									<span class="target">PrintDocument</span>
								</li>
							</ul>
						</section>
						<section class="tsd-index-group">
							<section class="tsd-index-panel">
								<div class="tsd-index-content">
									<section class="tsd-index-section ">
										<div class="title">
											<div class="gc_api_tree-item_icon_img_wrapper">
												<div class="gc_api_tree-item_icon_img" data-expand="true">
												</div>
											</div>
											<h3>
												Constructors
											</h3>
										</div>
										<ul class="tsd-index-list">
											<li class="tsd-kind-constructor tsd-parent-kind-class"><a href="wijmo.printdocument.html#constructor" class="tsd-kind-icon">constructor</a></li>
										</ul>
									</section>
									<section class="tsd-index-section ">
										<div class="title">
											<div class="gc_api_tree-item_icon_img_wrapper">
												<div class="gc_api_tree-item_icon_img" data-expand="true">
												</div>
											</div>
											<h3>
												Properties
											</h3>
										</div>
										<ul class="tsd-index-list">
											<li class="tsd-kind-property tsd-parent-kind-class"><a href="wijmo.printdocument.html#copycss" class="tsd-kind-icon">copy<wbr>Css</a></li>
											<li class="tsd-kind-property tsd-parent-kind-class"><a href="wijmo.printdocument.html#title" class="tsd-kind-icon">title</a></li>
										</ul>
									</section>
									<section class="tsd-index-section ">
										<div class="title">
											<div class="gc_api_tree-item_icon_img_wrapper">
												<div class="gc_api_tree-item_icon_img" data-expand="true">
												</div>
											</div>
											<h3>
												Methods
											</h3>
										</div>
										<ul class="tsd-index-list">
											<li class="tsd-kind-method tsd-parent-kind-class"><a href="wijmo.printdocument.html#addcss" class="tsd-kind-icon">addCSS</a></li>
											<li class="tsd-kind-method tsd-parent-kind-class"><a href="wijmo.printdocument.html#append" class="tsd-kind-icon">append</a></li>
											<li class="tsd-kind-method tsd-parent-kind-class"><a href="wijmo.printdocument.html#print" class="tsd-kind-icon">print</a></li>
										</ul>
									</section>
								</div>
							</section>
						</section>
						<section class="tsd-panel-group tsd-member-group ">
							<h2>Constructors</h2>
							<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class">
								<a name="constructor" class="tsd-anchor"></a>
								<h3>constructor</h3>
								<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class">
									<li class="tsd-signature tsd-kind-icon">new <wbr>Print<wbr>Document<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="wijmo.printdocument.html" class="tsd-signature-type">PrintDocument</a></li>
								</ul>
								<ul class="tsd-descriptions">
									<li class="tsd-description">
										<aside class="tsd-sources">
										</aside>
										<div class="tsd-comment">
											<div class="lead">
												<p>Initializes a new instance of the <a href="wijmo.printdocument.html">PrintDocument</a> class.</p>
											</div>
										</div>
										<h4 class="tsd-parameters-title">Parameters</h4>
										<ul class="tsd-parameters">
											<li>
												<h5><span class="tsd-flag ts-flagOptional">Optional</span> options: <span class="tsd-signature-type">any</span></h5>
												<div class="tsd-comment">
													<div class="lead">
														<p>JavaScript object containing initialization data for the <a href="wijmo.printdocument.html">PrintDocument</a>.</p>
													</div>
												</div>
											</li>
										</ul>
										<h4 class="tsd-returns-title">Returns <a href="wijmo.printdocument.html" class="tsd-signature-type">PrintDocument</a></h4>
									</li>
								</ul>
							</section>
						</section>
						<section class="tsd-panel-group tsd-member-group ">
							<h2>Properties</h2>
							<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
								<a name="copycss" class="tsd-anchor"></a>
								<h3>copyCss</h3>
								<div class="tsd-signature tsd-kind-icon">copy<wbr>Css<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
								<aside class="tsd-sources">
								</aside>
								<div class="tsd-comment">
									<div class="lead">
										<p>Gets or sets a value that determines whether the <a href="wijmo.printdocument.html">PrintDocument</a>
										should include the CSS style sheets defined in the main document.</p>
									</div>
									<p>The default value for the property is <strong>true</strong>.</p>
								</div>
							</section>
							<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
								<a name="title" class="tsd-anchor"></a>
								<h3>title</h3>
								<div class="tsd-signature tsd-kind-icon">title<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
								<aside class="tsd-sources">
								</aside>
								<div class="tsd-comment">
									<div class="lead">
										<p>Gets or sets the document title.</p>
									</div>
									<p>The default value for this property is <strong>null</strong>, which causes the
										<a href="wijmo.printdocument.html">PrintDocument</a> to use the title from the current document's
									<strong>title</strong> tag.</p>
								</div>
							</section>
						</section>
						<section class="tsd-panel-group tsd-member-group ">
							<h2>Methods</h2>
							<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
								<a name="addcss" class="tsd-anchor"></a>
								<h3>addCSS</h3>
								<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
									<li class="tsd-signature tsd-kind-icon">addCSS<span class="tsd-signature-symbol">(</span>href<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
								</ul>
								<ul class="tsd-descriptions">
									<li class="tsd-description">
										<aside class="tsd-sources">
										</aside>
										<div class="tsd-comment">
											<div class="lead">
												<p>Adds a CSS style sheet to the document.</p>
											</div>
										</div>
										<h4 class="tsd-parameters-title">Parameters</h4>
										<ul class="tsd-parameters">
											<li>
												<h5>href: <span class="tsd-signature-type">string</span></h5>
												<div class="tsd-comment">
													<p>URL of the CSS file that should be added to the document.</p>
												</div>
											</li>
										</ul>
										<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
									</li>
								</ul>
							</section>
							<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
								<a name="append" class="tsd-anchor"></a>
								<h3>append</h3>
								<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
									<li class="tsd-signature tsd-kind-icon">append<span class="tsd-signature-symbol">(</span>content<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Element</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
								</ul>
								<ul class="tsd-descriptions">
									<li class="tsd-description">
										<aside class="tsd-sources">
										</aside>
										<div class="tsd-comment">
											<div class="lead">
												<p>Appends an HTML string or an element to the document.</p>
											</div>
										</div>
										<h4 class="tsd-parameters-title">Parameters</h4>
										<ul class="tsd-parameters">
											<li>
												<h5>content: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Element</span></h5>
												<div class="tsd-comment">
													<p>HTML string or Element to append to the document.</p>
												</div>
											</li>
										</ul>
										<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
									</li>
								</ul>
							</section>
							<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
								<a name="print" class="tsd-anchor"></a>
								<h3>print</h3>
								<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
									<li class="tsd-signature tsd-kind-icon">print<span class="tsd-signature-symbol">(</span>callback<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
								</ul>
								<ul class="tsd-descriptions">
									<li class="tsd-description">
										<aside class="tsd-sources">
										</aside>
										<div class="tsd-comment">
											<div class="lead">
												<p>Prints the document.</p>
											</div>
										</div>
										<h4 class="tsd-parameters-title">Parameters</h4>
										<ul class="tsd-parameters">
											<li>
												<h5><span class="tsd-flag ts-flagOptional">Optional</span> callback: <span class="tsd-signature-type">Function</span></h5>
												<div class="tsd-comment">
													<p>Optional callback invoked after the document
													finishes printing.</p>
												</div>
											</li>
										</ul>
										<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
									</li>
								</ul>
							</section>
						</section>
					</div>