Node.js

Generate PDF in NodeJS using “node-phantom” module

PhantomJS is used to emulate browsers through command line, for generating PDFs, web page manipulation, headless testing and much more interesting stuff. Npm provides us a module called "node-phantom" which helps us to use PhantomJS in our NodeJS application in a non-fussy way. A prerequisite for using this module is, you must have...

by Sakshi Tyagi
Tag: pdf
27-Jun-2014

Grails

Using Data URLs for embedding images in Flying Saucer generated PDFs

We extensively use Flying Saucer to generate PDFs from GSPs in our grails applications. However, there is always the issue of embedding images from within the application because the URLs are usually relative to the environment and as such, embedding them in PDFs with a URL in the src attribute is cumbersome. To get around this, we...

by Vivek Krishna
Tag: pdf
24-Aug-2012

Grails

Request Mocking to use groovyPagesTemplateEngine in backend threads

We have a setup where a backend thread, fired by the Spring Events, does some processing, generates a PDF and emails the result to the user. The code we were using to generate the HTML from a GSP to be converted to a PDF using iText was as follows : [java] def webRequest = RequestContextHolder.getRequestAttributes() ...

by Vivek Krishna
Tag: pdf
27-Dec-2010

Technology

Using iText PdfStamper to insert Images in PDFs while preserving Acroforms

We had a requirement that a template PDF which had Acroform fields had to be pre-populated (like name, email id etc) and sent to the end user so that he/she only needed to fill in the details which were expected to be filled by him/her. After going through the iText library, we found that the PdfStamper class was the best way to go...

by Vivek Krishna
Tag: pdf
29-Nov-2010

Grails

Handling Password Protected Pdf with PdfReader

In one of our grails project , we had to attach cover to Pdf file . But since some of pdf's uploaded were password protected. To handle this scenario we added bouncyCastle.jar , so our version of iText was able to handle password protected pdf . And Then to check whether pdf is password protected or not , we used "Boolean...

by Hitesh Bhatia
Tag: pdf
19-Aug-2010

Grails

Open Pdf in Google Docs using Time Based Cache in Grails

Recently, we had a requirement where secure URLs were to be made accessible to Google. Our implementation was to send a url with token valid for 10 seconds. The token expired automatically after 10 seconds. We used time based cache for this as described here: T set max time to 10 seconds , I set default MaxAge to 10 millis in above...

by Hitesh Bhatia
Tag: pdf
23-Jun-2010