From f6db3b19b70e7ba245ef96b244f21d68fe710c79 Mon Sep 17 00:00:00 2001 From: Tim Werner Date: Fri, 15 May 2026 12:43:36 +0200 Subject: [PATCH 1/6] [pdfmake] add missing Node.js-only type definitions for setUrlAccessPolicy and setLocalAccessPolicy --- types/pdfmake/index.d.ts | 11 ++++++++++- types/pdfmake/test/pdfmake-module-server-tests.ts | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/types/pdfmake/index.d.ts b/types/pdfmake/index.d.ts index 507e810d0f7b14..3dd74e255accc3 100644 --- a/types/pdfmake/index.d.ts +++ b/types/pdfmake/index.d.ts @@ -9,8 +9,8 @@ import { TVirtualFileSystem, } from "./interfaces"; -export type { TCreatedPdf }; export type { Alignment, Content, CustomTableLayout, Size, Style, Table, TableCell, TableLayout } from "./interfaces"; +export type { TCreatedPdf }; export function createPdf( documentDefinitions: TDocumentDefinitions, @@ -38,4 +38,13 @@ export function addVirtualFileSystem(vfs: TVirtualFileSystem): void; */ export function addFontContainer(fontContainer: TFontContainer): void; +/** + * **Note:** Only supported in Node.js. + */ +export function setUrlAccessPolicy(callback: (url: string) => boolean): void; +/** + * **Note:** Only supported in Node.js. + */ +export function setLocalAccessPolicy(callback: (path: string) => boolean): void; + export as namespace pdfMake; diff --git a/types/pdfmake/test/pdfmake-module-server-tests.ts b/types/pdfmake/test/pdfmake-module-server-tests.ts index 8322f5649c7734..011aff4940dc23 100755 --- a/types/pdfmake/test/pdfmake-module-server-tests.ts +++ b/types/pdfmake/test/pdfmake-module-server-tests.ts @@ -36,3 +36,6 @@ pdfMake.setProgressCallback(progress => console.log("Creating pdf: ", progress * pdfMake.createPdf(dd, options).write("fileName.pdf").then(() => { console.log("PDF file written"); }); + +pdfMake.setUrlAccessPolicy(url => url.startsWith("")); +pdfMake.setLocalAccessPolicy(path => path.startsWith("")); From c483643ce6de4612720c1ecf538009006383a674 Mon Sep 17 00:00:00 2001 From: Tim Werner Date: Fri, 15 May 2026 19:54:08 +0200 Subject: [PATCH 2/6] [pdfmake] add verticalAlignment for table cell --- types/pdfmake/interfaces.d.ts | 7 +++++++ types/pdfmake/test/pdfmake-examples-tests.ts | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/types/pdfmake/interfaces.d.ts b/types/pdfmake/interfaces.d.ts index ba65d2e761c2c1..b6d2748661ee51 100755 --- a/types/pdfmake/interfaces.d.ts +++ b/types/pdfmake/interfaces.d.ts @@ -528,6 +528,13 @@ export interface TableCellProperties { * Defaults to `1`. */ overlayOpacity?: number | null | undefined; + + /** + * Vertical alignment of the cell's content. + * + * Defaults to `top`. + */ + verticalAlignment?: "top" | "middle" | "bottom" | undefined; } /** diff --git a/types/pdfmake/test/pdfmake-examples-tests.ts b/types/pdfmake/test/pdfmake-examples-tests.ts index 7f2407e878e522..c75d8185cbfed3 100644 --- a/types/pdfmake/test/pdfmake-examples-tests.ts +++ b/types/pdfmake/test/pdfmake-examples-tests.ts @@ -2423,6 +2423,18 @@ const tables: TDocumentDefinitions = { ], }, }, + { + table: { + headerRows: 1, + widths: [ '*', 'auto', 100, '*' ], + + body: [ + [ 'First', 'Second', 'Third', 'The last one' ], + [ 'Value 1', 'Value 2', 'Value 3', 'Value 4' ], + [ { text: 'Bold value', verticalAlignment: "middle" }, 'Val 2', 'Val 3', 'Val 4' ] + ] + } + } ], styles: { header: { From 17b78b721dba63b9e244edd8d58cac47c88e2a8d Mon Sep 17 00:00:00 2001 From: Tim Werner Date: Fri, 15 May 2026 19:54:51 +0200 Subject: [PATCH 3/6] [pdfmake] add types for outlines and bookmarks --- types/pdfmake/interfaces.d.ts | 18 ++++++++++ types/pdfmake/test/pdfmake-examples-tests.ts | 36 ++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/types/pdfmake/interfaces.d.ts b/types/pdfmake/interfaces.d.ts index b6d2748661ee51..2a43c16f013d2e 100755 --- a/types/pdfmake/interfaces.d.ts +++ b/types/pdfmake/interfaces.d.ts @@ -1023,6 +1023,24 @@ export interface ContentText extends ContentLink, ContentBase, ForbidOtherElemen * below one another, but as inline text in a single paragraph. */ text: Content; + /** + * Adds this node to the PDF outline/bookmark tree. + * + * Outlines are hierarchical navigation entries shown in the PDF viewer. + */ + outline?: boolean; + /** + * Overrides the displayed bookmark label. + */ + outlineText?: string; + /** + * Marks the bookmark as expanded/opened by default. + */ + outlineExpanded?: boolean; + /** + * Assigns this bookmark to the parent entry with the given `id`. + */ + outlineParentId?: string; } /** diff --git a/types/pdfmake/test/pdfmake-examples-tests.ts b/types/pdfmake/test/pdfmake-examples-tests.ts index c75d8185cbfed3..72107f89055438 100644 --- a/types/pdfmake/test/pdfmake-examples-tests.ts +++ b/types/pdfmake/test/pdfmake-examples-tests.ts @@ -2466,6 +2466,42 @@ const tables: TDocumentDefinitions = { }, }; +const outlinesAndBookmarks: TDocumentDefinitions = { + content: [ + { + text: 'First header in bookmarks', + outline: true, + }, + { + text: 'Second header with custom bookmark', + outline: true, + outlineText: 'Custom bookmark text', + }, + { + text: 'Structured bookmarks', + id: 'structured-bookmarks', + outline: true, + outlineExpanded: true + }, + { + text: 'First subheader', + outline: true, + outlineParentId: 'structured-bookmarks' + }, + { + text: 'Second subheader', + outline: true, + outlineParentId: 'structured-bookmarks' + }, + { + text: 'Third subheader', + outline: true, + outlineParentId: 'structured-bookmarks', + id: 'third-subheader' + } + ] +}; + const textDecorations: TDocumentDefinitions = { content: [ { text: "Higlighted text", fontSize: 18, background: "yellow" }, From 03baa45f449d6b8200f4f5a6bc1747858ac14d3b Mon Sep 17 00:00:00 2001 From: Tim Werner Date: Fri, 15 May 2026 19:55:13 +0200 Subject: [PATCH 4/6] [pdfmake] add types for snakingColumns --- types/pdfmake/interfaces.d.ts | 8 ++++++++ types/pdfmake/test/pdfmake-examples-tests.ts | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/types/pdfmake/interfaces.d.ts b/types/pdfmake/interfaces.d.ts index 2a43c16f013d2e..596788c85cb9d3 100755 --- a/types/pdfmake/interfaces.d.ts +++ b/types/pdfmake/interfaces.d.ts @@ -1049,6 +1049,14 @@ export interface ContentText extends ContentLink, ContentBase, ForbidOtherElemen export interface ContentColumns extends ContentBase, ForbidOtherElementProperties<"columns"> { /** Divides the given elements into multiple columns. */ columns: Column[]; + /** + * Enables snaking columns (newspaper-style columns), where content flows vertically through the first column + * and continues at the top of the next columns as needed. Only the first column should contain content; + * the remaining columns act as empty overflow targets. + * + * Note: Recursive snaking columns are not supported. + */ + snakingColumns?: boolean } /** diff --git a/types/pdfmake/test/pdfmake-examples-tests.ts b/types/pdfmake/test/pdfmake-examples-tests.ts index 72107f89055438..e60dfe42db3cbf 100644 --- a/types/pdfmake/test/pdfmake-examples-tests.ts +++ b/types/pdfmake/test/pdfmake-examples-tests.ts @@ -404,6 +404,19 @@ const columnsSimple: TDocumentDefinitions = { }, }; +const columnsSnake: TDocumentDefinitions = { + content: [ + { + columns: [ + {text: "Long content", width: '*'}, + {text: '', width: '*'}, + {text: '', width: '*'} + ], + snakingColumns: true + } + ] +}; + const images: TDocumentDefinitions = { content: [ "pdfmake (since it's based on pdfkit) supports JPEG and PNG format", From dd99ac135013cfa80f7e5f7aa8597f276d00036c Mon Sep 17 00:00:00 2001 From: Tim Werner Date: Fri, 15 May 2026 20:06:17 +0200 Subject: [PATCH 5/6] [pdfmake] add types for outlines in toc --- types/pdfmake/interfaces.d.ts | 5 +++++ types/pdfmake/test/pdfmake-examples-tests.ts | 1 + 2 files changed, 6 insertions(+) diff --git a/types/pdfmake/interfaces.d.ts b/types/pdfmake/interfaces.d.ts index 596788c85cb9d3..3a14f77318be4a 100755 --- a/types/pdfmake/interfaces.d.ts +++ b/types/pdfmake/interfaces.d.ts @@ -1702,6 +1702,11 @@ export interface TableOfContent { * Defaults to the system locale. */ sortLocale?: string | undefined; + + /** + * If set to `true`, adds all items to outlines / bookmarks (any existing outline settings on texts are respected) + */ + outlines?: boolean | undefined; } /** diff --git a/types/pdfmake/test/pdfmake-examples-tests.ts b/types/pdfmake/test/pdfmake-examples-tests.ts index e60dfe42db3cbf..7620bae091346b 100644 --- a/types/pdfmake/test/pdfmake-examples-tests.ts +++ b/types/pdfmake/test/pdfmake-examples-tests.ts @@ -2599,6 +2599,7 @@ const toc: TDocumentDefinitions = { numberStyle: { bold: true }, sortBy: "page", sortLocale: "cs", + outlines: true, }, }, { From ff4827e6bdb60cf23d488ff922c2b3985488f059 Mon Sep 17 00:00:00 2001 From: Tim Werner Date: Fri, 15 May 2026 20:41:59 +0200 Subject: [PATCH 6/6] chore: fmt --- types/pdfmake/interfaces.d.ts | 2 +- types/pdfmake/test/pdfmake-examples-tests.ts | 92 ++++++++++---------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/types/pdfmake/interfaces.d.ts b/types/pdfmake/interfaces.d.ts index 3a14f77318be4a..6498a8fd644634 100755 --- a/types/pdfmake/interfaces.d.ts +++ b/types/pdfmake/interfaces.d.ts @@ -1056,7 +1056,7 @@ export interface ContentColumns extends ContentBase, ForbidOtherElementPropertie * * Note: Recursive snaking columns are not supported. */ - snakingColumns?: boolean + snakingColumns?: boolean; } /** diff --git a/types/pdfmake/test/pdfmake-examples-tests.ts b/types/pdfmake/test/pdfmake-examples-tests.ts index 7620bae091346b..d564f8519b87f0 100644 --- a/types/pdfmake/test/pdfmake-examples-tests.ts +++ b/types/pdfmake/test/pdfmake-examples-tests.ts @@ -408,13 +408,13 @@ const columnsSnake: TDocumentDefinitions = { content: [ { columns: [ - {text: "Long content", width: '*'}, - {text: '', width: '*'}, - {text: '', width: '*'} + { text: "Long content", width: "*" }, + { text: "", width: "*" }, + { text: "", width: "*" }, ], - snakingColumns: true - } - ] + snakingColumns: true, + }, + ], }; const images: TDocumentDefinitions = { @@ -2439,15 +2439,15 @@ const tables: TDocumentDefinitions = { { table: { headerRows: 1, - widths: [ '*', 'auto', 100, '*' ], + widths: ["*", "auto", 100, "*"], body: [ - [ 'First', 'Second', 'Third', 'The last one' ], - [ 'Value 1', 'Value 2', 'Value 3', 'Value 4' ], - [ { text: 'Bold value', verticalAlignment: "middle" }, 'Val 2', 'Val 3', 'Val 4' ] - ] - } - } + ["First", "Second", "Third", "The last one"], + ["Value 1", "Value 2", "Value 3", "Value 4"], + [{ text: "Bold value", verticalAlignment: "middle" }, "Val 2", "Val 3", "Val 4"], + ], + }, + }, ], styles: { header: { @@ -2480,39 +2480,39 @@ const tables: TDocumentDefinitions = { }; const outlinesAndBookmarks: TDocumentDefinitions = { - content: [ - { - text: 'First header in bookmarks', - outline: true, - }, - { - text: 'Second header with custom bookmark', - outline: true, - outlineText: 'Custom bookmark text', - }, - { - text: 'Structured bookmarks', - id: 'structured-bookmarks', - outline: true, - outlineExpanded: true - }, - { - text: 'First subheader', - outline: true, - outlineParentId: 'structured-bookmarks' - }, - { - text: 'Second subheader', - outline: true, - outlineParentId: 'structured-bookmarks' - }, - { - text: 'Third subheader', - outline: true, - outlineParentId: 'structured-bookmarks', - id: 'third-subheader' - } - ] + content: [ + { + text: "First header in bookmarks", + outline: true, + }, + { + text: "Second header with custom bookmark", + outline: true, + outlineText: "Custom bookmark text", + }, + { + text: "Structured bookmarks", + id: "structured-bookmarks", + outline: true, + outlineExpanded: true, + }, + { + text: "First subheader", + outline: true, + outlineParentId: "structured-bookmarks", + }, + { + text: "Second subheader", + outline: true, + outlineParentId: "structured-bookmarks", + }, + { + text: "Third subheader", + outline: true, + outlineParentId: "structured-bookmarks", + id: "third-subheader", + }, + ], }; const textDecorations: TDocumentDefinitions = {