-
-
Notifications
You must be signed in to change notification settings - Fork 854
Open
Conversation
What?
Adds PDFPage.drawLink() so users can add hyperlinks easily.
Why?
I personally needed to add several hyperlinks to a PDF. I added createPageLinkAnnotation per the suggestion in #555, got it working in our project, and then generalised it for broader use.
How?
This follows @Hopding 's suggestion in #555.
I dug into the PDF Specification to double-check the possible setting for Border and Colour.
I have not provided all possible options; I wanted something simple and working before adding extra options.
Testing?
Added basic Unit test in PDFPage.spec.ts.
New Dependencies?
No.
Screenshots
Suggested Reading?
Yes, read the PDF Spec.
Anything Else?
Nope.
Checklist
- I read CONTRIBUTING.md.
- I read MAINTAINERSHIP.md#pull-requests.
- I added/updated unit tests for my changes.
- [] I added/updated integration tests for my changes.
- [] I ran the integration tests.
- I tested my changes in Node, Deno, and the browser.
- I viewed documents produced with my changes in Adobe Acrobat, Foxit Reader, Firefox, and Chrome.
- I added/updated doc comments for any new/modified public APIs.
- My changes work for both new and existing PDF files.
- I ran the linter on my changes.
Haoran Un
added 3 commits
October 22, 2024 14:02
Author
|
PS: the CircleCI build seems to be broken. |
|
Any updates on this one? It is a helpful feature, and it's been 4 months since the build was broken |
folknor
added a commit
to folknor/pdf-lib
that referenced
this pull request
Jan 29, 2026
Add PDFPage.drawLink() method that creates clickable link annotations.
Links can optionally have visible borders with customizable width and color.
Example usage:
```js
page.drawLink({
url: 'https://pdf-lib.js.org',
x: 50,
y: 50,
width: 200,
height: 20,
borderWidth: 1,
borderColor: rgb(0, 0, 1),
})
```
Fixes Hopding/pdf-lib#1691
Coded by an LLM.
Links can optionally have visible borders with customizable width and color.
Example usage:
```js
page.drawLink({
url: 'https://pdf-lib.js.org',
x: 50,
y: 50,
width: 200,
height: 20,
borderWidth: 1,
borderColor: rgb(0, 0, 1),
})
```
Fixes Hopding/pdf-lib#1691
Coded by an LLM.
Maxwbh
pushed a commit
to Maxwbh/pdf-lib
that referenced
this pull request
Jan 31, 2026
Analyzed popular forks and pending PRs to identify potential improvements:
- SVG support (from cantoo-scribe/pdf-lib fork)
- PDF encryption/decryption (from pdf-lib-plus-encrypt fork)
- Incremental save for digital signatures (from pdf-lib-incremental-save)
- Rounded rectangles (from pdfme/pdf-lib fork)
- Hyperlinks support (PR Hopding#1691)
- Form field improvements (PRs Hopding#1748, Hopding#1758)
https://claude.ai/code/session_01T85UagjFeYdf4vUW9pzeyn
- SVG support (from cantoo-scribe/pdf-lib fork)
- PDF encryption/decryption (from pdf-lib-plus-encrypt fork)
- Incremental save for digital signatures (from pdf-lib-incremental-save)
- Rounded rectangles (from pdfme/pdf-lib fork)
- Hyperlinks support (PR Hopding#1691)
- Form field improvements (PRs Hopding#1748, Hopding#1758)
https://claude.ai/code/session_01T85UagjFeYdf4vUW9pzeyn
14 tasks
Maxwbh
added a commit
to Maxwbh/pdf-lib
that referenced
this pull request
Jan 31, 2026
Features:
- PDF encryption/decryption (RC4-40/128, AES-128/256) with granular permissions
- Incremental save for digital signature preservation
- Hyperlink annotations (external URLs and internal page navigation)
- Node.js 22 compatibility with TypeScript 5.3, Rollup 4, Jest 29
Breaking changes: None (backward compatible with pdf-lib 1.17.1)
Based on community forks: pdf-lib-plus-encrypt, pdf-lib-incremental-save, PR Hopding#1691
All 668 tests passing.
- PDF encryption/decryption (RC4-40/128, AES-128/256) with granular permissions
- Incremental save for digital signature preservation
- Hyperlink annotations (external URLs and internal page navigation)
- Node.js 22 compatibility with TypeScript 5.3, Rollup 4, Jest 29
Breaking changes: None (backward compatible with pdf-lib 1.17.1)
Based on community forks: pdf-lib-plus-encrypt, pdf-lib-incremental-save, PR Hopding#1691
All 668 tests passing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.