We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am trying to add links to the same page, however when Inam trying to merge the PDfs it is getting lost unlike external links,
The external links on the page are working fine but the links to the pages are not working
I want a way to tag internal pages as well
const fs = require('fs'); const puppeteer = require("puppeteer"); const html = `<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Document</title> </head> <body> <a href="https://www.google.fr/maps/@50.6288598,3.0621533,14z">Google.fr maps</a> <ul> <li><a href="#test1">Test 1</a></li> <li><a href="#test2">Test 2</a></li> <li><a href="#test3">Test 3</a></li> <li><a href="#test4">Test 4</a></li> <li><a href="#test5">Test 5</a></li> </ul> <h1 id="test1" style="margin-bottom: 500px">Test 1 title</h1> <h1 id="test2" style="margin-bottom: 500px">Test 2 title</h1> <h1 id="test3" style="margin-bottom: 500px">Test 3 title</h1> <h1 id="test4" style="margin-bottom: 500px">Test 4 title</h1> <h1 id="test5" style="margin-bottom: 500px">Test 5 title</h1> </body> </html>`; (async () => { const browser = await puppeteer.launch({ headless: false, devtools: true, args: [ "--disable-web-security", "--disable-features=IsolateOrigins", "--disable-site-isolation-trials", ], }); const page1 = await browser.newPage(); await page1.setContent(html.toString("utf-8")); const pdfBuffer1 = await page1.pdf(); const writeStream1 = fs.createWriteStream("./example1.pdf"); writeStream1.write(pdfBuffer1); writeStream1.close(); const page2 = await browser.newPage(); await page2.setContent(html.toString("utf-8")); const pdfBuffer2 = await page2.pdf(); const writeStream2 = fs.createWriteStream("./example2.pdf"); writeStream2.write(pdfBuffer2); writeStream2.close(); await browser.close(); })();
(async () => { const mergedPdf = await PDFDocument.create(); const pdfA = await PDFDocument.load(fs.readFileSync("example1.pdf")); const pdfB = await PDFDocument.load(fs.readFileSync("example1.pdf")); const copiedPagesA = await mergedPdf.copyPages(pdfA, pdfA.getPageIndices()); copiedPagesA.forEach((page) => mergedPdf.addPage(page)); const copiedPagesB = await mergedPdf.copyPages(pdfB, pdfB.getPageIndices()); copiedPagesB.forEach((page) => mergedPdf.addPage(page)); const mergedPdfFile = await mergedPdf.save(); const writeStream = fs.createWriteStream("./final.pdf"); writeStream.write(mergedPdfFile); writeStream.close(); })();
1.17.1
Node
Kindly help me out as this is urgent!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What were you trying to do?
I am trying to add links to the same page, however when Inam trying to merge the PDfs it is getting lost unlike external links,
How did you attempt to do it?
What actually happened?
The external links on the page are working fine but the links to the pages are not working
What did you expect to happen?
I want a way to tag internal pages as well
How can we reproduce the issue?
Version
1.17.1
What environment are you running pdf-lib in?
Node
Checklist
Additional Notes
Kindly help me out as this is urgent!
The text was updated successfully, but these errors were encountered: