github bpampuch/pdfmake 0.3.16

one hour ago
  • Added pdfmake.setUrlResourceConcurrency(concurrency) to limit concurrent URL resource downloads per document (default: 5)

  • Added pdfmake.registerUrlProtocol(protocol, handler) to support custom URL protocols and replace existing protocol handlers; omitting the handler uses the default fetch downloader

    Example of registering the blob protocol with the default fetch downloader:

     pdfmake.registerUrlProtocol('blob');

    Example of registering a custom asset protocol with a custom downloader:

     pdfmake.registerUrlProtocol('asset', async (url, headers, validateUrlAccessPolicy) => {
    
     	// Fetch logoBytes using url and headers, eg:
     	// var logoBytes = await fs.readFile(filename);
    
     	// Call validateUrlAccessPolicy(targetUrl) before following each redirect; it throws if access is denied.
     	// Return the final URL after all redirects, or the original url if there were none.
     	return { buffer: logoBytes, url: finalUrl };
     });

    Usage in a document definition:

     pdfmake.createPdf({
     	content: [{ image: 'logo' }],
     	images: { logo: 'asset://logo' }
     });

    The handler receives the URL, request headers and a validateUrlAccessPolicy(url) function, and returns the binary data and final URL. Call validateUrlAccessPolicy(targetUrl) before following each redirect; it throws if access is denied.

  • Added pdfmake.unregisterUrlProtocol(protocol) to remove a URL protocol handler and clear its shared resource cache

  • Added the lineHeightMode style property to control how lineHeight is applied:

    • 'fontHeight' (default; previous behavior) - the line height is the font's natural height multiplied by lineHeight
    • 'css' - the line height is fontSize * lineHeight and the text is vertically centered in the line box (half-leading), as in CSS
  • Upgrade Unicode Line Breaking Algorithm (UAX #14) to Unicode 18.0.0

  • Fixed double-counted horizontal margins when centering or right-aligning images, SVGs, QR codes and canvases

  • Fixed canvas paths ignoring canvas positioning and alignment, and not reserving space for their drawn content

  • Fixed list bullet and number markers not following the alignment of centered or right-aligned lists

  • Fixed long text in full-width colSpan cells unnecessarily widening auto columns in tables with * columns

  • Fixed line breaking across inline fragments and preserved explicit line breaks with noWrap

  • Fixed PDF hyperlinks containing Unicode characters, including internationalized domain names

  • Fixed pagination with dontBreakRows so rows connected by rowSpan stay together when they fit, and oversized groups retain their borders when split across pages

  • Fixed subsequent sections using the wrong page size after an oversized unbreakable block failed to fit

  • Fixed misplaced ordered list markers at page breaks

  • Fixed ordered list markers being cut off at the first space when the separator contains spaces

Don't miss a new pdfmake release

NewReleases is sending notifications on new releases.