fix(pdf): add NewWindow flag to link annotations
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
cae585b564
commit
d313015950
1 file changed
+3
-1
@@ -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 {
|
export interface LinkRect {
|
||||||
x: number
|
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],
|
Rect: [rect.x, rect.y, rect.x + rect.width, rect.y + rect.height],
|
||||||
Border: [0, 0, 0],
|
Border: [0, 0, 0],
|
||||||
A: actionDict,
|
A: actionDict,
|
||||||
|
F: 0,
|
||||||
})
|
})
|
||||||
|
annotDict.set(PDFName.of('NewWindow'), PDFBool.True)
|
||||||
|
|
||||||
const annots = page.node.lookup(PDFName.of('Annots'), PDFArray)
|
const annots = page.node.lookup(PDFName.of('Annots'), PDFArray)
|
||||||
if (annots) {
|
if (annots) {
|
||||||
|
|||||||
Reference in new issue
Block a user