pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: wip/pdftk and NetBSD 4.0 and gcj: libgcj.spec: No such file or directory



Hello Jeremy and all pkgsrc-users,

On Sat, Dec 29, 2007 at 10:26:08AM -0600, Jeremy C. Reed wrote:
> p.s. I just need to cut out some PDF pages. texexec loses the page size 
> and changes formatting but pdftk works good last time I used it. gv 
> converting PDF and saving selected pages to postscript looks terrible 
> (loses font details?). If anyone knows of an alternative, please let me 
> know.
I don't know wip/pdftk, but this problem was interesting so I tryed to
write a solution. BTW I'm not a Perl coder, I only like to code in C and
Perl, so this script is probably horrible. For this Perl script you need
only wip/p5-PDF-Reuse.

For example we want to take the 2nd chapter in ``The pkgsrc guide'':

 $ ./forjeremy.pl pkgsrc.pdf 16 18 > chapter2.pdf
 
So the syntax is:

 $ ./forjeremy.pl <input.pdf> <first_page> <last_page> > <output.pdf>

This is the script:
[...]
#!/usr/pkg/bin/perl

# forjeremy.pl, a quick and dirty script to cut out some pages from a PDF
# Leonardo Taccari, leonardo1990[at]gmail[dot]com

use warnings;
use strict;
use PDF::Reuse;

# Read the options from the shell via @ARGV
my ($mypdf, $firstpage, $lastpage) = @ARGV;

# Open our final PDF and put it to STDOUT
prFile();

# Get pages from $firstpage to $lastpage in our $mypdf
prDoc($mypdf, $firstpage, $lastpage);

# Close our PDF
prEnd();
[...]


HTH and good luck Jeremy. :)


Ciao, Leonardo
-- 
 Leonardo Taccari (leot) | http://leot.netsons.org

Attachment: pgpa6Sq8_hhOJ.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index