Skip to content

Instantly share code, notes, and snippets.

@fruitl00p
Created June 22, 2015 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fruitl00p/1aee75a350138f9130b3 to your computer and use it in GitHub Desktop.
Save fruitl00p/1aee75a350138f9130b3 to your computer and use it in GitHub Desktop.
swf2pdf
#!/usr/bin/perl
$swf = $ARGV[0];
open A,"swfdump $swf |";
while (<A>){
if(/SHOWFRAME\s+(\d+)/){
$page = $1;
}
}
close A;
print $page,"\n";
for $i (1..$page){
system qq(swfrender -r 240 -p $i $swf -o tmp_$i);
system qq(convert tmp_$i tmp_$i.pdf);
unlink("tmp_$i");
push @outs, "tmp_$i.pdf";
}
system qq(pdfunite @outs $swf.pdf);
unlink @outs;
print $swf, " done\n";
@kanova
Copy link

kanova commented Feb 3, 2018

open A,"swfdump $swf |";
while (){
if(/SHOWFRAME\s+(\d+)/){
$page = $1;
}
}
close A;
print $page,"\n";
for $i (1..$page){
system qq(swfrender -r 240 -p $i $swf -o tmp_$i);
system qq(convert tmp_$i tmp_$i.pdf);
unlink("tmp_$i");
push @Outs, "tmp_$i.pdf";
}
system qq(pdfunite @Outs $swf.pdf);
unlink @Outs;
print $swf, " done\n";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment