Accessibility
+Accessibility
Accessible PDFs are usable by visually impaired users who rely on screen readers/text-to-speech engines/vocalisation.
@@ -310,7 +310,7 @@ is not possible for some reasonP - paragraph"Illustration" elements (should have alt and/or actualtext set):
-Figure - figureFormula - formulaForm - form widget
Text in PDFKit
+Text in PDFKit
The basics
@@ -82,7 +82,7 @@ doc.rect(doc.x, 0, 410, doc.y).stroke(); documents, which can be passed to thetext method. They are enumerated
below.
-lineBreak- set tofalseto disable line wrapping all togetherwidth- the width that text should be wrapped to (by default, the page width minus the left and right margin)height- the maximum height that text should be clipped toellipsis- the character to display at the end of the text when it is too long. Set totrueto use the default character.columns- the number of columns to flow the text intocolumnGap- the amount of space between each column (1/4 inch by default)indent- the amount in PDF points (72 per inch) to indent each paragraph of textindentAllLines- wheter to indent all lines of a paragraph (falseby default - indents only the first line)paragraphGap- the amount of space between each paragraph of textlineGap- the amount of space between each line of textwordSpacing- the amount of space between each word in the textcharacterSpacing- the amount of space between each character in the texthorizontalScaling- ability to scale text horizontally (100percent by default)fill- whether to fill the text (trueby default)stroke- whether to stroke the textlink- a URL to link this text to (shortcut to create an annotation)goTo- go to anchor (shortcut to create an annotation)destination- create anchor to this textunderline- whether to underline the textstrike- whether to strike out the textoblique- whether to slant the text (angle in degrees ortrue)baseline- the vertical alignment of the text with respect to its insertion point (values as canvas textBaseline)continued- whether the text segment will be followed immediately by another segment. Useful for changing styling in the middle of a paragraph.features- an array of OpenType feature tags to apply. If not provided, a set of defaults is used.
lineBreak- set tofalseto disable line wrapping all togetherwidth- the width that text should be wrapped to (by default, the page width minus the left and right margin)height- the maximum height that text should be clipped torotation- the rotation of the text in degrees (by default 0)ellipsis- the character to display at the end of the text when it is too long. Set totrueto use the default character.columns- the number of columns to flow the text intocolumnGap- the amount of space between each column (1/4 inch by default)indent- the amount in PDF points (72 per inch) to indent each paragraph of textindentAllLines- wheter to indent all lines of a paragraph (falseby default - indents only the first line)paragraphGap- the amount of space between each paragraph of textlineGap- the amount of space between each line of textwordSpacing- the amount of space between each word in the textcharacterSpacing- the amount of space between each character in the texthorizontalScaling- ability to scale text horizontally (100percent by default)fill- whether to fill the text (trueby default)stroke- whether to stroke the textlink- a URL to link this text to (shortcut to create an annotation)goTo- go to anchor (shortcut to create an annotation)destination- create anchor to this textunderline- whether to underline the textstrike- whether to strike out the textoblique- whether to slant the text (angle in degrees ortrue)baseline- the vertical alignment of the text with respect to its insertion point (values as canvas textBaseline)continued- whether the text segment will be followed immediately by another segment. Useful for changing styling in the middle of a paragraph.features- an array of OpenType feature tags 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 ({ liga: false }). When providing an empty array the default font features will still be used.
Additionally, the fill and stroke color and opacity methods described in the vector graphics section are applied to text content as well.
@@ -108,10 +108,14 @@ doc.text(lorem, {Text measurements
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: widthOfString(text, options)
-and heightOfString(text, options). Both methods use the same options described in the
+size of a piece of text. PDFKit has three methods to achieve this: widthOfString(text, options)
+, heightOfString(text, options) and boundsOfString(text, options)/boundsOfString(text, x, y, options). All methods use the same options described in the
Text styling section, and take into account the eventual line wrapping.
However boundsOfString factors in text rotations and multi-line wrapped text,
+effectively producing the bounding box of the text, {x: number, y: number, width: number, height: number}.
+If x and y are not defined they will default to use this.x and this.y.
Lists
The list method creates a bulleted list. It accepts as arguments an array of strings,
diff --git a/docs/vector.html b/docs/vector.html
index 62d0475..0736263 100644
--- a/docs/vector.html
+++ b/docs/vector.html
@@ -1,4 +1,4 @@
-
Vector Graphics in PDFKit
+Vector Graphics in PDFKit
An introduction to vector graphics
diff --git a/docs/you_made_it.html b/docs/you_made_it.html index 96a8114..3b677e1 100644 --- a/docs/you_made_it.html +++ b/docs/you_made_it.html @@ -1,4 +1,4 @@ -You made it!
+You made it!
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!
@@ -12,7 +12,7 @@ a parser for Markdown and a syntax highlighter.If you have any questions about what you've learned in this guide, please don't hesitate to ask the author or post an issue -on Github. Enjoy!