0.5.6 - 2025-01-19
- Support for embedded files via the
embeddedFiles
property in the document definition.
- A bug that caused errors when reusing fonts or images across multiple documents.
0.5.5 - 2024-12-18
The minimum EcmaScript version has been raised to ES2022. Minimum build requirements have been raised to Node 20 and npm 10.
-
The functions
line()
,rect()
,circle()
, andpath()
to create graphics shapes with less code and better tool support. -
The functions
text()
,image()
,rows()
, andcolumns()
to create blocks with less code and better tool support. -
The function
span()
to create text spans with less code and better tool support. -
The functions
bold()
anditalic()
to conveniently create text spans with bold or italic styles. -
The
PdfMaker
class to render multiple documents with the same font configuration.const pdfMaker = new PdfMaker(config); pdfMaker.registerFont(await readFile('path/to/MyFont.ttf')); pdfMaker.registerFont(await readFile('path/to/MyFont-Bold.ttf')); const pdf1 = await pdfMaker.makePdf(doc1); const pdf2 = await pdfMaker.makePdf(doc2);
-
Fonts should now be registered with the
registerFont()
method on thePdfMaker
class. -
The
image
property of an image block now supportsdata:
,file:
, andhttp(s):
URLs. File names are relative to a resource root that must be set by thesetResourceRoot()
method on thePdfMaker
class.
TextAttrs
in favor ofTextProps
.BlockAttrs
in favor ofBlockProps
.InfoAttrs
in favor ofInfoProps
.CustomInfoAttrs
in favor ofCustomInfoProps
.Text
in favor ofTextSpan
.LineOpts
in favor ofStrokeProps
.RectOpts
in favor ofRectProps
.CircleOpts
in favor ofCircleProps
.PathOpts
in favor ofPathProps
.- The
fonts
property in a document definition. - The
images
property in a document definition. - The
makePdf
function in favor of themakePdf
method on thePdfMaker
class. - Using file paths as image sources in favor of
file:
URLs.
0.5.4 - 2024-02-25
- Text properties
fontStyle
andfontWeight
.
- The
image
property of an image block now supports a file name. When file names are used, the images don't need to be registered with the globalimages
property anymore.
- Text properties
bold
anditalic
in favor offontStyle: 'italic'
andfontWeight: 'bold'
.
- The optional
format
property of an image definition. The format is now auto-detected from the file content.
- Text in a text block will no longer break before the first row, which would result in an empty frame.
0.5.3 - 2023-09-28
- An edge case that could lead to a duplicated row after a page break has been fixed.
0.5.2 - 2023-07-06
- The
width
property of aBlock
now supports the valueauto
on all block types. When set toauto
, the block will shrink to the width of its contents.
0.5.1 - 2023-06-30
-
The property
margin
in a document definition now supports a function that returns the margin for a given page. -
Support for PNG images. A new, optional property
format
is added to image definitions. For PNG images, it must be set topng
(defaults tojpeg
).
-
In the PDF metadata, the fields "Creator" and "Producer" are no longer set to default values.
-
Consecutive newlines in texts are no longer collapsed. Blank lines are now rendered as expected.
-
Images registered in the document definition are now only included in the PDF when they are used in the document.
0.5.0 - 2023-05-18
-
When a graphics element has neither
lineColor
norfillColor
set, it is stroked by default. If alineWidth
but nolineColor
is set on an element that also has afillColor
, the element is now stroked with a black line. -
Rows in a
RowsBlock
will now break and continue on the next page when they do not fit. To prevent this, setbreakInside
toavoid
. -
Lines in a
TextBlock
will now break and continue on the next page when they do not fit. To prevent this, setbreakInside
toavoid
. -
The
lineJoin
property is no longer supported by the graphics typeCircle
.
-
Property
breakInside
to control page breaks inside a block onTextBlock
andRowsBlock
. The default isauto
. -
Property
insertAfterBreak
onRowsBlock
to insert an extra block after a page break. -
Properties
translate
,scale
,rotate
,skew
andmatrix
on all graphics elements to apply transformations.
0.4.2 - 2023-04-29
- Text property
letterSpacing
. - Support for SVG paths in
graphics
usingPath
elements.
0.4.1 - 2023-04-15 (not available)
Note: This npm package [email protected]
had to be unpublished because of
a build error. Do to npm's policy, the version number cannot be reused.
- Text rise is now reset properly and does not affect subsequent text elements anymore.
0.4.0 - 2023-03-27
- Page margins are now relative to the header and footer to let the contents adjust to a dynamic header and footer height.
- Text property
rise
for superscripts and subscripts. - Block property
verticalAlign
for vertical alignment of columns. - Property
lineDash
for graphics shapes.
0.3.3 - 2023-03-03
- An error was thrown when rendering a document definition that includes
a
header
but nofooter
.
0.3.2 - 2022-10-12
- Property
customData
to include custom data in the PDF document catalog.
0.3.1 - 2022-08-25
- PDF now has a trailing newline
- Link annotations are now compatible with PDF/A
- The PDF trailer now has an ID (needed for PDF/A compatibility)
0.3.0 - 2022-07-28
- Renamed block types
Paragraph
toTextBlock
,Image
toImageBlock
,Columns
toColumnsBlock
, andRows
toRowsBlock
. AddedEmptyBlock
for blocks that don't have any content.
- Graphics shape type
circle
. - Properties
lineOpacity
andfillOpacity
on graphics shapes. - Property
padding
on all block types. - Properties
breakBefore
andbreakAfter
on top-level blocks. - Margins and paddings are highlighted when guides are enabled.
- Property
imageAlign
marked optional in type definition - Copied text from a PDF document now includes headers and footers in correct order
0.2.0 - 2022-06-08
- Properties
strokeWidth
,strokeColor
have been renamed tolineWidth
,lineColor
. - Images are horizontally centered by default.
- Text is now vertically aligned in text rows.
- Properties
lineCap
andlineJoin
. - Support for functions in the
graphics
property. - Property
imageAlign
for horizontal alignment. - Property
pageSize
andpageOrientation
.
- Position of anchors in PDF does not include the padding or paragraphs anymore.
0.1.0 - 2022-04-25
First public version.