remove existing files and tweak rendering
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 13 Aug 2010 16:04:10 +0000 (18:04 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 13 Aug 2010 16:04:10 +0000 (18:04 +0200)
render.pl

index df02154..df7c73e 100755 (executable)
--- a/render.pl
+++ b/render.pl
@@ -20,8 +20,14 @@ sub mapping { $mapping->{ $_[0] } }
 
 my $re = join('|', keys %$mapping);
 
+mkdir 'out' unless -d 'out';
 my $out = 'out/' . $nr;
 
+foreach my $existing ( glob $out . '*' ) {
+       warn "# remove $existing ", -s $existing, " bytes\n";
+       unlink $existing;
+}
+
 open(my $in,     '<', 'template.svg');
 open(my $print,  '>', "$out.print.svg");
 open(my $screen, '>', "$out.screen.svg");
@@ -50,10 +56,19 @@ close($in);
 close($print);
 close($screen);
 
-system "inkscape --file $out.print.svg  --export-pdf $out.pdf";
-system "inkscape --file $out.screen.svg --export-png $out.png --export-dpi 180";
+#system "inkscape --file $out.print.svg  --export-pdf $out.pdf";
+
+system "inkscape --file $out.print.svg --export-area-page --export-pdf $out.print-front.pdf --export-id print-front";
+system "inkscape --file $out.print.svg --export-area-page --export-pdf $out.print-back.pdf --export-id print-back";
+system "pdftk  $out.print-front.pdf $out.print-back.pdf cat output $out.print-duplex.pdf";
+
+#system "inkscape --file $out.screen.svg --export-png $out.png --export-dpi 180";
+
+#system "inkscape --file $out.screen.svg --export-png $out.300.png --export-dpi 300";
+
+system "inkscape --file $out.print.svg --export-area-page --export-png $out.print-front.png --export-dpi 150 --export-id print-front --export-id-only";
+system "inkscape --file $out.print.svg --export-area-page --export-png $out.print-back.png --export-dpi 150 --export-id print-back --export-id-only";
 
-system "inkscape --file $out.screen.svg --export-png $out.300.png --export-dpi 300";
 
 #system "qiv $out.png";
 #system "xpdf $out.pdf";