ITextSharp insert text to an existing pdf

I found a way to do it (dont know if it is the best but it works) string oldFile = “oldFile.pdf”; string newFile = “newFile.pdf”; // open the reader PdfReader reader = new PdfReader(oldFile); Rectangle size = reader.GetPageSizeWithRotation(1); Document document = new Document(size); // open the writer FileStream fs = new FileStream(newFile, FileMode.Create, FileAccess.Write); PdfWriter … Read more

HTML to PDF with Node.js

Extending upon Mustafa’s answer. A) Install http://phantomjs.org/ and then B) install the phantom node module https://github.com/amir20/phantomjs-node C) Here is an example of rendering a pdf var phantom = require(‘phantom’); phantom.create().then(function(ph) { ph.createPage().then(function(page) { page.open(“http://www.google.com”).then(function(status) { page.render(‘google.pdf’).then(function() { console.log(‘Page Rendered’); ph.exit(); }); }); }); }); Output of the PDF: EDIT: Silent printing that PDF java -jar … Read more

Puppeteer wait until page is completely loaded

You can use page.waitForNavigation() to wait for the new page to load completely before generating a PDF: await page.goto(fullUrl, { waitUntil: ‘networkidle0’, }); await page.type(‘#username’, ‘scott’); await page.type(‘#password’, ‘tiger’); await page.click(‘#Login_Button’); await page.waitForNavigation({ waitUntil: ‘networkidle0’, }); await page.pdf({ path: outputFileName, displayHeaderFooter: true, headerTemplate: ”, footerTemplate: ”, printBackground: true, format: ‘A4’, }); If there is a … Read more

Render HTML to PDF in Django site

Try the solution from Reportlab. Download it and install it as usual with python setup.py install You will also need to install the following modules: xhtml2pdf, html5lib, pypdf with easy_install. Here is an usage example: First define this function: import cStringIO as StringIO from xhtml2pdf import pisa from django.template.loader import get_template from django.template import Context … Read more