You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -40,9 +40,9 @@
40
40
-[Features](#features)
41
41
-[Motivation](#motivation)
42
42
-[Examples](#examples)
43
-
-[Document Creation](#document-creation)
44
-
-[Document Modification](#document-modification)
45
-
-[Copying Pages](#copying-pages)
43
+
-[Create Document](#create-document)
44
+
-[Modify Document](#modify-document)
45
+
-[Copy Pages](#copy-pages)
46
46
-[Embed PNG and JPEG Images](#embed-png-and-jpeg-images)
47
47
-[Embed Font and Measure Text](#embed-font-and-measure-text)
48
48
-[Installation](#installation)
@@ -77,7 +77,7 @@ There are [other](#prior-art) good open source JavaScript PDF libraries availabl
77
77
78
78
## Examples
79
79
80
-
### Document Creation
80
+
### Create Document
81
81
82
82
_This example produces [this PDF](assets/pdfs/examples/document_creation.pdf)._
83
83
@@ -104,15 +104,15 @@ page.drawText('Creating PDFs in JavaScript is awesome!', {
104
104
constpdfBytes=awaitpdfDoc.save()
105
105
```
106
106
107
-
### Document Modification
107
+
### Modify Document
108
108
109
109
_This example produces [this PDF](assets/pdfs/examples/document_modification.pdf)_ (when [this PDF](assets/pdfs/with_update_sections.pdf) is used for the `existingPdfBytes` variable).
// This data can be obtained in a number of different ways.
117
117
// If your running in a Node environment, you could use fs.readFile().
118
118
// In the browser, you could make a fetch() call and use res.arrayBuffer().
@@ -138,7 +138,7 @@ firstPage.drawText('This text was added with JavaScript!', {
138
138
constpdfBytes=awaitpdfDoc.save()
139
139
```
140
140
141
-
### Copying Pages
141
+
### Copy Pages
142
142
143
143
_This example produces [this PDF](assets/pdfs/examples/copying_pages.pdf)_ (when [this PDF](assets/pdfs/with_update_sections.pdf) is used for the `firstDonorPdfBytes` variable and [this PDF](assets/pdfs/with_large_page_count.pdf) is used for the `secondDonorPdfBytes` variable).
144
144
@@ -148,8 +148,8 @@ import { PDFDocument } from 'pdf-lib'
148
148
149
149
constpdfDoc=awaitPDFDocument.create();
150
150
151
-
//This should be a Uint8Arrays.
152
-
//These can be obtained in a number of different ways.
151
+
//These should be a Uint8Arrays or ArrayBuffers.
152
+
//This data can be obtained in a number of different ways.
153
153
// If your running in a Node environment, you could use fs.readFile().
154
154
// In the browser, you could make a fetch() call and use res.arrayBuffer().
_This example produces [this PDF](assets/pdfs/examples/embed_png_and_jpeg_images.pdf)_ (when [this image](assets/images/cat_riding_unicorn.jpg) is used for the `jpgImageBytes` variable and [this image](assets/images/minions_banana_alpha.jpg) is used for the `pngImageBytes` variable).
177
+
_This example produces [this PDF](assets/pdfs/examples/embed_png_and_jpeg_images.pdf)_ (when [this image](assets/images/cat_riding_unicorn.jpg) is used for the `jpgImageBytes` variable and [this image](assets/images/minions_banana_alpha.png) is used for the `pngImageBytes` variable).
178
178
179
179
<!-- prettier-ignore -->
180
180
```js
181
181
import { PDFDocument } from'pdf-lib'
182
182
183
-
// These should be a Uint8Arrays.
183
+
// These should be a Uint8Arrays or ArrayBuffers.
184
184
// This data can be obtained in a number of different ways.
185
185
// If your running in a Node environment, you could use fs.readFile().
186
186
// In the browser, you could make a fetch() call and use res.arrayBuffer().
@@ -227,7 +227,7 @@ _This example produces [this PDF](assets/pdfs/examples/embed_font_and_measure_te
227
227
import { PDFDocument, rgb } from'pdf-lib'
228
228
importfontkitfrom'@pdf-lib/fontkit'
229
229
230
-
// This should be a Uint8Array.
230
+
// This should be a Uint8Array or ArrayBuffer.
231
231
// This data can be obtained in a number of different ways.
232
232
// If your running in a Node environment, you could use fs.readFile().
233
233
// In the browser, you could make a fetch() call and use res.arrayBuffer().
0 commit comments