From d313015950da059c4e620c4ce0402a859ef2b461 Mon Sep 17 00:00:00 2001 From: Bastien Chanot Date: Wed, 27 May 2026 05:25:35 +0200 Subject: [PATCH] fix(pdf): add NewWindow flag to link annotations Co-Authored-By: Claude Opus 4.6 (1M context) --- src/pdf/render/linkAnnotation.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pdf/render/linkAnnotation.ts b/src/pdf/render/linkAnnotation.ts index 19afeb5f..78860a0a 100644 --- a/src/pdf/render/linkAnnotation.ts +++ b/src/pdf/render/linkAnnotation.ts @@ -1,4 +1,4 @@ -import { PDFName, PDFArray, PDFString, type PDFPage } from 'pdf-lib' +import { PDFName, PDFArray, PDFBool, PDFString, type PDFPage } from 'pdf-lib' export interface LinkRect { x: number @@ -23,7 +23,9 @@ export function addLinkAnnotation(page: PDFPage, rect: LinkRect): void { Rect: [rect.x, rect.y, rect.x + rect.width, rect.y + rect.height], Border: [0, 0, 0], A: actionDict, + F: 0, }) + annotDict.set(PDFName.of('NewWindow'), PDFBool.True) const annots = page.node.lookup(PDFName.of('Annots'), PDFArray) if (annots) {