Editing PDFs - a slight revelation including some questions about sed
Hi,
I have fairly regular requirements to edit PDFs, though more often than not it's just the page geometry I'm messing with (impostion for printing - bursting printers' pairs apart,that kind of thing). As you might expect I work in a branch of printing. On Windows the professional version of Acrobat had some capabilities which I found hard to replicate on Linux but I did find a few options that fulfilled (so far) all of my needs.
So, as mentioned, it's normally geometry I mess with, so Media, Bleed, Crop, Trim and Art box parameters are my main focus. I did find PDFedit did a few useful things, but it wasn't so helpful with multipage files.
So then I used Vim with the pdftk plugin installed, and that worked fairly nicely, and would alter the X number(sometimes over 100) instances of the various box parameters that I need to alter; but it was sloooow. Very slow.
Then the revelation, since we're altering lines, why not try sed. Well it works and it's really quite fast the only problem is that I wind up with a PDf that it's thereafter difficult to maniulate, I presume because the "Xref table" is messed up? Not too sure about the vagaries of postscript, so I'm just guessing here.
I can fix the problem using pdftk (which takes a while - just nothing like as long as using Vim), but if possible I'm keen to avoid this delay, as if nothing else, I could script most of the processes and remove a lot of tedious tasks involved. Wite error it inserts it's not ideal to script since I need to check at each stage.
So to the (linux)question:
What is it that sed is doing that's likely causing the problem?
&
How can I avoid it?
Like I say I can live with it, would just prefer not to.
|