27 Commits

Author SHA1 Message Date
Luiz Américo Pereira Câmara
15087ea8c3 Cleanup / simplify code 2025-04-12 12:43:17 -03:00
Jake Holland
033ba3426b
Add support for tables (#1577)
* Add page size utilities

- Added page.contentWidth
- Added page.contentHeight

* Add table support

- Tables support cell customization (including colors)
- Tables also support rotatable text (with alignment support)
- Tables have accessibility support

* chore: fix code generation context

- code generation now respects the current document positioning to allow use of page dependent operations

* chore: remove comments from build

* removed unnecessary config optimisations

* Optimize table minification

* Performance improvements to tables

* Improve font handling in tables
2025-02-24 07:49:25 -03:00
Jake Holland
ee7208b4ea
Fix page cascade options when text overflows (#1597) 2025-02-05 07:49:58 -03:00
Luiz Américo Pereira Câmara
d487253fcc Remove deprecated method write 2024-03-23 22:22:03 -03:00
Andrei Augustin
3904188903
Initial support for PDF/A-1a/b (#1395)
* pdf/a1b support initial commit

Added mixin for support pdf/a1b and a few of the things it requires (xmp metadata, colour profile). Currently, the CIDSet stream is the only error it comes back with the test case I'm using, will try sorting it out next.

* Adding CIDSet when generating PDF/A

PDF/A1 b/a requires a CIDSet. This is not checked by a validator and other converters seem to add a CIDSet with a value of FF FF FF FF 0C, so this commit does the same. When extending support for PDF/A 2/3/4, we may not add a CIDSet (I think for PDF/A3 it's not required?) or we will look for a proper way to generate the CIDSet.

At this point, PDFKit should be able to generate PDF/A1b which can pass veraPDF validation and PDF/A1a if tagged is enabled.

All you have to do is set pdfa: '1a' or pdfa: '1b' in the options passed to new PDFDocument.

* pdf/a intro docs

* generalising subsets, reimplementing pdfa1 and added control over metadata

added a generalised subsets mixin which can pull in a subset at runtime.
reimplemented pdfa1 mixin as some features should be standardised across all subsets, such as storing /Info as xmp metadata for pdf >1.3
added a metadata class and mixing to control and write the metadata to a pdf

* added tests for pdfa1 and metadata and moved joinTokens in helpers

Addeds tests for pdfa1 subset and metadata.
Moved joinTokens into helpers.js as it's now used in at least two places.
Added tests for document to when metadata should be added (pdf version 1.4 or newer) and when it shouldn't (pdf version 1.3)

* updated pdf/a docs to reflect latest changes

* store color profile as icc file

* Updated changelog to include PDF/A support in Unreleased section
2023-01-06 19:25:11 -03:00
Steffen Matheis
7219fd07a9 add support for embedded files and file attachment annotations 2021-03-25 15:13:58 -03:00
Ben Schmidt
9b3aa7b50a Fully support PDF/UA. 2021-01-15 16:43:49 -03:00
Ben Schmidt
272444e397 Fully support accessibility features from PDF reference. 2021-01-15 16:43:49 -03:00
Ben Schmidt
c177874e82 Fully support Tagged PDF. 2021-01-15 16:43:49 -03:00
Ben Schmidt
bc09c32d1b Support marked structure content and logical structure. 2021-01-15 16:43:49 -03:00
Ben Schmidt
ef5e52b2ad Support marking content. 2021-01-15 16:43:49 -03:00
Luiz Américo
326350b7f9 Fix eslint and prettier warnings 2020-09-09 20:35:10 -03:00
Libor M
ba62aeff11 fix Buffer() is deprecation warning #1114 2020-07-25 11:25:56 +02:00
Nathanael Anderson
db6a8117d2 Expose LineWrapper class 2020-04-08 11:27:17 -05:00
Jim Pravetz
0514363199 Reformatted some files using prettier.
Rename widgetAnnot method to widgetAnnotation
Rename initAcroForm method to initForms
Ensure existing unit tests pass.
Add formChoice example to test-acroform.js.
Minor documentation changes for forms.
2019-07-25 15:07:10 -07:00
Jim Pravetz
554cf3d9ad Changed addNamedJavaScript to accept string instead of (nodejs-only) buffer.
Got jest tests running by setting setupFilesAfterEnv to include toContainChunk (not clear why this became necessary).
Modified toContainChunk to accept RegExp for all but first parameter of array.
AcroForms partial tests working.
2019-07-24 13:56:24 -07:00
Jim Pravetz
e4924bda9a Do not add JavaScript to Catalog/Names until a named JavaScript is added.
Needed to prevent existing unit tests from failing.
2019-07-24 12:09:42 -07:00
Jim Pravetz
9f6c5fb825 Added documentation for AcroForms.
Fixed spelling of NeedAppearances (doh!).
Added backgroundColor and borderColor options (for push buttons).
Added label option (for push buttons).
2019-07-20 21:16:58 -07:00
Jim Pravetz
c086abe30a Begin adding AcroForm support 2019-07-17 18:13:29 -07:00
Luiz Américo
4d02fff04e Remove deprecated method PDFDocument.output 2019-06-06 19:19:11 -03:00
Luiz Américo
f7a2a87ebb
Merge branch 'master' into named-destinations-es6 2019-04-17 19:31:11 -03:00
Danny Kirchmeier
c17bf39710 Fix links to page numbers within the document 2019-04-17 10:41:30 -05:00
Libor M
ad593cf422 support for named destinations 2019-03-24 08:35:36 +01:00
Luiz Américo
bd0631f782 Add option to defined default font 2019-03-02 20:42:56 -03:00
Luiz Américo
a6af76467c Add prettier npm script and run it in *.js files 2019-01-07 20:51:06 -03:00
Yang Liu
f5b6ddd2a9 Add PDF security features with ES6 2018-12-17 21:20:19 +09:00
Luiz Américo
83f5f72431 Convert to EcmaScript (ES6+) (#859) 2018-11-29 08:14:45 -08:00