Releases: Hopding/pdf-lib
Releases · Hopding/pdf-lib
v0.6.2
- Add
sizeOfFontAtHeight
methods to font factories. - Fix cross reference table/stream offset calculation bug.
- Fix
PDFString
serialization (remove incorrect escapes). - Fix parser hang for certain PDFs.
- Fix object stream decoding for certain PDFs. Thanks @mlecoq!
v0.6.1
v0.6.0
- Add methods to measure width and height of text strings in both standard and embedded fonts.
- Allow use of the full range of UTF-8 and UTF-16 characters supported by embedded fonts.
- Allow use of ZapfDingbats and Symbol standard fonts with the proper encodings.
PDFDocument.embedFont
is now deprecated. Please usePDFDocument.embedNonstandardFont
instead.- When drawing text (with the
drawText()
ordrawLinesOfText()
operators, for example), please be sure to use thefont.encodeText()
method for the font you are using. This is highly recommended for both standard and nonstandard fonts (and is required if you want to use characters outside the ascii range). - The following examples demonstrate usage of the new
font.widthOfTextAtSize()
andfont.heightOfFontAtSize()
methods to measure text, as well as usage of thefont.encodeText()
method to encode characters outside the ascii range.- https://github.com/Hopding/pdf-lib#embed-font-and-measure-text
- https://github.com/Hopding/pdf-lib/tree/master/examples/measuring_text/node/
- https://github.com/Hopding/pdf-lib/blob/master/__integration_tests__/tests/test11.ts
- https://github.com/Hopding/pdf-lib/blob/master/__integration_tests__/tests/test12.ts
v0.5.1
v0.5.0
v0.4.1
v0.4.0
- Add support for all characters in the WinAnsi character set for the Standard 14 Fonts. This allows certain non-ascii characters to be used when drawing text in PDFs (example). Thanks @jerp!
- Several parser bug fixes. These allow a wider set of PDFs to be edited and modified without errors. Thanks @gregbacchus!
v0.3.0
- Add support for Object Streams and Cross Reference Streams when saving documents. They are now used by default when calling
PDFDocumentWriter.saveToBytes(pdfDoc)
, but they can be turned off withPDFDocumentWriter.saveToBytes(pdfDoc, { useObjectStreams: false })
. - Add rotation and skewing options to
drawEllipse
,drawCircle
,drawImage
,drawRectangle
,drawSquare
,drawText
, anddrawLinesOfText
operators.
v0.2.1
- Fix PDF parsing bug due to missing EOL characters that are supposed to precede the
endstream
keyword. - Add automatic content stream normalization.
- Add argument validation to
PDFDocumentFactory.load()
method to ensure users pass it aUint8Array
(instead of, say, aBlob
)
v0.2.0
- Add ES6 module build to NPM release (in the
es
folder). - Add UMD build to NPM release (
dist/pdf-lib.js
). - Add minified UMD build to NPM release (
dist/pdf-lib.min.js
). - Fix issue with compiled TypeScript declaration files not having the same relative import paths as the compiled JS files.
- Change import paths:
pdf-lib/x/y/z
is no longer valid.pdf-lib/lib/x/y/z
is the CommonJS module.pdf-lib/es/x/y/z
is the ES6 module.pdf-lib
now directly exports all public classes and functions. For example:
// v0.1.0 import { PDFDocumentWriter, PDFDocumentFactory } from 'pdf-lib/core/pdf-document'; import { drawText } from 'pdf-lib/helpers/pdf-operators/composite'; // Now import { PDFDocumentWriter, PDFDocumentFactory, drawText, } from 'pdf-lib';