Subject: Re: wip/pdftk and NetBSD 4.0 and gcj: libgcj.spec: No such file or directory
To: pkgsrc-users <pkgsrc-users@netbsd.org>
From: Leonardo Taccari <leonardo1990@gmail.com>
List: pkgsrc-users
Date: 12/30/2007 14:15:08
--a8Wt8u1KmwUX3Y2C
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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=
=20
> and changes formatting but pdftk works good last time I used it. gv=20
> converting PDF and saving selected pages to postscript looks terrible=20
> (loses font details?). If anyone knows of an alternative, please let me=
=20
> 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
=20
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) =3D @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
--=20
 Leonardo Taccari (leot) | http://leot.netsons.org

--a8Wt8u1KmwUX3Y2C
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (NetBSD)

iD8DBQFHd5nc0rM/yChQIPgRAmm6AJ9l42WPGGzi5vrR5RYZooneLEo1PgCeOfJ8
i0PmywoOs66bTsr8dxKRBaU=
=voAV
-----END PGP SIGNATURE-----

--a8Wt8u1KmwUX3Y2C--