# Is it possible to rewrite Hyperlinks embedded in PDF using PDF.JS Express?

**URL:** https://pdfjs.community/t/is-it-possible-to-rewrite-hyperlinks-embedded-in-pdf-using-pdf-js-express/2293
**Category:** Technical Support
**Tags:** pdfjs-express
**Created:** [January 12, 2023, 1:58pm UTC](https://pdfjs.community/t/is-it-possible-to-rewrite-hyperlinks-embedded-in-pdf-using-pdf-js-express/2293 "2023-01-12T13:58:24Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![nickmyersdt](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/nickmyersdt/32/628_2.png) [@nickmyersdt](https://pdfjs.community/u/nickmyersdt)
#### Post date: [January 12, 2023, 1:58pm UTC](https://pdfjs.community/t/is-it-possible-to-rewrite-hyperlinks-embedded-in-pdf-using-pdf-js-express/2293/1 "2023-01-12T13:58:24Z")

</div>

**Which product are you using?**  
PDF.js Express Viewer

**PDF.js Express Version**  
8.1.1

**Detailed description of issue**  
Customers use our website to view PDFs via proxies.

The links in our PDFs break their proxy behaviour.

E.g.

User goes to [https://www-website-com.myproxy.tld/file](https://www-website-com.myproxy.tld/file) and views PDF  
PDF contains link to [https://www.website.com/new](https://www.website.com/new)  
User clicks link, and is no longer loading the website via their proxy (so is effectively signed out)

The proxies re-write URLs for anything embedded in HTML, but can’t do the same for PDFs

**Expected behaviour**

Not expected, just wondering whether there’s a mechanism to re-write the URLs of embedded hyperlinks. E.g. something would see non-proxied url and change the bit before /new to the hostname.

**Does your issue happen with every document, or just one?**  
N/A

**Link to document**  
N/A

**Code snippet**  
N/A

---

<div class="post-metadata">

### Author: ![nickmyersdt](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/nickmyersdt/32/628_2.png) [@nickmyersdt](https://pdfjs.community/u/nickmyersdt)
#### Post date: [January 12, 2023, 5:52pm UTC](https://pdfjs.community/t/is-it-possible-to-rewrite-hyperlinks-embedded-in-pdf-using-pdf-js-express/2293/3 "2023-01-12T17:52:46Z")

</div>

I tried to use `getAnnotationsManager().getAnnotationsList()` but that didn’t result in objects that made sense to me.

Eg.

```javascript
docViewer.on("annotationsLoaded", () => {
  console.log("annotations loaded");
  const annots = annotManager.getAnnotationsList();
  annots.forEach((annotation) => {
    //console.dir(annotation);
  });
});

```

I wonder if I can do this using `pdf-lib` but I don’t know how I’d pass the PDF into the `WebViewer`

---

<div class="post-metadata">

### Author: ![kkim](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kkim](https://pdfjs.community/u/kkim)
#### Post date: [January 12, 2023, 7:05pm UTC](https://pdfjs.community/t/is-it-possible-to-rewrite-hyperlinks-embedded-in-pdf-using-pdf-js-express/2293/4 "2023-01-12T19:05:06Z")

</div>

Hi there,

Thank you for contacting pdf.js express forums,

For the hyperlinks in the PDF, you can see them as an annotation, for example in the demo site: [PDF.js Viewer Demo | PDF.js Express](https://pdfjs.express/demo)

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/9/943ed39ae286743b0292c69122fbaee56c7c1f28.jpeg)

And these are types of link annotations we support:

> **[Create Annotations in JavaScript PDF Viewer | PDF.js Express SDK](https://pdfjs.express/documentation/annotation/add-link-to-annotation.8#programmatically-add-hyperlink-to-existing-annotation)**

Please note that the above guide is for express Pro, and the Viewer does not support link annotations: [Internal links don't work in PDF.js Express viewer - #3 by system](https://pdfjs.community/t/internal-links-dont-work-in-pdf-js-express-viewer/1168/3)

Best regards,  
Kevin Kim

---

<div class="post-metadata">

### Author: ![nickmyersdt](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/nickmyersdt/32/628_2.png) [@nickmyersdt](https://pdfjs.community/u/nickmyersdt)
#### Post date: [January 12, 2023, 8:05pm UTC](https://pdfjs.community/t/is-it-possible-to-rewrite-hyperlinks-embedded-in-pdf-using-pdf-js-express/2293/5 "2023-01-12T20:05:20Z")

</div>

Good to know, thank you Kevin!
