line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TeX::AutoTeX::ConcatPDF; |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# $Id: ConcatPDF.pm,v 1.2.2.7 2011/01/27 18:56:29 thorstens Exp $ |
4
|
|
|
|
|
|
|
# $Revision: 1.2.2.7 $ |
5
|
|
|
|
|
|
|
# $Source: /cvsroot/arxivlib/arXivLib/lib/TeX/AutoTeX/ConcatPDF.pm,v $ |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# $Date: 2011/01/27 18:56:29 $ |
8
|
|
|
|
|
|
|
# $Author: thorstens $ |
9
|
|
|
|
|
|
|
# |
10
|
1
|
|
|
1
|
|
20431
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
11
|
|
|
|
|
|
|
### use warnings; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
712
|
use version; our $VERSION = qv('0.94'); |
|
1
|
|
|
|
|
2197
|
|
|
1
|
|
|
|
|
6
|
|
14
|
1
|
|
|
1
|
|
104
|
use parent qw(Exporter); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
15
|
|
|
|
|
|
|
our @EXPORT_OK = qw(concatenate_pdf); |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
64
|
use CAM::PDF; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
18
|
1
|
|
|
1
|
|
6
|
use Carp qw(croak carp); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
230
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub concatenate_pdf { |
21
|
0
|
|
|
0
|
1
|
|
my ($combinedfile, $listref) = @_; |
22
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
return if @{$listref} < 2; |
|
0
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
0
|
|
0
|
|
|
|
my $combineddoc = CAM::PDF->new(shift @{$listref}) || |
26
|
|
|
|
|
|
|
croak $CAM::PDF::errstr; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
foreach my $file (@{$listref}) { |
|
0
|
|
|
|
|
|
|
29
|
0
|
|
0
|
|
|
|
my $doc = CAM::PDF->new($file) || croak $CAM::PDF::errstr; |
30
|
0
|
|
|
|
|
|
carp 'Appending ', $doc->numPages(), |
31
|
|
|
|
|
|
|
' page(s) to original ',$combineddoc->numPages(), ' page(s)'; |
32
|
0
|
|
|
|
|
|
$combineddoc->appendPDF($doc); |
33
|
|
|
|
|
|
|
} |
34
|
0
|
|
|
|
|
|
$combineddoc->preserveOrder(); |
35
|
0
|
|
|
|
|
|
$combineddoc->clearAnnotations(); |
36
|
0
|
|
|
|
|
|
$combineddoc->cleanoutput($combinedfile); |
37
|
0
|
|
|
|
|
|
return; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |