make two-page pdf using pdftk
[Printer-EVOLIS.git] / scripts / inkscape-render.pl
index 9df63e4..2f3ff0a 100755 (executable)
@@ -4,15 +4,11 @@ use warnings;
 use strict;
 use autodie;
 
-my $card_svg = 'card/ffzg-2010.svg';
+die "unsage: $0 card/template.svg 201008159999 Ime Prezime\n" unless @ARGV;
 
-warn "# card template: $card_svg\n";
+my ($card_svg,$nr,$ime,$prezime) = @ARGV;
 
-my ($nr,$ime,$prezime) = ( qw/
-200900000042
-Dobrica
-Pavlinušić
-/ );
+warn "# svg: $card_svg nr: $nr $ime $prezime\n";
 
 my $mapping = {
 '200908109999' => $nr,
@@ -56,6 +52,8 @@ sub inkscape_export {
 
        my $shell = "$out.svg --export-area-page --export-id $part";
 
+       $part =~ s/print-//; # FIXME change svg files
+
        print $inkscape "$shell --export-pdf $out.$part.pdf\n";
        print $inkscape "$shell --export-png $out.$part.png --export-dpi 150\n";
 }
@@ -75,7 +73,7 @@ foreach my $pdf ( glob "$out*.pdf" ) {
        system "gs -dNOPAUSE -dBATCH -q -r300x300 -dDEVICEWIDTHPOINTS=243 -dDEVICEHEIGHTPOINTS=155 -sDEVICE=pbmraw -sOutputFile=$pbm -f $pdf";
 }
 
-system "pdftk $out.print-front.pdf $out.print-back.pdf cat output $out.print-duplex.pdf";
+system "pdftk $out.front.pdf $out.back.pdf cat output $out.duplex.pdf";
 
 __END__