Do you ever find a cool utility and feel the need to use it in a program? Last week I was faced with the problem of needing to load PDF files and separate out sections of them. I found a tool called pdftk and it's great. There are windows and Linux versions and it is a simple command line tool for splitting, mixing, and concatenating PDF files.
I made a small front end for it in C# that uses the Acrobat reader control. Here's what it does. The PDF gets loaded in the acrobat reader control. Then it makes a call to pdftk to generate a manifest file that has a page count for the PDF along with some other information I'm ignoring for the moment. A listbox is populated with all of the page numbers in simple select mode so the user just has to click on the pages he/she wants and click the save new PDF button. Another call is made to pdftk that generates the new PDF with all of the selected files.
Now it is at this point that I must say how much I like the UNIX tradition of making a bunch of small utilities and stringing them together into one bigger program. First off, It's a lot easier to make calls to a text based program from within another program than it is to use the windows automation features that only some windows make use of. Second, My program barely does half of what pdftk can do from the command line simply because you're limited by the windowing interface and how it shows you the world.
It's amazing how limited we can sometimes be in our windowed existence because we can only see the programs we use through the eyes of their creators. I have run into this problem time and again where I create a form in one of my programs and I know how to use it, but others just stare right back at me and tell me they can't use it. UI design is a curious thing that I hope to improve at someday.
Shaun
PS. If you are interested in any sources drop me an email, though I can't promise a completed program. I'm writing a control that is part of a bigger program, not a stand alone PDF manager.
Sunday, November 20, 2005
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment