396 Commits

Author SHA1 Message Date
Jake Holland
40a0f383a7
Fix precision rounding issues in LineWrapper (#1583)
Handle JS quirks with large decimal precision checks resulting from the calculations of next lines in the LineWrapper
2025-01-11 13:16:17 +01:00
Libor M.
bbe4ab9305 Add Name property for set custom icon for note() #1319 2024-12-28 16:00:38 +01:00
Libor M.
cf5a77469f Fix for embedding fonts into PDF (font name must not contain spaces) #1314 2024-12-28 14:05:02 +01:00
Libor M.
704a005ac2 Fix font cache collision identical metadata for different fonts #1330 2024-12-28 13:34:00 +01:00
Kevin Hendel
1b678c3e3d
Indent after linebreak (#879)
* add indentAllLines option to indent all lines of a paragraph instead of only the first one

* update comments

* Update CHANGELOG.md

---------

Co-authored-by: Libor M. <liborm85@gmail.com>
2024-12-27 15:52:48 +01:00
Libor M.
133a321a56 Add support to scale text horizontally
inspired by #445
2024-12-27 15:34:22 +01:00
Libor M.
42172c5102 Fix font cache collision for fonts with missing postscript name or bad TTF metadata #1384 #691 2024-12-27 12:07:52 +01:00
Adrian Rollett
8b20d0742a
Fix sets tab order to "Structure" when a document is tagged #1260 (#1449)
* Set tab order when document is tagged

* Update approach and add inverse test

* Revert page dictionary setup

* Update lib/mixins/markings.js

* Update kitchen-sink-accessible.pdf

* Update CHANGELOG.md

---------

Co-authored-by: Libor M. <liborm85@gmail.com>
2024-12-26 14:35:14 +01:00
Libor M.
3ccf3b8d90 Add support for spot colors #756 2024-12-26 13:11:07 +01:00
Benjamin Bloomfield
eecfb4c97a
Fix measuring text when OpenType features are passed in to .text() (#1492)
* Update text.js

to fix measuring text when opentype features are passed in to .text()

* added simple test

* Update CHANGELOG.md

---------

Co-authored-by: Libor M. <liborm85@gmail.com>
2024-12-25 07:45:56 +01:00
Devon Govett
f238d1b107
Bump fontkit and linebreak deps (#1367)
* Bump fontkit and linebreak deps

* Bump fontkit to 2.0.0

* Bump

* Drop old node versions

* Bump testing dependencies

* Update pdfjs

* fix jest to compatibility with restructure, update fontkit, refresh snapshots

* Update CHANGELOG.md

---------

Co-authored-by: Libor M. <liborm85@gmail.com>
2024-12-16 08:36:25 +01:00
Libor M.
bcc64c2f3b Fix modify time comparison check equality embedded files 2024-12-15 13:55:19 +01:00
Artem Shibakov
24b4947226
fix missing acroform font identification (#1465)
undefined !== null but undefined == null
2024-12-14 14:29:25 +01:00
Libor M.
75a8dbc0aa Fix CIDSet generation only for PDF/A1 subset #1561 2024-12-14 14:06:24 +01:00
Florian Bischoff
bc59dd21e3
fix: pdf/a compliance of attachments (#1562)
* fix: pdf/a compliance of attachments

* fixed tests

* update docs

---------

Co-authored-by: Libor M. <liborm85@gmail.com>
2024-12-14 12:52:21 +01:00
David
ffbbee597a
#1517 Fix ordered lists (#1568)
* adds test cases for ordered lists

* fixes broken labels for ordered lists (#1517)

* adds test for sub-lists (ordered and unordered)

* update changelog for fix of #1517

---------

Co-authored-by: David <filecage@users.noreply.github.com>
2024-12-14 10:13:02 +01:00
Libor M.
831179e067 Fix browserify transform sRGB_IEC61966_2_1.icc file 2024-08-20 18:25:49 +02:00
Noah
f2e9b168e0
Bugfix: File Cache Equality Check Incorrectly Compares Dates (#1544)
* refactors to correctly check if dates are equal

* Update attachments.js

* fixes lint error

---------

Co-authored-by: utanapishtim <utnapishtim.utanapishtim@gmail.com>
2024-08-13 20:39:57 -03:00
Andrei Augustin
76cdedd967
Update acroform.js
Updated error text document.initForms() to document.initForm() as correct method name is initForm()
2024-07-16 17:36:34 +03:00
Luiz Américo Pereira Câmara
309cdd6216 Move icc profile file to mixins data subfolder 2024-03-23 22:22:03 -03:00
Luiz Américo Pereira Câmara
d487253fcc Remove deprecated method write 2024-03-23 22:22:03 -03:00
Yeechan Lu
946f9cf6dc
Generate ToUnicodeMap bfrange in multiple ranges (#1498) (#1499)
* Generate ToUnicodeMap bfrange in multiple ranges (#1498)

This resolves #1498.

* Add unit test for bfrange lines in toUnicodeMap

* Add changelog line
2024-02-26 10:18:47 -03:00
Rico Brase
485b7e6bee
Fix Acroforms - setting an option to false will still apply the flag (#1496)
* Add an option check to acroform mixin _resolveFlags().

This resolves #1495.

* Reworked fix to remove flags from options, if they are falsey.

* Added unit test for ignoring false flags in acroforms

* Added entry for removing false flags in changelog.
2024-02-07 20:28:58 -03:00
Olli Etuaho
a655194de2
Prevent adding identity transforms to the document (#1493)
This makes the resulting PDF files smaller. It's cumbersome to filter out all commands that could result in identity transforms in code that's using PDFKit, so it makes sense to have the check in the transform() function.
2024-01-23 13:36:54 -03:00
Rudolf Biczok
1f70b450a2
Replace soft hyphen with visible hyphen if line break demands it (#1488)
* Replace soft hyphen with visible hyphen if line break demands it

* Add changelog entry for #457

* Add soft hyphen support in readme
2024-01-02 08:00:59 -03:00
Balearica
2d5b4160ad
Made regex quantifier lazy to resolve #381 (#1349)
Co-authored-by: Your Name <you@example.com>
2024-01-02 08:00:22 -03:00
David
ebf404e4ae
#1486 fix newline items in lists (#1487)
* adds test case with line-breaks in list items

reproduces #1486

* use LineBreaker per item and only draw `firstLine` once

fixes #1486

* boyscout: consistent naming

* boyscout: test multiple line break versions

* update changelog for fix of #1486

---------

Co-authored-by: David <filecage@users.noreply.github.com>
2023-12-22 09:49:26 -03:00
Andrei Augustin
408dc4e9ba
Add PDF/UA subset (#1485)
* Added PDF/UA subset and its metadata

* Added PDF/UA metadata unit tests

* Added PDF/UA subset to accessibility docs

* Updated change log for PDF/UA subset
2023-12-17 16:11:46 -03:00
Luiz Américo
5bbd9a18cb
Support Jpeg Exif Orientation (#1482)
Co-authored-by: Franklin Strube <fstrube@morevang.com>
Co-authored-by: Luiz Américo Pereira Câmara <blikblum@users.noreply.github.com>
2023-12-03 07:48:00 -03:00
Andrei Augustin
c1d7700421
Support for PDF/A-2 and PDF/A-3 subsets (#1432)
* Added PDF/A-2 and PDF/A-3 subsets A and B

It seems like PDF/A-2 and PDF/A-3 are not very different from PDF/A-1 as far as the A and B subsets are concerned (A requires tagging which PDFKit supports already). With this change, we can let the generated PDF present itself as PDF/A-2 or PDF/A-3.

* Updated docs and changelog for new PDF/A subsets

* Fixed an issue where ICC profile path can be wrong for built package but good for tests
2023-03-09 08:00:08 -03:00
Andrei Augustin
ba4e7cb698
Fixed lint's unnecessary semicolon error (#1414)
* Fixed lint's unnecessary semicolon error

* Fixed pdfa1 colour profile test error

The directory where the colour profile is stored was changed, but the test was not updated.
2023-03-05 15:25:01 -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
Jernej Logar
4c5e73a06c
Tiling pattern support (#526) (#1311)
* tiling pattern support (foliojs#526)

based on strokovnjaka/pdfkit@b85dd55622

Co-authored-by: Jernej Logar <jernej.logar@plandela.si>
2021-10-24 07:50:52 -03:00
David Lilue
a41f33886f
Refactor on equality check function (#1280)
Avoidable 'if' statement
2021-07-13 18:52:41 -03:00
adrift2000
4700537d82
Fix for PDF accessibility check. (#1265) 2021-06-22 12:48:53 -03:00
Simon Osterlehner
131df9e0ae
Add option to define AcroForm fontSize. Fixes #1088 2021-05-29 18:12:36 -03:00
Subhi Al Hasan
6338314daf
Allow applying 'underline' and 'strike' text styling together on a text (#1253)
Co-authored-by: Subhi Al Hasan <subhi.al.hasan@freiheit.com>
2021-05-28 13:51:12 -03:00
Luiz Américo Pereira Câmara
1d5c905ba0 Use crypto-js instead of crypto in attachments 2021-03-28 09:54:40 -03:00
Steffen Matheis
3cd88b296c rename fileAttachmentAnnotation to fileAnnotation 2021-03-25 15:13:58 -03:00
Steffen Matheis
7219fd07a9 add support for embedded files and file attachment annotations 2021-03-25 15:13:58 -03:00
Jakub Valenta
63972499c0 lib/font/embedded: Don't put '@' in font tag
Otherwise Adobe Illustrator says "This document uses fonts that are
currently not available on your computer".
2021-03-24 15:25:51 -03:00
Ben Schmidt
923c495022 Correct marking bug and improve demo accessibility. 2021-01-15 16:43:49 -03:00
Ben Schmidt
e3fa4f7c7b Remove accidental tabs. 2021-01-15 16:43:49 -03:00
Ben Schmidt
e3442a9aa2 Add shortcut for elements containing only marked content. 2021-01-15 16:43:49 -03:00
Ben Schmidt
4c4a49ebff Guard against adding a structure element to more than one parent. 2021-01-15 16:43:49 -03:00
Ben Schmidt
2ed3782473 Guard against invalid structure element children. 2021-01-15 16:43:49 -03:00
Ben Schmidt
057215fc8f Guard against adding children to ended structure elements. 2021-01-15 16:43:49 -03:00
Ben Schmidt
9c0aaec172 Remove unnecessary constructors. 2021-01-15 16:43:49 -03:00
Ben Schmidt
d565f862c0 Fix linter warnings. 2021-01-15 16:43:49 -03:00
Ben Schmidt
c2ec121ab8 Support automatic marking and structure construction for text. 2021-01-15 16:43:49 -03:00