Inge Sandholt

Inge Sandholt

My Blog

From time to time, I will update this blog about my designs and random knitting projects. Most of my patterns can be bought from my pattern home page, ingesandholt.com

Find me on Facebook Follow me on Twitter

Interactive pdf patterns

DesignsPosted by Inge Sandholt Wed, April 11, 2012 15:15:42
So maybe I should write a little about how I created the interactive pdf files - described in more detail here. Not only are the files interactive, calculations are also performed based on user input. I didn't invent anything my self, but I would love to share the links and sources I used, and provide a few tips on how it worked for me if others could find it useful.

A while back, I wrote an online "knit estimator" in html with JavaScript with the above mentioned functionality, and made it available on my web page. To judge from the traffic on the page, a few people actually used it. The calculations and the whole layout were fairly simple, but I still found it a bit intimidating to get started, and make all the boxes and so on from scratch. The layout was also not really the way I wanted it to be. At the same time, I had been using Adobe Acrobat Pro to make pdf forms for students to sign up for courses. The forms could be submitted directly from the pdf document to an online database or via e-mail. Over the top, but very clever and fun to make.

So the next step was to combine it all in an interactive pdf file instead - without the database access though, which is not necessary. The user fills in relevant values, like for instance gauge, and by pressing a button in the document, calculations are performed and written in the document as output. It can all be done offline, the resulting pdf is a stand-alone-application.

As I wrote in a previous post, Scribus - a very intuitive desktop publishing program - did the job for me. It is free, and has loads of documentation. Best of all, it supports Java Script. I went directly for the interactive pdf part - and more or less copied what I needed from the manual, here, look in particular for pdf forms and pdf and Java Script. The manual has very easy to follow instructions on how to make forms and include Java Script. I just copied from the examples and made the changes needed to include the functionality I wanted. The layout and placement of pdf boxes are all interactive in Scribus, point and click more or less, and no scripting is necessary for that part. What I have spend most time on, is the error check, and programming exceptions - for instance, to account for the situation where the form has not been filled in correctly.

To get started with JavaScripting, I suggest you google "getting started with Java Script". There is so much information - and noise - out there. You barely have to scratch the surface of JavaScript in order to make nice pdf applications.

A pdf reader (Adobe Acrobat, for instance) and Java Runtime Environment is needed for the pdf's to be useful, but most computers have both installed already. With Adobe Acrobat Pro, the files with content can be saved for future use, but with Acrobat Reader, the files will have to be printed to keep the numbers. Personally, I print to a pdf printer, which I think is fairly standard, if I would like to keep the output. And there is always paper, hardcopies are sometimes nice to have. The interactive pdf's does NOT work with Preview on MAC (the rudimentary pdf reader by Apple) but works fine with Adobe Acrobat on a MAC.

  • Comments(0)

Fill in only if you are not real





The following XHTML tags are allowed: <b>, <br/>, <em>, <i>, <strong>, <u>. CSS styles and Javascript are not permitted.