Not sure if this is exactly what you are looking for, but when I last had a project where PDF creation was the issue, I stepped away from using the Modules and the ::API2 approach and just did the nitty gritty PDF scripting. You'll find it is not that tough, and looks alot like an OO'ified Postscript. Snippet Follows: 6 0 obj
<< /Length 4634 >>
stream
BT
/F1 10 Tf 11.5 TL
72 556 Td
(This is pdf, done the cool way, acrobat is for \ weanies!!! ) Tj
T* (This is by far the best way to know what you are going to get.
+ www.perlmonks.org rules!) Tj
ET
178 520 m 407 520 l .8 w S #Stroking the line to underline above ur
+l
The hardest part would be to establish an XREF table schema, and a way of generating this. Along with Defining the length tags around each object that are required for viewers such as Acrobat to read them. Monk Russ showed me a way like this: print scalar <>;
while (!eof(ARGV)) {
$pos = tell(ARGV);
$line = scalar <>;
my ($Obj) = $line =~ /^(\d+) \d+ obj/;
$xref[$Obj - 1] = $pos if defined $Obj;
$Str{$#xref + 1}->[0] = tell(ARGV) if $line =~ /^stream/;
$Str{$#xref + 1}->[1] = $pos if $line =~ /^endstream/;
print $line;
}
$pos = tell;
print "xref\n0 ", scalar @xref + 1, "\n";
printf "%010d 65535 f \n", 0;
foreach $entry (@xref) {
printf "%010d 00000 n \n", $entry;
}
print "trailer\n<< /Size ", scalar @xref + 1, " /Root 1 0 R /Info 8 0
+R >>\n";
print "startxref\n$pos\n%%EOF\n";
for my $Key (sort {$a <=> $b} keys %Str){
warn "Stream in $Key ",
"begins: $Str{$Key}->[0] ",
"ends: $Str{$Key}->[1] ",
"length: @{[$Str{$Key}->[1] - $Str{$Key}->[0]]}\n";
}
as a script to send a .pdf you create into the ARGV and have it output a file with a correct XREF table at it's conclusion, and length's of streams to STDOUT for easy viewing and updating. Have Fun
Tradez
"Never underestimate the predicability of stupidity"
- Bullet Tooth Tony, Snatch (2001) |