question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Links not rendering as links in PDF

See original GitHub issue

Steps to reproduce

If I have a simple link in a page that I print to PDF, it gives the link text followed by the URL in parentheses instead of a clickable link. e.g. <a href="https://www.some-website.com">Link Text</a> would render as Link Text (https://www.some-website.com) It doesn’t fail like this on all links, but it does fail on simple links. I’m not sure what is the complication that makes it work. If I knew, I’d at least be able to generate links that worked on my internal webpage that I’m trying to print to PDF.

  • Puppeteer version: 1.16.0
  • Platform / OS version: Ubuntu 16.04.6 LTS
  • URLs (if applicable): nytimes.com is fine but myballard.com is not
  • Node.js version: 10.15.3

What steps will reproduce the problem?

const puppeteer = require('puppeteer');

(async () => {
    const browser = await puppeteer.launch({headless: true});
    const page = await browser.newPage();
    var url = process.argv[2];
    var outputFile = process.argv[3];
    try {
        await page.goto(url);
        await page.pdf({path: outputFile,
                        width: "8.5in",
                        height: "11in"});
        }
     catch (error) {
         console.log(error)
        }
     await browser.close();
     }
)();

Bad links show up in this generated pdf: nodejs simple-print-url-to-pdf.js https://www.myballard.com bad_link_example.pdf

Good links show up in this generated pdf: nodejs simple-print-url-to-pdf.js https://www.nytimes.com good_link_example.pdf

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
msarshacommented, Jul 23, 2019

@JulieGoldberg Can you share your work-around ?

1reaction
jasonhoo95commented, Dec 12, 2019

hahah actually no need change anything u just put a href link it will able generate link in pdf alrdy… hahah the library is amazing keep it up pls do more enhancement make it better…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why are Hyperlinks not Working in PDF? Fix it!
When converting another file format to PDF, the URLs may not be picked up automatically. That's probably because you didn't have the setting...
Read more >
Pdf Links Not Working? Here's How To Fix It - TechNewsToday
How to Fix PDF Links Not Working? · Insert the Correct URL · Enable the Anchor Links · Set Default PDF Viewer ·...
Read more >
Hyperlinks Not Working in PDF? Check the Solutions Here
Many factors can be the reason why hyperlinks are not working in your PDF. You might forget to turn on the settings in...
Read more >
Links not rendering as links in PDF · Issue #4482 - GitHub
If I have a simple link in a page that I print to PDF, it gives the link text followed by the URL...
Read more >
Solution: PDF Hyperlinks not Working, Not Clickable
Go to Office Orb button in top-left corner and then select Save As option. Then click PDF or XPS. Save the file.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found