A few docs fixes

This commit is contained in:
Devon Govett 2019-01-27 19:29:58 -08:00
parent 15636ee610
commit 64d2fb86d4
8 changed files with 28637 additions and 20674 deletions

4
.gitignore vendored
View File

@ -10,4 +10,6 @@ demo/bundle.js
*.html
!demo/browser.html
.vscode
coverage
coverage
tests/integration/__pdfs__
tests/integration/pdfmake/__pdfs__

View File

@ -4,10 +4,10 @@ A JavaScript PDF generation library for Node and the browser.
## Description
PDFKit is a PDF document generation library for Node and the browser that makes creating complex, multi-page, printable documents easy.
It's written in CoffeeScript, but you can choose to use the API in plain 'ol JavaScript if you like. The API embraces
chainability, and includes both low level functions as well as abstractions for higher level functionality. The PDFKit API
is designed to be simple, so generating complex documents is often as simple as a few function calls.
PDFKit is a PDF document generation library for Node and the browser that makes creating complex, multi-page, printable
documents easy. The API embraces chainability, and includes both low level functions as well as abstractions for higher
level functionality. The PDFKit API is designed to be simple, so generating complex documents is often as simple as
a few function calls.
Check out some of the [documentation and examples](http://pdfkit.org/docs/getting_started.html) to see for yourself!
You can also read the guide as a [self-generated PDF](http://pdfkit.org/docs/guide.pdf) with example output displayed inline.

View File

@ -3,7 +3,7 @@
The PDFKit guide can be read a number of ways. The first is online at [pdfkit.org](http://pdfkit.org/).
You can also read the guide in PDF form, in this directory or [online](http://pdfkit.org/docs/guide.pdf).
Both the website and the PDF guide are generated from the Literate CoffeeScript (runnable Markdown) files
Both the website and the PDF guide are generated from the Markdown files
in this directory. The examples are actually run when generating the PDF in order to show the results inline.
The `generate.js` file in this directory is actually quite short. It parses the markdown files into a
tree structure using [markdown-js](https://github.com/evilstreak/markdown-js), syntax highlights the code

View File

@ -87,7 +87,7 @@ The output is as you'd expect:
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!
This guide was generated from Markdown/Literate CoffeeScript files using a
This guide was generated from Markdown files using a
PDFKit generation script. The examples are actually run to generate the output shown
inline. The script generates both the website and the PDF guide, and
can be found [on Github](http://github.com/devongovett/pdfkit/tree/master/docs/generate.coffee).

View File

@ -10,7 +10,7 @@ following command after installing npm.
### Creating a document
Creating a PDFKit document is quite simple. Just require the `pdfkit` module
in your CoffeeScript or JavaScript source file and create an instance of the
in your JavaScript source file and create an instance of the
`PDFDocument` class.
const PDFDocument = require('pdfkit');

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,7 @@ be scaled according to the following options.
* `cover` array provided - image is scaled proportionally to completely cover the rectangle defined by the passed width and height
When a `fit` or `cover` array is provided, PDFKit accepts these additional options:
* `align` - horizontally align the image, the possible values are `'left'`, `'center'` and `'right'`
* `valign` - vertically align the image, the possible values are `'top'`, `'center'` and `'bottom'`
@ -41,15 +42,14 @@ Here is an example showing some of these options.
// Fit the image in the dimensions, and center it both horizontally and vertically
doc.image('images/test.jpeg', 430, 15, {fit: [100, 100], align: 'center', valign: 'center'})
.rect(430, 15, 100, 100)
.stroke()
.rect(430, 15, 100, 100).stroke()
.text('Centered', 430, 0);
* * *
This example produces the following output:
![0](images/images.png "150")
![0](images/images.png "400")
That is all there is to adding images to your PDF documents with PDFKit. Now
let's look at adding annotations.
let's look at adding outlines.

View File

@ -137,6 +137,7 @@ Text styling section, and take into account the eventual line wrapping.
The `list` method creates a bulleted list. It accepts as arguments an array of strings,
and the optional `x`, `y` position. You can create complex multilevel lists by using nested arrays.
Lists use the following additional options:
* `bulletRadius`
* `textIndent`
* `bulletIndent`
@ -168,6 +169,7 @@ Here is the output:
The PDF format defines 14 standard fonts that can be used in PDF documents. PDFKit supports each of them out of the box.
Besides Symbol and Zapf Dingbats this includes 4 styles (regular, bold, italic/oblique, bold+italic) of Helvetica,
Courier, and Times. To switch between standard fonts, call the `font` method with the corresponding Label:
* `'Courier'`
* `'Courier-Bold'`
* `'Courier-Oblique'`