Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
223 commits
Select commit Hold shift + click to select a range
1f8a98a
Add PDF specification
May 8, 2019
cf5efd8
Add support for drawSvg
Sharcoux Nov 4, 2021
0179254
Merge branch 'master' into add-draw-svg
Sharcoux Nov 9, 2021
cf0f67f
Lint
Sharcoux Nov 9, 2021
780069b
Complete apps:node script for Linux
Sharcoux Nov 9, 2021
33ec866
Fix measure for text measurement in drawSVG
Sharcoux Nov 9, 2021
6afad6d
Lint
Sharcoux Nov 9, 2021
2f653ff
Check the image extension before embedding it
Sharcoux Jan 17, 2022
8bb8bd1
Fix path parsing and crop v,h instruction based on the viewBox
MatheusrdSantos Feb 24, 2022
9771df8
change package name to @cantoo/pdf-lib
Sharcoux Jan 17, 2022
4d94223
Version 1.17.1
Sharcoux Feb 25, 2022
1ee0c4f
fix the fontSize conversion
MatheusrdSantos May 23, 2022
df48c75
Version 1.17.2
Sharcoux May 23, 2022
ebf1320
upgrade node-html-better-parser
Sharcoux Sep 28, 2022
74ffd0c
Version 1.17.3
Sharcoux Sep 28, 2022
9d11495
Fixes for exponential regex and [m, c, s] drawings
Rapha-Y Jul 22, 2022
e9da213
Update README.md
Sharcoux Oct 22, 2022
4a3b87e
Fix regex to match negative numbers on the path params
MatheusrdSantos Oct 25, 2022
44577d7
Add font style and font weight to runnersToPage
GabrielNSD Oct 25, 2022
ac1e819
Add fallbacks to the fonts names
GabrielNSD Oct 25, 2022
4b42045
implement getBestFont function
GabrielNSD Oct 27, 2022
c0262dc
v1.17.4
Sharcoux Oct 22, 2022
3419376
Fix release script
Sharcoux Oct 22, 2022
96b43e5
v1.17.5
Sharcoux Oct 22, 2022
b6050c0
Fix regx for negative values
Sharcoux Oct 27, 2022
f2535ac
v1.17.6
Sharcoux Oct 27, 2022
ac1e895
Update color dependency
Sharcoux Oct 28, 2022
7df4edb
v1.17.7
Sharcoux Oct 28, 2022
0b375fb
Fixed matrix transformation + consecutive m/l paths
Rapha-Y Nov 3, 2022
89e40f3
v1.17.8
Sharcoux Nov 3, 2022
af46f84
Fix an issue with H instruction
Sharcoux Jan 10, 2023
caf6580
v1.17.9
Sharcoux Jan 10, 2023
a3f8da6
Fix crash on some svg parsing
Sharcoux Feb 1, 2023
7133bca
v1.17.10
Sharcoux Feb 1, 2023
ab207c6
Implement viewBox croppping for nested svg tags
MatheusrdSantos Feb 15, 2023
cfea03d
v1.17.12
Sharcoux Feb 17, 2023
080f17e
fix the path parsing and the path cropping
MatheusrdSantos Feb 27, 2023
e2bbca9
v1.17.13
Sharcoux Feb 28, 2023
d030a8b
Implement circle crop
MatheusrdSantos Feb 24, 2023
b93736f
Implement ellipse crop
MatheusrdSantos Mar 1, 2023
476b764
v1.17.14
Sharcoux Mar 2, 2023
963881c
v1.17.15
Sharcoux Mar 2, 2023
172a2c7
Fix parseSvgNode to handle missing viewBox correctly
MatheusrdSantos Mar 6, 2023
7ae9d86
Update yarn lock
Sharcoux Mar 6, 2023
b8e46fa
v1.17.16
Sharcoux Mar 6, 2023
d92e4a3
v1.17.17
Sharcoux Mar 7, 2023
a1c044b
Remove malfunctioning ttypescript lib
Sharcoux Mar 7, 2023
c211391
v1.17.18
Sharcoux Mar 7, 2023
00d3906
fix stroke width parsing and handle svg with missing width/height
MatheusrdSantos Mar 8, 2023
65fa686
Fix cropSvgElement to handle rotated ellipses
MatheusrdSantos Mar 8, 2023
12cf0d1
v1.17.19
Sharcoux Mar 8, 2023
74c42f6
Fix runnersToPage to clear the text content before computing the text…
MatheusrdSantos Mar 13, 2023
0d5f859
v1.17.20
Sharcoux Mar 13, 2023
1c4a85e
fix parseAttributes to handle width and height equal to 0
GabrielNSD Mar 14, 2023
e5e0464
v1.17.21
Sharcoux Mar 14, 2023
c6cbda3
add incremental save functionality
remdra Mar 15, 2023
4a8da4b
Overwrite width and height from the svg style if they were manually p…
Sharcoux Apr 14, 2023
76ac5b1
v1.17.22
Sharcoux Apr 14, 2023
c8ed831
Fix previous implementation for width and height
Sharcoux Apr 14, 2023
7649dd0
v1.17.23
Sharcoux Apr 14, 2023
847ad8d
Update repository url for issues
Sharcoux Apr 18, 2023
31d8bc9
Implement rect cropping when drawing svg
MatheusrdSantos May 3, 2023
096199d
v1.17.24
Sharcoux May 4, 2023
e00a618
Fix drawSvg to respect the drawig order of each element
MatheusrdSantos Aug 3, 2023
9e3db91
v1.18.0
Sharcoux Aug 3, 2023
92b5570
Add decryption support
Sharcoux Aug 12, 2023
aa1f4ae
Add a password option
Sharcoux Aug 12, 2023
994b158
Fix decryption algorithm
Sharcoux Aug 13, 2023
4e81510
v1.19.2
Sharcoux Aug 13, 2023
1040a7a
cosmetic improvements
Sharcoux Aug 13, 2023
d3ea8d2
Fix project configuration
Sharcoux Aug 13, 2023
a954df5
Release 1.19.4
Sharcoux Aug 13, 2023
ccacf90
Fix implementation for isEncrypted
Sharcoux Aug 13, 2023
4a3752d
Release 1.19.5
Sharcoux Aug 13, 2023
8e4dfa8
Fix isEncrypted value and hasEncryption implementation
Sharcoux Aug 13, 2023
ae3f351
Release 1.19.6
Sharcoux Aug 13, 2023
dc6eb8b
Fix hasEncryption logic
Sharcoux Aug 13, 2023
c97abbf
Release 1.19.7
Sharcoux Aug 13, 2023
a60f70b
New issue with hasEncryption logic
Sharcoux Aug 13, 2023
8992e6f
Release 1.19.8
Sharcoux Aug 13, 2023
3af38d9
Wrong context imported when no password was provided
Sharcoux Aug 22, 2023
ccdf930
Release 1.19.9
Sharcoux Aug 22, 2023
04146ad
Add support for dominant-baseline
MatheusrdSantos Sep 14, 2023
9117b62
Release 1.19.10
Sharcoux Sep 15, 2023
b5500b4
Fixed line crop
Rapha-Y Sep 27, 2023
e50dfa7
Keep processing other fields if a field fails in flatten method
Sharcoux Sep 29, 2023
01b6408
Release 1.19.11
Sharcoux Sep 29, 2023
da86090
Fix duplicate adjustment in SVG path command T
ralfstx Apr 23, 2023
4a6f8ac
Release 1.19.12
Sharcoux Oct 3, 2023
e4bb759
Add polygon support
Nicodemos234 Oct 5, 2023
0f49e94
Fix es module build step
Sharcoux Oct 5, 2023
3788935
Release 1.19.13
Sharcoux Oct 9, 2023
ddc3ff4
Fix ES module
Sharcoux Oct 10, 2023
f57f239
Release 1.19.14
Sharcoux Oct 10, 2023
e4cdfa1
fix elliptical-arc parsing to handle axis scaling correctly
MatheusrdSantos Oct 20, 2023
0698125
Release 1.19.15
Sharcoux Oct 25, 2023
cf1d601
Add support for 'evenodd' fill rule
MatheusrdSantos Nov 9, 2023
39786cd
Release 1.19.16
Sharcoux Nov 9, 2023
e501eec
fix path drawing to ignore paths with empty instructions
MatheusrdSantos Nov 15, 2023
03cdfb9
Update documentation about document decryption
Sharcoux Nov 19, 2023
da9e2e9
Release 1.19.17
Sharcoux Nov 19, 2023
0f033d8
Made polygons croppable
Rapha-Y Nov 20, 2023
293c35a
Release 1.19.18
Sharcoux Nov 20, 2023
4b65f38
fix matrix transformation to handle rotations
MatheusrdSantos Nov 24, 2023
66da8fb
Release 1.19.19
Sharcoux Nov 24, 2023
6fc493a
Refactor drawSvg to handle transfomations as matrix and to crop elements
MatheusrdSantos Dec 18, 2023
a457a0e
Update target to 2019
Sharcoux Dec 21, 2023
7987a0f
Release 1.20.0
Sharcoux Dec 21, 2023
38cc107
fix the viewbox content scaling to select the minimum scaling
MatheusrdSantos Jan 9, 2024
f57852a
Release 1.20.1
Sharcoux Jan 9, 2024
5875b4c
Prevent error in "encodeTextAsGlyphs" when the character is not in th…
Sharcoux Jan 17, 2024
00f44ee
Release 1.20.2
Sharcoux Jan 17, 2024
c3ea300
make snapshot mechanism more generic
remdra Jan 29, 2024
0285db2
fix to avoid crash when keyLength is undefined
Feb 5, 2024
37e59e6
add option to suppress warnings during document objects parsing
Feb 5, 2024
5242c2f
Add conversion method from PDFObjects to typescript literals
dcbr Feb 2, 2024
6b16699
Fix tests
dcbr Jan 31, 2024
314322f
Fix linting
dcbr Feb 1, 2024
fbba827
Release 1.20.3
Sharcoux Feb 5, 2024
a15b568
Fix lint errors
Sharcoux Feb 23, 2024
e78066c
Improve perfs of copying pages
Sharcoux Mar 4, 2024
bba5066
Release 1.20.4
Sharcoux Mar 4, 2024
0dc6cd3
Fix drawSvgPath to handle the y-coord correctly
MatheusrdSantos Mar 4, 2024
c9dbf3a
lint
Sharcoux Mar 4, 2024
166308c
Release 1.21.0
Sharcoux Mar 4, 2024
6953f9e
Add text outline/stroke option
alexbrazier Apr 22, 2024
7c5a6ec
Add example of text with only outline
alexbrazier Apr 23, 2024
9593e75
Release 1.21.1
Sharcoux Apr 24, 2024
3399596
Implement drawSvgSync
MatheusrdSantos May 15, 2024
1b33249
Implement embedSvg
MatheusrdSantos May 16, 2024
9d89fc8
Update documentation to document breaking change
Sharcoux May 20, 2024
61c640a
Release 2.0.0
Sharcoux May 20, 2024
2f017e6
Add support for rounded borders
Sharcoux May 22, 2024
974b580
Add support for rx and ry on rectangles and thus to rounded borders i…
Sharcoux May 22, 2024
968eed1
Release 2.1.0
Sharcoux May 22, 2024
18911fa
Fix missing close path in drawRectangle
Sharcoux May 22, 2024
f41ccd9
Release 2.1.1
Sharcoux May 22, 2024
d71bc8b
Try to fix drawing rectangles
Sharcoux May 22, 2024
253e19f
Release 2.1.2
Sharcoux May 22, 2024
c63d0a8
Fix drawing of rectangles on svg
Sharcoux May 22, 2024
9ed8474
Update test
Sharcoux May 22, 2024
a34281f
Fix rectangle orientation
Sharcoux May 22, 2024
96255a1
Release 2.1.3
Sharcoux May 22, 2024
3b0ba58
Prevent crash in drawSvg and add support for dominant-baseline
Sharcoux May 23, 2024
8bdf390
Release 2.1.4
Sharcoux May 23, 2024
26fec23
Add blendMode option to drawSvg
Sharcoux May 27, 2024
e3b5416
Release 2.1.5
Sharcoux May 27, 2024
ff78ea2
fix PDFForm.flatten() is remove CheckBox and RadioGroup
RippleRurigaki Jun 13, 2024
d84ffa0
Fix linting
Sharcoux Jun 13, 2024
1d7bf06
Release 2.1.6
Sharcoux Jun 13, 2024
d4d7611
Implement encryption
programmarchy May 23, 2024
215eded
Hard code 1.7 version header
programmarchy Jun 13, 2024
07dae97
Fix issue that was causing Adobe Acrobat to throw an error
programmarchy Jun 24, 2024
82ab0ba
Lint
Sharcoux Jun 25, 2024
fc21f3d
Release 2.2.0
Sharcoux Jun 25, 2024
2e7b01d
Prevent negative values in bounding boxes
Sharcoux Aug 5, 2024
d700ecd
Release 2.2.1
Sharcoux Aug 5, 2024
a9483f7
Fix embedSvg
Sharcoux Aug 7, 2024
1b6d94a
Release 2.2.2
Sharcoux Aug 7, 2024
e45fa4d
Fix rotations in drawRectangle
Sharcoux Aug 10, 2024
2b9cd5f
Release 2.2.3-0
Sharcoux Aug 10, 2024
e5f590d
fix drawRectangle to handle rotation correctly
MatheusrdSantos Aug 12, 2024
f5beba8
Linting
Sharcoux Aug 12, 2024
68c8dc3
Release 2.2.3
Sharcoux Aug 12, 2024
1044ad2
fix: skip invalid_xref
brandnday Nov 7, 2024
f81a0b6
fix: unit test
brandnday Nov 7, 2024
aae5c65
Add get document language function
notz Nov 14, 2024
7d576d5
Fix drawReactangle to ivert y-axis by using transformation instead of…
MatheusrdSantos Dec 5, 2024
ddbe210
fix drawSvg to pass blendMode option
MatheusrdSantos Dec 5, 2024
41274d1
Specify version manager
Sharcoux Sep 9, 2024
a9b5c2e
Set package manager
Sharcoux Sep 9, 2024
a13b8c3
Add css blend mode support inside svg
Sharcoux Dec 3, 2024
7f1acac
Lint fixes
Sharcoux Dec 5, 2024
69d0c3b
Release 2.2.4
Sharcoux Dec 5, 2024
671c406
Make PDF encryption work in browser
bleistivt Mar 5, 2025
13166b7
Release 2.3.0
Sharcoux Mar 6, 2025
690bbeb
Made getBestFont return expected types
Rapha-Y Mar 11, 2025
6229e17
Merge pull request #93 from Rapha-Y/get-best-font-return
Sharcoux Mar 11, 2025
e6312d0
Lint
Sharcoux Mar 11, 2025
9356afd
Release 2.3.1
Sharcoux Mar 11, 2025
604b319
fullPageBoundingBox: fix mediabox handling
Mar 13, 2025
98ae915
Merge pull request #94 from horacio-penya/hp_mediabox
Sharcoux Mar 14, 2025
1aedd34
Lint
Sharcoux Mar 14, 2025
77244e8
Release 2.3.2
Sharcoux Mar 14, 2025
253aaf1
Get complete attachments, saved and unsaved (#103)
gflohr May 5, 2025
8b7a32b
Fix project lint and test config
Sharcoux Mar 14, 2025
f7079f1
Test mediabox fixes
Sharcoux Mar 14, 2025
15d2c7f
Make drawEllipse now use a single implementation based on drawSvgPath…
Sharcoux May 6, 2025
6e5e009
fix(#101): Fixes rendering of InputField when there is no border or c…
wickedest May 6, 2025
7de4c87
Fix eslint config
Sharcoux May 6, 2025
4cd08d2
Release 2.4.0
Sharcoux May 7, 2025
05376db
Incremental Update Change Automatic Registration
adnsistemas May 8, 2025
7d61af0
Generación de paquete npm
adnsistemas May 8, 2025
de772af
Add missing tslib dependency
Sharcoux May 11, 2025
d0b0862
Release 2.4.1
Sharcoux May 11, 2025
0f2abc3
Merge branch 'master' of github.com:cantoo-scribe/pdf-lib into cantoo…
adnsistemas May 21, 2025
40dcac3
Tests conciliation
adnsistemas May 21, 2025
872fbdc
Fixed merge with cantoo-scribe
adnsistemas May 31, 2025
b4e7323
Readme and package changes
adnsistemas May 31, 2025
d264a49
Lint minor fix
adnsistemas May 31, 2025
4b22104
ELint exclussions
adnsistemas May 31, 2025
b783161
Correcciones al proceso de publicación del paquete
adnsistemas Jun 1, 2025
3aac5c5
Circular dependency fix. Changed Refs registration improvement
adnsistemas Jul 10, 2025
2e21e49
Version bump
adnsistemas Jul 10, 2025
cce6de3
Object number detection correction
adnsistemas Jul 19, 2025
1a7bdce
Fix for release-it
adnsistemas Jul 19, 2025
a179b47
Release 2.4.4
adnsistemas Jul 19, 2025
a3f133c
Remove innecesary parameter to release-it
adnsistemas Jul 19, 2025
09af05e
Fix in inclusions paths, to fix package building
adnsistemas Jul 19, 2025
f173b86
Release 2.4.5
adnsistemas Jul 19, 2025
87ac8a9
Reimplementation of XREF objects registration for propper rearrange o…
adnsistemas Jul 23, 2025
7ff1f6a
Release 2.5.0
adnsistemas Jul 23, 2025
735395d
Incremental update test improvement
adnsistemas Aug 20, 2025
0c1c22d
Added object version tracking and Xref registration, to be able to id…
adnsistemas Aug 31, 2025
b362dae
Coveralls incorporation
adnsistemas Aug 31, 2025
04ceb66
Reconfiguration including coveralls
adnsistemas Aug 31, 2025
dc94612
Release 2.6.0
adnsistemas Sep 1, 2025
a62dea9
Fix in chage registration for new references
adnsistemas Sep 1, 2025
e432eb1
Release 2.6.1
adnsistemas Sep 1, 2025
fca259c
Added test to verify incremental update integrity
adnsistemas Sep 1, 2025
c332ba9
Fix in streams xref processing, modified test to pair Xref modes
adnsistemas Sep 1, 2025
5f23cff
Fix in Size trailer info for StreamXref
adnsistemas Sep 1, 2025
4698c35
Release 2.6.2
adnsistemas Sep 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
359 changes: 323 additions & 36 deletions README.md

Large diffs are not rendered by default.

19 changes: 14 additions & 5 deletions apps/deno/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { readLines } from 'https://deno.land/[email protected]/io/bufio.ts';
import { SEP, dirname } from 'https://deno.land/[email protected]/path/mod.ts';

import { default as test1 } from './tests/test1.ts';
Expand All @@ -19,11 +18,15 @@ import { default as test15 } from './tests/test15.ts';
import { default as test16 } from './tests/test16.ts';
import { default as test17 } from './tests/test17.ts';
import { default as test18 } from './tests/test18.ts';
import { default as test19 } from './tests/test19.ts';
import test20 from './tests/test20.ts';

const promptToContinue = () => {
const prompt = 'Press <enter> to run the next test...';
Deno.stdout.write(new TextEncoder().encode(prompt));
return readLines(Deno.stdin).next();

const buff = new Uint8Array(128);
return Deno.stdin.read(buff);
};

// This needs to be more sophisticated to work on Linux as well.
Expand All @@ -38,9 +41,13 @@ const openPdf = (path: string, reader: string = '') => {
} else if (Deno.build.os === 'windows') {
// Opens with the default PDF Reader, has room for improvment
Deno.run({ cmd: ['cmd', '/c', 'start', path] });
} else if (Deno.build.os === 'linux') {
Deno.run({ cmd: ['xdg-open', path] });
} else {
const msg1 = `Note: Automatically opening PDFs currently only works on Macs and Windows. If you're using a Linux machine, please consider contributing to expand support for this feature`;
const msg2 = `(https://github.com/Hopding/pdf-lib/blob/master/apps/node/index.ts#L8-L17)\n`;
const msg1 =
"Note: Automatically opening PDFs currently only works on Macs and Windows. If you're using a Linux machine, please consider contributing to expand support for this feature";
const msg2 =
'(https://github.com/Hopding/pdf-lib/blob/master/apps/node/index.ts#L8-L17)\n';
console.warn(msg1);
console.warn(msg2);
}
Expand Down Expand Up @@ -135,6 +142,7 @@ const assets = {
fancy_fields: readPdf('fancy_fields.pdf'),
form_to_flatten: readPdf('form_to_flatten.pdf'),
with_annots: readPdf('with_annots.pdf'),
simple: readPdf('simple.pdf'),
},
};

Expand Down Expand Up @@ -165,7 +173,8 @@ const main = async () => {
// prettier-ignore
const allTests = [
test1, test2, test3, test4, test5, test6, test7, test8, test9, test10,
test11, test12, test13, test14, test15, test16, test17, test18
test11, test12, test13, test14, test15, test16, test17, test18, test19,
test20
];

const tests = testIdx ? [allTests[testIdx - 1]] : allTests;
Expand Down
2 changes: 1 addition & 1 deletion apps/deno/tests/test1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ export default async (assets: Assets) => {
const multilineTf = form.createTextField('moi.multiline.text.field');
multilineTf.enableMultiline();
multilineTf.setText(
`In the morning, when you can't get out of bed, tell yourself: "I'm getting up to do the work only a man can do. How can I possibly hesitate or complain when I'm about to accomplish the task for which I was born? Was I made for lying warm in bed under a pile of blankets?"\n\n"But I enjoy it here."\n\nWas it for enjoyment you were born? Are you designed to act or to be acted upon?\n\n\t\t\t\t\t\t\t\t\t\t - Marcus Aurelius`,
'In the morning, when you can\'t get out of bed, tell yourself: "I\'m getting up to do the work only a man can do. How can I possibly hesitate or complain when I\'m about to accomplish the task for which I was born? Was I made for lying warm in bed under a pile of blankets?"\n\n"But I enjoy it here."\n\nWas it for enjoyment you were born? Are you designed to act or to be acted upon?\n\n\t\t\t\t\t\t\t\t\t\t - Marcus Aurelius',
);
multilineTf.addToPage(page5, {
x: fPadding * 3 + fWidth / 2 + fWidth * 2.5,
Expand Down
48 changes: 24 additions & 24 deletions apps/deno/tests/test10.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@ import {

// prettier-ignore
const winAnsiCodePoints = [
0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028,
0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 0x0030, 0x0031,
0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a,
0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, 0x0041, 0x0042, 0x0043,
0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c,
0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055,
0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e,
0x005f, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070,
0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079,
0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x00a0, 0x00a1, 0x00a2, 0x00a3,
0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac,
0x00ad, 0x00ae, 0x00af, 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5,
0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be,
0x00bf, 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, 0x00d0,
0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9,
0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, 0x00e0, 0x00e1, 0x00e2,
0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb,
0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4,
0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd,
0x00fe, 0x00ff, 0x0152, 0x0153, 0x0160, 0x0161, 0x0178, 0x017d, 0x017e,
0x0192, 0x02c6, 0x02dc, 0x2013, 0x2014, 0x2018, 0x2019, 0x201a, 0x201c,
0x201d, 0x201e, 0x2020, 0x2021, 0x2022, 0x2026, 0x2030, 0x2039, 0x203a,
0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028,
0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 0x0030, 0x0031,
0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a,
0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, 0x0041, 0x0042, 0x0043,
0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c,
0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055,
0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e,
0x005f, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070,
0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079,
0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x00a0, 0x00a1, 0x00a2, 0x00a3,
0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac,
0x00ad, 0x00ae, 0x00af, 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5,
0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be,
0x00bf, 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, 0x00d0,
0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9,
0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, 0x00e0, 0x00e1, 0x00e2,
0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb,
0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4,
0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd,
0x00fe, 0x00ff, 0x0152, 0x0153, 0x0160, 0x0161, 0x0178, 0x017d, 0x017e,
0x0192, 0x02c6, 0x02dc, 0x2013, 0x2014, 0x2018, 0x2019, 0x201a, 0x201c,
0x201d, 0x201e, 0x2020, 0x2021, 0x2022, 0x2026, 0x2030, 0x2039, 0x203a,
0x20ac, 0x2122,
];

Expand Down
2 changes: 1 addition & 1 deletion apps/deno/tests/test12.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const thirdPage = async (pdfDoc: PDFDocument, assets: Assets) => {
blendMode: BlendMode.Normal,
});

page.drawText(`pdf-lib Blend Mode Test`, {
page.drawText('pdf-lib Blend Mode Test', {
size: 24,
x: 45,
y: 735,
Expand Down
45 changes: 20 additions & 25 deletions apps/deno/tests/test15.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { Assets } from '../index.ts';

// @deno-types="../dummy.d.ts"
import {
PDFDocument,
StandardFonts,
rgb,
TextAlignment,
} from '../../../dist/pdf-lib.esm.js';
import { PDFDocument, rgb, TextAlignment } from '../../../dist/pdf-lib.esm.js';

export default async (assets: Assets) => {
const pdfDoc = await PDFDocument.load(assets.pdfs.dod_character);
Expand All @@ -18,7 +13,7 @@ export default async (assets: Assets) => {

form.getTextField('CharacterName 2').setText('Mario');
form.getTextField('Age').setText('24 years');
form.getTextField('Height').setText(`5' 1"`);
form.getTextField('Height').setText('5\' 1"');
form.getTextField('Weight').setText('196 lbs');
form.getTextField('Eyes').setText('blue');
form.getTextField('Skin').setText('white');
Expand All @@ -30,38 +25,38 @@ export default async (assets: Assets) => {
.getTextField('Allies')
.setText(
[
`Allies:`,
` • Princess Daisy`,
` • Princess Peach`,
` • Rosalina`,
` • Geno`,
` • Luigi`,
` • Donkey Kong`,
` • Yoshi`,
` • Diddy Kong`,
``,
`Organizations:`,
` • Italian Plumbers Association`,
'Allies:',
' • Princess Daisy',
' • Princess Peach',
' • Rosalina',
' • Geno',
' • Luigi',
' • Donkey Kong',
' • Yoshi',
' • Diddy Kong',
'',
'Organizations:',
' • Italian Plumbers Association',
].join('\n'),
);

form.getTextField('FactionName').setText(`Mario's Emblem`);
form.getTextField('FactionName').setText("Mario's Emblem");
form.getTextField('Faction Symbol Image').setImage(emblemImage);

form
.getTextField('Backstory')
.setText(
`Mario is a fictional character in the Mario video game franchise, owned by Nintendo and created by Japanese video game designer Shigeru Miyamoto. Serving as the company's mascot and the eponymous protagonist of the series, Mario has appeared in over 200 video games since his creation. Depicted as a short, pudgy, Italian plumber who resides in the Mushroom Kingdom, his adventures generally center upon rescuing Princess Peach from the Koopa villain Bowser. His younger brother and sidekick is Luigi.`,
"Mario is a fictional character in the Mario video game franchise, owned by Nintendo and created by Japanese video game designer Shigeru Miyamoto. Serving as the company's mascot and the eponymous protagonist of the series, Mario has appeared in over 200 video games since his creation. Depicted as a short, pudgy, Italian plumber who resides in the Mushroom Kingdom, his adventures generally center upon rescuing Princess Peach from the Koopa villain Bowser. His younger brother and sidekick is Luigi.",
);

form
.getTextField('Feat+Traits')
.setText(
[
`Mario can use three basic three power-ups:`,
` • the Super Mushroom, which causes Mario to grow larger`,
` • the Fire Flower, which allows Mario to throw fireballs`,
` • the Starman, which gives Mario temporary invincibility`,
'Mario can use three basic three power-ups:',
' • the Super Mushroom, which causes Mario to grow larger',
' • the Fire Flower, which allows Mario to throw fireballs',
' • the Starman, which gives Mario temporary invincibility',
].join('\n'),
);

Expand Down
2 changes: 1 addition & 1 deletion apps/deno/tests/test18.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const loadB = async (assets: Assets) => {

form.getTextField('CharacterName 2').setText('Mario');
form.getTextField('Age').setText('24 years');
form.getTextField('Height').setText(`5' 1"`);
form.getTextField('Height').setText('5\' 1"');
form.getTextField('Weight').setText('196 lbs');
form.getTextField('Eyes').setText('blue');
form.getTextField('Skin').setText('white');
Expand Down
28 changes: 28 additions & 0 deletions apps/deno/tests/test19.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Assets } from '../index.ts';

import { PDFDocument, StandardFonts } from '../../../dist/pdf-lib.esm.js';

export default async (assets: Assets) => {
const pdfDoc = await PDFDocument.load(assets.pdfs.simple);
const snapshot = pdfDoc.takeSnapshot();
const page = pdfDoc.getPage(0);
snapshot.markRefForSave(page.ref);
const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman);
const fontSize = 30;
const { height } = page.getSize();
page.drawText('Incremental saving is also awesome!', {
x: 50,
y: height - 8 * fontSize,
size: fontSize,
font: timesRomanFont,
});

const pdfIncrementalBytes = await pdfDoc.saveIncremental(snapshot);

const pdfBytes = new Uint8Array([
...assets.pdfs.simple,
...pdfIncrementalBytes,
]);

return pdfBytes;
};
Loading