Created
November 26, 2022 17:57
-
-
Save JJ/44e68da7b4f82a070a438b5dae59b754 to your computer and use it in GitHub Desktop.
Combine PDs by Tom Browder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use PDF::Lite; | |
use PDF::Font::Loader; | |
my @pdfs = <list of pdf files to combine>; | |
# create a new pdf to hold the entire collection | |
my $pdf = PDF::Lite.new; | |
$pdf.media-box = 'Letter'; | |
my $centerx = 4.25*72; # horizontal center of the page | |
# the cover | |
my PDF::Lite::Page $page = $pdf.add-page; | |
# add the cover title info... | |
for @pdfs -> $pdfdoc { | |
# the cover | |
$page = $pdf.add-page; | |
# add the part cover title info... | |
my pdf2 = PDF::Lite.open: $pdfdoc; | |
my $npages = $pdf2.page-count; | |
1..$npages -> $page-num { | |
$pdf.add-page: $pdf2.page($page-num); | |
} | |
} | |
# ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment