Update to 0.17.0
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Accessibility</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a class="selected" href="/docs/accessibility.html">Accessibility</a><ul><li><a href="#marked_content">Marked Content</a></li><li><a href="#marked_content_options">Marked Content Options</a></li><li><a href="#logical_structure">Logical Structure</a></li><li><a href="#automatic_ending_of_structure_content_and_artifacts">Automatic Ending of Structure Content and Artifacts</a></li><li><a href="#complex_structure">Complex Structure</a></li><li><a href="#incremental_construction_of_structure">Incremental Construction of Structure</a></li><li><a href="#shortcut_for_elements_containing_only_marked_content">Shortcut for Elements Containing Only Marked Content</a></li><li><a href="#structure_element_options">Structure Element Options</a></li><li><a href="#automatic_marking_and_structure_construction_for_text">Automatic Marking and Structure Construction for Text</a></li><li><a href="#tags_and_structure_element_types">Tags and Structure Element Types</a></li></ul></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="accessibility">Accessibility</h1>
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Accessibility</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a class="selected" href="/docs/accessibility.html">Accessibility</a><ul><li><a href="#marked_content">Marked Content</a></li><li><a href="#marked_content_options">Marked Content Options</a></li><li><a href="#logical_structure">Logical Structure</a></li><li><a href="#automatic_ending_of_structure_content_and_artifacts">Automatic Ending of Structure Content and Artifacts</a></li><li><a href="#complex_structure">Complex Structure</a></li><li><a href="#incremental_construction_of_structure">Incremental Construction of Structure</a></li><li><a href="#shortcut_for_elements_containing_only_marked_content">Shortcut for Elements Containing Only Marked Content</a></li><li><a href="#structure_element_options">Structure Element Options</a></li><li><a href="#automatic_marking_and_structure_construction_for_text">Automatic Marking and Structure Construction for Text</a></li><li><a href="#tags_and_structure_element_types">Tags and Structure Element Types</a></li></ul></li><li><a href="/docs/table.html">Tables </a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="accessibility">Accessibility</h1>
|
||||
|
||||
<p>Accessible PDFs are usable by visually impaired users who rely on
|
||||
screen readers/text-to-speech engines/vocalisation.</p>
|
||||
@ -310,7 +310,7 @@ is not possible for some reason</li><li><code>P</code> - paragraph</li><li><code
|
||||
|
||||
<p>"Illustration" elements (should have <code>alt</code> and/or <code>actualtext</code> set):</p>
|
||||
|
||||
<ul><li><code>Figure</code> - figure</li><li><code>Formula</code> - formula</li><li><code>Form</code> - form widget</li></ul><nav><a class="previous" href="/docs/attachments.html">Previous</a><a class="next" href="/docs/you_made_it.html">Next</a></nav></div><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script src="/docs/js/scroll.js"></script><script src="/docs/js/highlight.pack.js"></script><script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
<ul><li><code>Figure</code> - figure</li><li><code>Formula</code> - formula</li><li><code>Form</code> - form widget</li></ul><nav><a class="previous" href="/docs/attachments.html">Previous</a><a class="next" href="/docs/table.html">Next</a></nav></div><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script src="/docs/js/scroll.js"></script><script src="/docs/js/highlight.pack.js"></script><script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Annotations in PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a class="selected" href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="annotations_in_pdfkit">Annotations in PDFKit</h1>
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Annotations in PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a class="selected" href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/table.html">Tables </a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="annotations_in_pdfkit">Annotations in PDFKit</h1>
|
||||
|
||||
<p>Annotations are interactive features of the PDF format, and they make it
|
||||
possible to include things like links and attached notes, or to highlight,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Attachments in PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a class="selected" href="/docs/attachments.html">Attachments </a><ul><li><a href="#embedded_files">Embedded Files</a></li><li><a href="#file_annotations">File Annotations</a></li></ul></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="attachments_in_pdfkit">Attachments in PDFKit</h1>
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Attachments in PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a class="selected" href="/docs/attachments.html">Attachments </a><ul><li><a href="#embedded_files">Embedded Files</a></li><li><a href="#file_annotations">File Annotations</a></li></ul></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/table.html">Tables </a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="attachments_in_pdfkit">Attachments in PDFKit</h1>
|
||||
|
||||
<h2 id="embedded_files">Embedded Files</h2>
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Destinations</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a class="selected" href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="destinations">Destinations</h1>
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Destinations</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a class="selected" href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/table.html">Tables </a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="destinations">Destinations</h1>
|
||||
|
||||
<p>Anchor may specify a destination by <code>addNamedDestination(name, ...args)</code>, which consists of a page, the location of the display window on that page, and the zoom factor to use when displaying that page.</p>
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Forms in PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a class="selected" href="/docs/forms.html">Forms </a><ul><li><a href="#form_annotation_methods">Form Annotation Methods</a></li><li><a href="#name_parameter">name Parameter</a></li><li><a href="#options_parameter">options Parameter</a></li><li><a href="#common_options">Common Options</a></li><li><a href="#text_field_options">Text Field Options</a></li><li><a href="#combo_and_list_field_options">Combo and List Field Options</a></li><li><a href="#button_field_options">Button Field Options</a></li><li><a href="#text_field_formatting">Text Field Formatting</a></li><li><a href="#date_format">Date format</a></li><li><a href="#time_format">Time format</a></li><li><a href="#number_and_percent_format">Number and percent format</a></li><li><a href="#field_names">Field Names</a></li><li><a href="#advanced_form_field_use">Advanced Form Field Use</a></li><li><a href="#font">Font</a></li><li><a href="#named_javascript">Named JavaScript</a></li><li><a href="#limitations">Limitations</a></li><li><a href="#form_field_appearances">Form Field Appearances</a></li><li><a href="#document_javascript">Document JavaScript</a></li><li><a href="#radio_and_checkboxes">Radio and Checkboxes</a></li></ul></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="forms_in_pdfkit">Forms in PDFKit</h1>
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Forms in PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a class="selected" href="/docs/forms.html">Forms </a><ul><li><a href="#form_annotation_methods">Form Annotation Methods</a></li><li><a href="#name_parameter">name Parameter</a></li><li><a href="#options_parameter">options Parameter</a></li><li><a href="#common_options">Common Options</a></li><li><a href="#text_field_options">Text Field Options</a></li><li><a href="#combo_and_list_field_options">Combo and List Field Options</a></li><li><a href="#button_field_options">Button Field Options</a></li><li><a href="#text_field_formatting">Text Field Formatting</a></li><li><a href="#date_format">Date format</a></li><li><a href="#time_format">Time format</a></li><li><a href="#number_and_percent_format">Number and percent format</a></li><li><a href="#field_names">Field Names</a></li><li><a href="#advanced_form_field_use">Advanced Form Field Use</a></li><li><a href="#font">Font</a></li><li><a href="#named_javascript">Named JavaScript</a></li><li><a href="#limitations">Limitations</a></li><li><a href="#form_field_appearances">Form Field Appearances</a></li><li><a href="#document_javascript">Document JavaScript</a></li><li><a href="#radio_and_checkboxes">Radio and Checkboxes</a></li></ul></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/table.html">Tables </a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="forms_in_pdfkit">Forms in PDFKit</h1>
|
||||
|
||||
<p>Forms are an interactive feature of the PDF format. Forms make it possible to
|
||||
add form annotations such as text fields, combo boxes, buttons and actions.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Getting Started with PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a class="selected" href="/docs/getting_started.html">Getting Started </a><ul><li><a href="#installation">Installation</a></li><li><a href="#creating_a_document">Creating a document</a></li><li><a href="#using_pdfkit_in_the_browser">Using PDFKit in the browser</a></li><li><a href="#adding_pages">Adding pages</a></li><li><a href="#switching_to_previous_pages">Switching to previous pages</a></li><li><a href="#setting_default_font">Setting default font</a></li><li><a href="#setting_document_metadata">Setting document metadata</a></li><li><a href="#encryption_and_access_privileges">Encryption and Access Privileges</a></li><li><a href="#pdf/a">PDF/A</a></li><li><a href="#adding_content">Adding content</a></li></ul></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="getting_started_with_pdfkit">Getting Started with PDFKit</h1>
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Getting Started with PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a class="selected" href="/docs/getting_started.html">Getting Started </a><ul><li><a href="#installation">Installation</a></li><li><a href="#creating_a_document">Creating a document</a></li><li><a href="#using_pdfkit_in_the_browser">Using PDFKit in the browser</a></li><li><a href="#adding_pages">Adding pages</a></li><li><a href="#switching_to_previous_pages">Switching to previous pages</a></li><li><a href="#setting_default_font">Setting default font</a></li><li><a href="#setting_document_metadata">Setting document metadata</a></li><li><a href="#encryption_and_access_privileges">Encryption and Access Privileges</a></li><li><a href="#pdf/a">PDF/A</a></li><li><a href="#adding_content">Adding content</a></li></ul></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/table.html">Tables </a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="getting_started_with_pdfkit">Getting Started with PDFKit</h1>
|
||||
|
||||
<h2 id="installation">Installation</h2>
|
||||
|
||||
@ -101,18 +101,28 @@ default is <code>letter</code>.</p>
|
||||
set the default paper size and layout for every page in the document, which is
|
||||
then overridden by individual options passed to the <code>addPage</code> method.</p>
|
||||
|
||||
<p>You can set the page margins in two ways. The first is by setting the <code>margin</code>
|
||||
property (singular) to a number, which applies that margin to all edges. The
|
||||
other way is to set the <code>margins</code> property (plural) to an object with <code>top</code>,
|
||||
<code>bottom</code>, <code>left</code>, and <code>right</code> values. The default is a 1 inch (72 point) margin
|
||||
<p>You can set the page margins in two ways. The first is by setting the <code>margin</code> / <code>margins</code>
|
||||
property to a single value, which applies that to all edges. The
|
||||
other way is to provide an object with <code>top</code>, <code>right</code>, <code>bottom</code>, and <code>left</code> values.
|
||||
By default, using a number this will be in points (the default PDF unit),
|
||||
however you can provide any of the following units inside a string
|
||||
and this will be converted for you:
|
||||
<code>em</code>, <code>in</code>, <code>px</code>, <code>cm</code>, <code>mm</code>, <code>pc</code>, <code>ex</code>, <code>ch</code>, <code>rem</code>, <code>vw</code>, <code>vmin</code>, <code>vmax</code>, <code>%</code>, <code>pt</code>.
|
||||
For those which are based on text sizes this will take the size of the font for the page
|
||||
(excluding <code>rem</code> which is always the document root font size)
|
||||
The default is a 1 inch (72 point) margin
|
||||
on all sides.</p>
|
||||
|
||||
<p>For example:</p>
|
||||
|
||||
<pre><code>// Add a 50 point margin on all sides
|
||||
doc.addPage({
|
||||
margin: 50});
|
||||
doc.addPage({ margin: 50 });
|
||||
|
||||
// Add a 2 inch margin on all sides
|
||||
doc.addPage({ margin: '2in' });
|
||||
|
||||
// Add a 2em(28pt) margin using the font size
|
||||
doc.addPage({ fontSize: 14, margin: '2em' });
|
||||
|
||||
// Add different margins on each side
|
||||
doc.addPage({
|
||||
|
||||
BIN
docs/guide.pdf
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Images in PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a class="selected" href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="images_in_pdfkit">Images in PDFKit</h1>
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Images in PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a class="selected" href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/table.html">Tables </a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="images_in_pdfkit">Images in PDFKit</h1>
|
||||
|
||||
<p>Adding images to PDFKit documents is an easy task. Just pass an image path, buffer, or data uri with base64 encoded data to
|
||||
the <code>image</code> method along with some optional arguments. PDFKit supports the
|
||||
|
||||
BIN
docs/img/0.png
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
BIN
docs/img/1.png
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
BIN
docs/img/10.png
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
BIN
docs/img/11.png
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
BIN
docs/img/12.png
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
BIN
docs/img/13.png
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
BIN
docs/img/14.png
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
BIN
docs/img/15.png
|
Before Width: | Height: | Size: 799 KiB After Width: | Height: | Size: 799 KiB |
BIN
docs/img/16.png
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
BIN
docs/img/17.png
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
BIN
docs/img/18.png
|
Before Width: | Height: | Size: 419 B After Width: | Height: | Size: 419 B |
BIN
docs/img/19.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
docs/img/2.png
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
docs/img/20.png
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
BIN
docs/img/21.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
docs/img/22.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
docs/img/23.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
docs/img/24.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
docs/img/25.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
docs/img/26.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
docs/img/27.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
docs/img/28.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
docs/img/29.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
docs/img/3.png
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
BIN
docs/img/30.png
Normal file
|
After Width: | Height: | Size: 9.7 KiB |
BIN
docs/img/31.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
docs/img/32.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
docs/img/4.png
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
BIN
docs/img/5.png
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
BIN
docs/img/6.png
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
BIN
docs/img/7.png
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
BIN
docs/img/8.png
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
BIN
docs/img/9.png
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Outlines in PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a class="selected" href="/docs/outline.html">Outlines </a><ul><li><a href="#options">Options</a></li></ul></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="outlines_in_pdfkit">Outlines in PDFKit</h1>
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Outlines in PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a class="selected" href="/docs/outline.html">Outlines </a><ul><li><a href="#options">Options</a></li></ul></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/table.html">Tables </a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="outlines_in_pdfkit">Outlines in PDFKit</h1>
|
||||
|
||||
<p>Outlines are the heirachical bookmarks that display in some PDF readers. Currently only page bookmarks are supported, but more may be added in the future. They are simple to add and only require a single method:</p>
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Paper Sizes</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a class="selected" href="/docs/paper_sizes.html">Paper Sizes</a><ul><li><a href="#predefined_page_sizes">Predefined Page Sizes</a></li><li><a href="#a-series">A-series</a></li><li><a href="#b-series">B-series</a></li><li><a href="#c-series">C-series</a></li><li><a href="#ra-series">RA-series</a></li><li><a href="#sra-series">SRA-series</a></li><li><a href="#setting_the_page_size">Setting the page size</a></li></ul></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="paper_sizes">Paper Sizes</h1>
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Paper Sizes</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a class="selected" href="/docs/paper_sizes.html">Paper Sizes</a><ul><li><a href="#predefined_page_sizes">Predefined Page Sizes</a></li><li><a href="#a-series">A-series</a></li><li><a href="#b-series">B-series</a></li><li><a href="#c-series">C-series</a></li><li><a href="#ra-series">RA-series</a></li><li><a href="#sra-series">SRA-series</a></li><li><a href="#setting_the_page_size">Setting the page size</a></li></ul></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/table.html">Tables </a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="paper_sizes">Paper Sizes</h1>
|
||||
|
||||
<p>When creating a new document or adding a new page to your current document, PDFKit allows you to set the page dimensions. To improve convenience, PDFKit has a number of predefined page sizes. These sizes are based on the most commonly used standard page sizes. </p>
|
||||
|
||||
|
||||
354
docs/table.html
Normal file
@ -0,0 +1,354 @@
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Tables in PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a class="selected" href="/docs/table.html">Tables </a><ul><li><a href="#the_basics">The basics</a></li><li><a href="#a_simple_table">A simple table</a></li><li><a href="#defining_column_widths">Defining column widths</a></li><li><a href="#defining_row_heights">Defining row heights</a></li><li><a href="#column/row_spans">Column/row spans</a></li><li><a href="#styling">Styling</a></li><li><a href="#optional_border">Optional border</a></li><li><a href="#table_options">Table options</a></li><li><a href="#cell_options">Cell options</a></li><li><a href="#column_options">Column options</a></li><li><a href="#row_options">Row options</a></li></ul></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="tables_in_pdfkit">Tables in PDFKit</h1>
|
||||
|
||||
<h2 id="the_basics">The basics</h2>
|
||||
|
||||
<p>PDFKit makes adding tables to documents quite simple, and includes many options
|
||||
to customize the display of the output.</p>
|
||||
|
||||
<h2 id="a_simple_table">A simple table</h2>
|
||||
|
||||
<p>Basic tables can be defined without configuration:</p>
|
||||
|
||||
<pre><code>doc.table({
|
||||
data: [
|
||||
['Column 1', 'Column 2', 'Column 3'],
|
||||
['One value goes here', 'Another one here', 'OK?']
|
||||
]
|
||||
})</code></pre>
|
||||
|
||||
<p>or the more verbose way</p>
|
||||
|
||||
<pre><code>doc.table()
|
||||
.row(['Column 1', 'Column 2', 'Column 3'])
|
||||
.row(['One value goes here', 'Another one here', 'OK?'])</code></pre>
|
||||
|
||||
<p><img src="img/19.png"/></p>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h2 id="defining_column_widths">Defining column widths</h2>
|
||||
|
||||
<p>Tables allow you to define the widths of columns:</p>
|
||||
|
||||
<ul><li><code>*</code> - distributes equally, filling the whole available space (default)</li><li><code>fixed value</code> - a fixed width based on the document content</li></ul>
|
||||
|
||||
<p>Example:</p>
|
||||
|
||||
<pre><code>doc.table({
|
||||
columnStyles: [100, "*", 200, "*"],
|
||||
data: [
|
||||
["width=100", "star-sized", "width=200", "star-sized"],
|
||||
[
|
||||
"fixed-width cells have exactly the specified width",
|
||||
{ text: "nothing interesting here", textColor: "grey" },
|
||||
{ text: "nothing interesting here", textColor: "grey" },
|
||||
{ text: "nothing interesting here", textColor: "grey" }
|
||||
],
|
||||
],
|
||||
});</code></pre>
|
||||
|
||||
<p><img src="img/20.png"/></p>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h2 id="defining_row_heights">Defining row heights</h2>
|
||||
|
||||
<pre><code>doc.table({
|
||||
rowStyles: [20, 50, 70],
|
||||
data: [
|
||||
["row 1 with height 20", "column B"],
|
||||
["row 2 with height 50", "column B"],
|
||||
["row 3 with height 70", "column B"],
|
||||
],
|
||||
});</code></pre>
|
||||
|
||||
<p><img src="img/21.png"/></p>
|
||||
|
||||
<p>With same height:</p>
|
||||
|
||||
<pre><code>doc.table({
|
||||
rowStyles: 40,
|
||||
data: [
|
||||
["row 1", "column B"],
|
||||
["row 2", "column B"],
|
||||
["row 3", "column B"],
|
||||
],
|
||||
});</code></pre>
|
||||
|
||||
<p><img src="img/22.png"/></p>
|
||||
|
||||
<hr/>
|
||||
|
||||
<p>With height from function:</p>
|
||||
|
||||
<pre><code>doc.table({
|
||||
rowStyles: (row) => (row + 1) * 25,
|
||||
data: [
|
||||
["row 1", "column B"],
|
||||
["row 2", "column B"],
|
||||
["row 3", "column B"],
|
||||
],
|
||||
});</code></pre>
|
||||
|
||||
<p><img src="img/23.png"/></p>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h2 id="column/row_spans">Column/row spans</h2>
|
||||
|
||||
<p>Each cell can set a rowSpan or colSpan</p>
|
||||
|
||||
<pre><code>doc.table({
|
||||
columnStyles: [200, "*", "*"],
|
||||
data: [
|
||||
[{ colSpan: 2, text: "Header with Colspan = 2" }, "Header 3"],
|
||||
["Header 1", "Header 2", "Header 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
[
|
||||
{
|
||||
rowSpan: 3,
|
||||
text: "rowspan set to 3\nLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor",
|
||||
},
|
||||
"Sample value 2",
|
||||
"Sample value 3",
|
||||
],
|
||||
["Sample value 2", "Sample value 3"],
|
||||
["Sample value 2", "Sample value 3"],
|
||||
[
|
||||
"Sample value 1",
|
||||
{
|
||||
colSpan: 2,
|
||||
rowSpan: 2,
|
||||
text: "Both:\nrowspan and colspan\ncan be defined at the same time",
|
||||
},
|
||||
],
|
||||
["Sample value 1"],
|
||||
],
|
||||
})</code></pre>
|
||||
|
||||
<p><img src="img/24.png"/></p>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h2 id="styling">Styling</h2>
|
||||
|
||||
<p>No borders:</p>
|
||||
|
||||
<pre><code>doc.table({
|
||||
rowStyles: { border: false },
|
||||
data: [
|
||||
["Header 1", "Header 2", "Header 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
],
|
||||
})</code></pre>
|
||||
|
||||
<p><img src="img/25.png"/></p>
|
||||
|
||||
<p>Header line only:</p>
|
||||
|
||||
<pre><code>doc.table({
|
||||
rowStyles: (i) => {
|
||||
return i < 1 ? { border: [0, 0, 1, 0] } : { border: false };
|
||||
},
|
||||
data: [
|
||||
["Header 1", "Header 2", "Header 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
],
|
||||
})</code></pre>
|
||||
|
||||
<p><img src="img/26.png"/></p>
|
||||
|
||||
<hr/>
|
||||
|
||||
<p>Light Horizontal lines:</p>
|
||||
|
||||
<pre><code>doc.table({
|
||||
rowStyles: (i) => {
|
||||
return i < 1
|
||||
? { border: [0, 0, 2, 0], borderColor: "black" }
|
||||
: { border: [0, 0, 1, 0], borderColor: "#aaa" };
|
||||
},
|
||||
data: [
|
||||
["Header 1", "Header 2", "Header 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
],
|
||||
})</code></pre>
|
||||
|
||||
<p><img src="img/27.png"/></p>
|
||||
|
||||
<hr/>
|
||||
|
||||
<p>But you can provide a custom styler as well</p>
|
||||
|
||||
<pre><code>doc.table({
|
||||
// Set the style for all cells
|
||||
defaultStyle: { border: 1, borderColor: "gray" },
|
||||
// Set the style for cells based on their column
|
||||
columnStyles: (i) => {
|
||||
if (i === 0) return { border: { left: 2 }, borderColor: { left: "black" } };
|
||||
if (i === 2) return { border: { right: 2 }, borderColor: { right: "black" } };
|
||||
},
|
||||
// Set the style for cells based on their row
|
||||
rowStyles: (i) => {
|
||||
if (i === 0) return { border: { top: 2 }, borderColor: { top: "black" } };
|
||||
if (i === 3) return { border: { bottom: 2 }, borderColor: { bottom: "black" } };
|
||||
},
|
||||
data: [
|
||||
["Header 1", "Header 2", "Header 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
],
|
||||
})</code></pre>
|
||||
|
||||
<p><img src="img/28.png"/></p>
|
||||
|
||||
<hr/>
|
||||
|
||||
<p>Zebra style</p>
|
||||
|
||||
<pre><code>doc.table({
|
||||
rowStyles: (i) => {
|
||||
if (i % 2 === 0) return { backgroundColor: "#ccc" };
|
||||
},
|
||||
data: [
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
["Sample value 1", "Sample value 2", "Sample value 3"],
|
||||
],
|
||||
})</code></pre>
|
||||
|
||||
<p><img src="img/29.png"/></p>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h2 id="optional_border">Optional border</h2>
|
||||
|
||||
<pre><code>doc.table({
|
||||
data: [
|
||||
[
|
||||
{ border: [true, false, false, false], backgroundColor: "#eee", text: "border:\n[true, false, false, false]" },
|
||||
{ border: false, backgroundColor: "#ddd", text: "border:\nfalse" },
|
||||
{ border: true, backgroundColor: "#eee", text: "border:\ntrue" },
|
||||
],
|
||||
[
|
||||
{ rowSpan: 3, border: true, backgroundColor: "#eef", text: "rowSpan: 3\n\nborder:\ntrue" },
|
||||
{ border: undefined, backgroundColor: "#eee", text: "border:\nundefined (default)" },
|
||||
{ border: [false, false, false, true], backgroundColor: "#ddd", text: "border:\n[false, false, false, true]" },
|
||||
],
|
||||
[
|
||||
{ colSpan: 2, border: true, backgroundColor: "#efe", text: "colSpan: 2\n\nborder:\ntrue" },
|
||||
],
|
||||
[
|
||||
{ border: 0, backgroundColor: "#eee", text: "border:\n0 (same as false)" },
|
||||
{ border: [false, true, true, false], backgroundColor: "#ddd", text: "border:\n[false, true, true, false]" },
|
||||
],
|
||||
],
|
||||
})</code></pre>
|
||||
|
||||
<p><img src="img/30.png"/></p>
|
||||
|
||||
<hr/>
|
||||
|
||||
<pre><code>doc.table({
|
||||
defaultStyle: { border: false, width: 60 },
|
||||
data: [
|
||||
["", "column 1", "column 2", "column 3"],
|
||||
[
|
||||
"row 1",
|
||||
{
|
||||
rowSpan: 3,
|
||||
colSpan: 3,
|
||||
border: true,
|
||||
backgroundColor: "#ccc",
|
||||
text: "rowSpan: 3\ncolSpan: 3\n\nborder:\n[true, true, true, true]",
|
||||
},
|
||||
],
|
||||
["row 2"],
|
||||
["row 3"],
|
||||
],
|
||||
})</code></pre>
|
||||
|
||||
<p><img src="img/31.png"/></p>
|
||||
|
||||
<hr/>
|
||||
|
||||
<p>When defining multiple styles, the cells follow the precedence:</p>
|
||||
|
||||
<ol><li><code>defaultStyle</code></li><li><code>columnStyles</code></li><li><code>rowStyles</code></li><li><code>cellStyle</code></li></ol>
|
||||
|
||||
<p>so if a table was:</p>
|
||||
|
||||
<pre><code>doc.table({
|
||||
defaultStyle: { border: 1 },
|
||||
columnStyles: { border: { right: 2 } },
|
||||
rowStyles: { border: { bottom: 3 } },
|
||||
data: [
|
||||
[{ border: { left: 4 } }]
|
||||
]
|
||||
})</code></pre>
|
||||
|
||||
<p>The resulting cell would have a style of:</p>
|
||||
|
||||
<pre><code>{
|
||||
border: {
|
||||
top: 1, // From the default
|
||||
right: 2, // From the column
|
||||
bottom: 3, // From the row
|
||||
left: 4 // From the cell
|
||||
}
|
||||
}</code></pre>
|
||||
|
||||
<p>Internally, PDFKit keeps track of the current X and Y position of table as it
|
||||
is added to the document. This way, any calls to <code>text</code> or <code>table</code> will be placed below the table row.</p>
|
||||
|
||||
<pre><code>doc
|
||||
.text('before')
|
||||
.table({
|
||||
data: [
|
||||
['Column 1', 'Column 2', 'Column 3'],
|
||||
['One value goes here', 'Another one here', 'OK?']
|
||||
]
|
||||
})
|
||||
.text('after')</code></pre>
|
||||
|
||||
<p><img src="img/32.png"/></p>
|
||||
|
||||
<h2 id="table_options">Table options</h2>
|
||||
|
||||
<ul><li><code>position</code> - The position of the table (default <code>{x: doc.x, y: doc.y}</code>)</li><li><code>maxWidth</code> - The maximum width the table can expand to (defaults to the remaining content width (offset from the tables position))</li><li><code>columnStyles</code> - Column definitions of the table. (default <code>auto</code>)</li><li><code>rowStyles</code> - Row definitions of the table. (default <code>*</code>)</li><li><code>defaultStyle</code> - Defaults to apply to every cell</li><li><code>data</code> - The data to render (not required, you can call <code>.row()</code>). This can be an iterable (async or sync)</li><li><code>debug</code> - Whether to show the debug lines for all the cells (default <code>false</code>)</li></ul>
|
||||
|
||||
<h2 id="cell_options">Cell options</h2>
|
||||
|
||||
<ul><li><code>text</code> - The value, will be cast to a string (<code>null</code> and <code>undefined</code> are not rendered but the cell is still outlined)</li><li><code>rowSpan</code> - How many rows this cell covers, follows the same logic as HTML <code>rowspan</code></li><li><code>colSpan</code> - How many columns this cell covers, follows the same logic as HTML <code>colspan</code></li><li><code>padding</code> - The padding for the cell (default <code>0.25em</code>)</li><li><code>border</code> - The border for the cell (default <code>1pt</code>)</li><li><code>borderColor</code> - The border colors for the cell (default <code>black</code>)</li><li><code>font</code> - Font options for the cell</li><li><code>backgroundColor</code> - Set the background color of the cell</li><li><code>align</code> - The alignment of the cell text (default <code>{x: 'left', y: 'top'}</code>)</li><li><code>textStroke</code> - The text stroke (default <code>0</code>)</li><li><code>textStrokeColor</code> - Sets the text stroke color of the cells text (default <code>black</code>)</li><li><code>textColor</code> - Sets the text color of the cells text (default <code>black</code>)</li><li><code>type</code> - Sets the cell type (for accessibility) (default <code>TD</code>)</li><li><code>textOptions</code> - Sets any text options you wish to provide (such as rotation)</li><li><code>debug</code> - Whether to show the debug lines for the cell (default <code>false</code>)</li></ul>
|
||||
|
||||
<h2 id="column_options">Column options</h2>
|
||||
|
||||
<p>Extends the <a href="#cell-options">cell options</a> above with:</p>
|
||||
|
||||
<ul><li><code>width</code> - The width of the column (default <code>*</code>)</li><li><code>minWidth</code> - The minimum width of the column (default <code>0</code>)</li><li><code>maxWidth</code> - The maximum width of the column (default <code>Infinity</code>)</li></ul>
|
||||
|
||||
<h2 id="row_options">Row options</h2>
|
||||
|
||||
<p>Extends the <a href="#cell-options">cell options</a> above with:</p>
|
||||
|
||||
<ul><li><code>height</code> - The height of the row (default <code>auto</code>)</li><li><code>minHeight</code> - The minimum height of the row (default <code>0</code>)</li><li><code>maxHeight</code> - The maximum height of the row (default <code>Infinity</code>)</li></ul><nav><a class="previous" href="/docs/accessibility.html">Previous</a><a class="next" href="/docs/you_made_it.html">Next</a></nav></div><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script src="/docs/js/scroll.js"></script><script src="/docs/js/highlight.pack.js"></script><script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
ga('create', 'UA-48340245-1', 'pdfkit.org');
|
||||
ga('send', 'pageview');</script></body></html>
|
||||
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Text in PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a class="selected" href="/docs/text.html">Text </a><ul><li><a href="#the_basics">The basics</a></li><li><a href="#line_wrapping_and_justification">Line wrapping and justification</a></li><li><a href="#text_styling">Text styling</a></li><li><a href="#text_measurements">Text measurements</a></li><li><a href="#lists">Lists</a></li><li><a href="#rich_text">Rich Text</a></li><li><a href="#fonts">Fonts</a></li></ul></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="text_in_pdfkit">Text in PDFKit</h1>
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Text in PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a class="selected" href="/docs/text.html">Text </a><ul><li><a href="#the_basics">The basics</a></li><li><a href="#line_wrapping_and_justification">Line wrapping and justification</a></li><li><a href="#text_styling">Text styling</a></li><li><a href="#text_measurements">Text measurements</a></li><li><a href="#lists">Lists</a></li><li><a href="#rich_text">Rich Text</a></li><li><a href="#fonts">Fonts</a></li></ul></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/table.html">Tables </a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="text_in_pdfkit">Text in PDFKit</h1>
|
||||
|
||||
<h2 id="the_basics">The basics</h2>
|
||||
|
||||
@ -82,7 +82,7 @@ doc.rect(doc.x, 0, 410, doc.y).stroke();</code></pre>
|
||||
documents, which can be passed to the <code>text</code> method. They are enumerated
|
||||
below.</p>
|
||||
|
||||
<ul><li><code>lineBreak</code> - set to <code>false</code> to disable line wrapping all together</li><li><code>width</code> - the width that text should be wrapped to (by default, the page width minus the left and right margin)</li><li><code>height</code> - the maximum height that text should be clipped to</li><li><code>ellipsis</code> - the character to display at the end of the text when it is too long. Set to <code>true</code> to use the default character.</li><li><code>columns</code> - the number of columns to flow the text into</li><li><code>columnGap</code> - the amount of space between each column (1/4 inch by default)</li><li><code>indent</code> - the amount in PDF points (72 per inch) to indent each paragraph of text</li><li><code>indentAllLines</code> - wheter to indent all lines of a paragraph (<code>false</code> by default - indents only the first line)</li><li><code>paragraphGap</code> - the amount of space between each paragraph of text</li><li><code>lineGap</code> - the amount of space between each line of text</li><li><code>wordSpacing</code> - the amount of space between each word in the text</li><li><code>characterSpacing</code> - the amount of space between each character in the text</li><li><code>horizontalScaling</code> - ability to scale text horizontally (<code>100</code> percent by default)</li><li><code>fill</code> - whether to fill the text (<code>true</code> by default)</li><li><code>stroke</code> - whether to stroke the text</li><li><code>link</code> - a URL to link this text to (shortcut to create an annotation)</li><li><code>goTo</code> - go to anchor (shortcut to create an annotation)</li><li><code>destination</code> - create anchor to this text</li><li><code>underline</code> - whether to underline the text</li><li><code>strike</code> - whether to strike out the text</li><li><code>oblique</code> - whether to slant the text (angle in degrees or <code>true</code>)</li><li><code>baseline</code> - the vertical alignment of the text with respect to its insertion point (values as <a href="https://www.w3schools.com/tags/canvas_textbaseline.asp">canvas textBaseline</a>)</li><li><code>continued</code> - whether the text segment will be followed immediately by another segment. Useful for changing styling in the middle of a paragraph.</li><li><code>features</code> - an array of <a href="https://www.microsoft.com/typography/otspec/featuretags.htm">OpenType feature tags</a> to apply. If not provided, a set of defaults is used.</li></ul>
|
||||
<ul><li><code>lineBreak</code> - set to <code>false</code> to disable line wrapping all together</li><li><code>width</code> - the width that text should be wrapped to (by default, the page width minus the left and right margin)</li><li><code>height</code> - the maximum height that text should be clipped to</li><li><code>rotation</code> - the rotation of the text in degrees (by default 0)</li><li><code>ellipsis</code> - the character to display at the end of the text when it is too long. Set to <code>true</code> to use the default character.</li><li><code>columns</code> - the number of columns to flow the text into</li><li><code>columnGap</code> - the amount of space between each column (1/4 inch by default)</li><li><code>indent</code> - the amount in PDF points (72 per inch) to indent each paragraph of text</li><li><code>indentAllLines</code> - wheter to indent all lines of a paragraph (<code>false</code> by default - indents only the first line)</li><li><code>paragraphGap</code> - the amount of space between each paragraph of text</li><li><code>lineGap</code> - the amount of space between each line of text</li><li><code>wordSpacing</code> - the amount of space between each word in the text</li><li><code>characterSpacing</code> - the amount of space between each character in the text</li><li><code>horizontalScaling</code> - ability to scale text horizontally (<code>100</code> percent by default)</li><li><code>fill</code> - whether to fill the text (<code>true</code> by default)</li><li><code>stroke</code> - whether to stroke the text</li><li><code>link</code> - a URL to link this text to (shortcut to create an annotation)</li><li><code>goTo</code> - go to anchor (shortcut to create an annotation)</li><li><code>destination</code> - create anchor to this text</li><li><code>underline</code> - whether to underline the text</li><li><code>strike</code> - whether to strike out the text</li><li><code>oblique</code> - whether to slant the text (angle in degrees or <code>true</code>)</li><li><code>baseline</code> - the vertical alignment of the text with respect to its insertion point (values as <a href="https://www.w3schools.com/tags/canvas_textbaseline.asp">canvas textBaseline</a>)</li><li><code>continued</code> - whether the text segment will be followed immediately by another segment. Useful for changing styling in the middle of a paragraph.</li><li><code>features</code> - an array of <a href="https://www.microsoft.com/typography/otspec/featuretags.htm">OpenType feature tags</a> to apply. Can also be provided as an object with features as keys and boolean values. If not provided, a set of defaults is used. To deactivate default font features, you have to explicitly set them to false (<code>{ liga: false }</code>). When providing an empty array the default font features will still be used.</li></ul>
|
||||
|
||||
<p>Additionally, the fill and stroke color and opacity methods described in the
|
||||
<a href="vector.html">vector graphics section</a> are applied to text content as well.</p>
|
||||
@ -108,10 +108,14 @@ doc.text(lorem, {
|
||||
<h2 id="text_measurements">Text measurements</h2>
|
||||
|
||||
<p>If you're working with documents that require precise layout, you may need to know the
|
||||
size of a piece of text. PDFKit has two methods to achieve this: <code>widthOfString(text, options)</code>
|
||||
and <code>heightOfString(text, options)</code>. Both methods use the same options described in the
|
||||
size of a piece of text. PDFKit has three methods to achieve this: <code>widthOfString(text, options)</code>
|
||||
, <code>heightOfString(text, options)</code> and <code>boundsOfString(text, options)/boundsOfString(text, x, y, options)</code>. All methods use the same options described in the
|
||||
Text styling section, and take into account the eventual line wrapping.</p>
|
||||
|
||||
<p>However <code>boundsOfString</code> factors in text rotations and multi-line wrapped text,
|
||||
effectively producing the bounding box of the text, <code>{x: number, y: number, width: number, height: number}</code>.
|
||||
If <code>x</code> and <code>y</code> are not defined they will default to use <code>this.x</code> and <code>this.y</code>.</p>
|
||||
|
||||
<h2 id="lists">Lists</h2>
|
||||
|
||||
<p>The <code>list</code> method creates a bulleted list. It accepts as arguments an array of strings,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Vector Graphics in PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a class="selected" href="/docs/vector.html">Vector Graphics </a><ul><li><a href="#an_introduction_to_vector_graphics">An introduction to vector graphics</a></li><li><a href="#creating_basic_shapes">Creating basic shapes</a></li><li><a href="#svg_paths">SVG paths</a></li><li><a href="#shape_helpers">Shape helpers</a></li><li><a href="#fill_and_stroke_styles">Fill and stroke styles</a></li><li><a href="#line_cap_and_line_join">Line cap and line join</a></li><li><a href="#dashed_lines">Dashed lines</a></li><li><a href="#color">Color</a></li><li><a href="#gradients">Gradients</a></li><li><a href="#winding_rules">Winding rules</a></li><li><a href="#saving_and_restoring_the_graphics_stack">Saving and restoring the graphics stack</a></li><li><a href="#transformations">Transformations</a></li><li><a href="#clipping">Clipping</a></li></ul></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="vector_graphics_in_pdfkit">Vector Graphics in PDFKit</h1>
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Vector Graphics in PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a class="selected" href="/docs/vector.html">Vector Graphics </a><ul><li><a href="#an_introduction_to_vector_graphics">An introduction to vector graphics</a></li><li><a href="#creating_basic_shapes">Creating basic shapes</a></li><li><a href="#svg_paths">SVG paths</a></li><li><a href="#shape_helpers">Shape helpers</a></li><li><a href="#fill_and_stroke_styles">Fill and stroke styles</a></li><li><a href="#line_cap_and_line_join">Line cap and line join</a></li><li><a href="#dashed_lines">Dashed lines</a></li><li><a href="#color">Color</a></li><li><a href="#gradients">Gradients</a></li><li><a href="#winding_rules">Winding rules</a></li><li><a href="#saving_and_restoring_the_graphics_stack">Saving and restoring the graphics stack</a></li><li><a href="#transformations">Transformations</a></li><li><a href="#clipping">Clipping</a></li></ul></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/table.html">Tables </a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="vector_graphics_in_pdfkit">Vector Graphics in PDFKit</h1>
|
||||
|
||||
<h2 id="an_introduction_to_vector_graphics">An introduction to vector graphics</h2>
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>You made it!</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a class="selected" href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="you_made_it!">You made it!</h1>
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>You made it!</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/table.html">Tables </a></li><li><a class="selected" href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="you_made_it!">You made it!</h1>
|
||||
|
||||
<p>That's all there is to creating PDF documents in PDFKit. It's really quite
|
||||
simple to create beautiful multi-page printable documents using Node.js!</p>
|
||||
@ -12,7 +12,7 @@ a parser for Markdown and a syntax highlighter.</p>
|
||||
|
||||
<p>If you have any questions about what you've learned in this guide, please don't
|
||||
hesitate to <a href="https://twitter.com/devongovett">ask the author</a> or post an issue
|
||||
on <a href="https://github.com/foliojs/pdfkit/issues">Github</a>. Enjoy!</p><nav><a class="previous" href="/docs/accessibility.html">Previous</a></nav></div><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script src="/docs/js/scroll.js"></script><script src="/docs/js/highlight.pack.js"></script><script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
on <a href="https://github.com/foliojs/pdfkit/issues">Github</a>. Enjoy!</p><nav><a class="previous" href="/docs/table.html">Previous</a></nav></div><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script src="/docs/js/scroll.js"></script><script src="/docs/js/highlight.pack.js"></script><script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a class="selected" href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="pdfkit">PDFKit</h1>
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>PDFKit</title><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Alegreya:700|Merriweather"><link rel="stylesheet" href="/docs/css/index.css"><link rel="stylesheet" href="/docs/css/github.css"></head><body><nav class="sidebar"><ul><li><a class="selected" href="/">Home</a></li><li><a href="/docs/../index.html">Documentation</a><ul><li><a href="/docs/getting_started.html">Getting Started </a></li><li><a href="/docs/paper_sizes.html">Paper Sizes</a></li><li><a href="/docs/vector.html">Vector Graphics </a></li><li><a href="/docs/text.html">Text </a></li><li><a href="/docs/images.html">Images </a></li><li><a href="/docs/outline.html">Outlines </a></li><li><a href="/docs/annotations.html">Annotations </a></li><li><a href="/docs/forms.html">Forms </a></li><li><a href="/docs/destinations.html">Destinations</a></li><li><a href="/docs/attachments.html">Attachments </a></li><li><a href="/docs/accessibility.html">Accessibility</a></li><li><a href="/docs/table.html">Tables </a></li><li><a href="/docs/you_made_it.html">You made it!</a></li></ul></li><li><a href="/docs/guide.pdf">PDF Guide</a></li><li><a href="/examples/kitchen-sink.pdf">Example PDF</a></li><li><a href="/examples/browserify/browser.html">Interactive Browser Demo</a></li><li><a href="http://github.com/foliojs/pdfkit">Source Code</a></li></ul></nav><div class="main"><h1 id="pdfkit">PDFKit</h1>
|
||||
|
||||
<p>A JavaScript PDF generation library for Node and the browser.</p>
|
||||
|
||||
|
||||