There are a lot of PDF modules on CPAN. PDF::API2 seems to be pretty capable.
However, in regards to shrinking: I was actually looking through the various modules just a few days ago to see if any of them could do just that (scale), and it didn't look like they could. A friend of mine was trying to do the same thting with pdflib in PHP and couldn't. Seems like it should be possible, though. If you figure it out, let us know.
| [reply] |
What do you mean by "shrink"? My first impression is to say "Use gzip or WinZip or something similar", but that doesn't sound like what you want.
My second impression is to wonder if what you want is stripping extraneous information, like unused fonts and the like. Is this the case?
------
We are the carpenters and bricklayers of the Information Age.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
I shouldn't have to say this, but any code, unless otherwise stated, is untested
| [reply] |
Aha, may be I should have mentioned more clearly in the first place.
I mean by Shrink: As if you are copying on a nice copier which can reduce the size of the page. If the Page size is reduced, I can use PDF::API2 to create an new page and add header and the shrinked page to it.
| [reply] |
Ahhh ... you mean to resize the page. Yeah - that's really easy ....... well, kinda.
The PDF format stores the size of the page (in points), as well as where each item on the page is relative to some origin point (usually the top left corner).1 So, you would have to change the page size. This part is easy. The hard part is changing the location of each item, as well as the size of each item, by the same ratio. This would be a very CPU-intensive process. But, it could be done.
I would recommend looking at PDF::Reuse and seeing if you can jimmy it to do what you want. I haven't looked under its hood, but it reads the PDF file and allows you to make changes, so it shouldn't be too hard.
- Well, not exactly, but it boils down to that.
------
We are the carpenters and bricklayers of the Information Age.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
I shouldn't have to say this, but any code, unless otherwise stated, is untested
| [reply] |