[Noisebridge-discuss] SVG + PNG = PDF?

Wladyslaw Zbikowski embeddedlinuxguy at gmail.com
Fri Jun 3 02:01:12 UTC 2011


Hey Rubin, one module I've had good luck with is PDF::Reuse in Perl.
You can use ImageMagick to convert the pngs and SVG to PDFs and then
run them through a script like this attached. I gave this a try but it
did not handle transparency, so maybe there is some convert
ImageMagick flags to preserve alpha channels or something.

#!/usr/bin/perl

use strict;
use warnings;

use PDF::Reuse;

my $help = "Usage: $0 infile.pdf outfile.pdf overlay.pdf pages";
my $INFILE = shift @ARGV || die $help;
my $outfile = shift @ARGV || die $help;
my $svg = shift @ARGV || die $help;
my $pages = shift @ARGV || die $help;

prFile($outfile);
prMbox(0, 0, 612, 792);

for my $i (0 .. $pages-2) {
   prForm( { file => $INFILE, page => $i} );
   prForm( { file => $svg, page => 1} );
   prPage();
}
prForm( { file => $INFILE, page => $pages-1} );
prForm( { file => $svg, page => 1} );
prEnd();



On Thu, Jun 2, 2011 at 6:08 PM, Rubin Abdi <rubin at starset.net> wrote:
> I don't think Imagemagick is up to this task, so I'm stuck.
>
> I have...
>
> * 1 SVG, it's detailed
> * 1200 PNGs
>
> I would like to basically take these things, and generate a large 1200
> page PDF, where each page contains the same page sized SVG, with 1
> unique PNG watermarking the corner.
>
> What can I use to script this?
>
> Imagemagick seems to only like playing with SVGs and PDFs if it
> rasterizes it.
>
> --
> Rubin Abdi
> rubin at starset.net
>
>
> _______________________________________________
> Noisebridge-discuss mailing list
> Noisebridge-discuss at lists.noisebridge.net
> https://www.noisebridge.net/mailman/listinfo/noisebridge-discuss
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pdf-overlay
Type: application/octet-stream
Size: 547 bytes
Desc: not available
URL: <http://lists.noisebridge.net/pipermail/noisebridge-discuss/attachments/20110602/db37ff86/attachment-0003.obj>


More information about the Noisebridge-discuss mailing list