From 21e018742051f8a032fa50117ba5beb0668c25f0 Mon Sep 17 00:00:00 2001 From: kramm Date: Sun, 21 Apr 2002 21:16:51 +0000 Subject: [PATCH] added -z option. --- pdf2swf/SWFOutputDev.cc | 5 +++++ pdf2swf/SWFOutputDev.h | 1 + pdf2swf/pdf2swf.1 | 4 ++++ pdf2swf/pdf2swf.cc | 7 +++++++ pdf2swf/swfoutput.cc | 11 +++++++++-- pdf2swf/swfoutput.h | 1 + 6 files changed, 27 insertions(+), 2 deletions(-) diff --git a/pdf2swf/SWFOutputDev.cc b/pdf2swf/SWFOutputDev.cc index fb697fe..c7b9a66 100644 --- a/pdf2swf/SWFOutputDev.cc +++ b/pdf2swf/SWFOutputDev.cc @@ -1524,6 +1524,11 @@ void pdfswf_storeallcharacters() storeallcharacters = 1; } +void pdfswf_enablezlib() +{ + enablezlib = 1; +} + void pdfswf_jpegquality(int val) { if(val<0) val=0; diff --git a/pdf2swf/SWFOutputDev.h b/pdf2swf/SWFOutputDev.h index ea43b3e..e1fa38d 100644 --- a/pdf2swf/SWFOutputDev.h +++ b/pdf2swf/SWFOutputDev.h @@ -12,6 +12,7 @@ void pdfswf_init(char*filename, char*userPassword) ; void pdfswf_setoutputfilename(char*filename); void pdfswf_drawonlyshapes(); +void pdfswf_enablezlib(); void pdfswf_ignoredraworder(); void pdfswf_linksopennewwindow(); void pdfswf_jpegquality(int); diff --git a/pdf2swf/pdf2swf.1 b/pdf2swf/pdf2swf.1 index 92484ea..b8e5a40 100644 --- a/pdf2swf/pdf2swf.1 +++ b/pdf2swf/pdf2swf.1 @@ -22,6 +22,10 @@ Convert only pages in \fIrange\fR with \fIrange\fR e.g. 1-20 or 1,4,6,9-11 or \fB\-v\fR, \fB\-\-verbose\fR Be verbose. Use more than one -v for greater effect. .TP +\fB\-z\fR, \fB\-\-zlib\fR +Use Flash 6 (MX) zlib compression. +\fBThe resulting SWF will not be playable in browsers with Flash Plugins 5 and below!\fR +.TP \fB\-i\fR, \fB\-\-ignore\fR Allows pdf2swf to change the draw order of the pdf. This may make the generated SWF files a little bit smaller, but it may also cause the images in the pdf to look funny. diff --git a/pdf2swf/pdf2swf.cc b/pdf2swf/pdf2swf.cc index 8dad398..8acd224 100644 --- a/pdf2swf/pdf2swf.cc +++ b/pdf2swf/pdf2swf.cc @@ -95,6 +95,11 @@ int args_callback_option(char*name,char*val) { pdfswf_ignoredraworder(); return 0; } + else if (!strcmp(name, "z")) + { + pdfswf_enablezlib(); + return 0; + } else if (!strcmp(name, "n")) { pdfswf_linksopennewwindow(); @@ -185,6 +190,7 @@ struct options_t options[] = {{"o","output"}, {"V","version"}, {"i","ignore"}, + {"z","zlib"}, {"s","shapes"}, {"j","jpegquality"}, {"p","pages"}, @@ -226,6 +232,7 @@ void args_callback_usage(char*name) printf("-s --shapes Don't use SWF Fonts, but store everything as shape\n"); printf("-i --ignore Ignore draw order (makes the SWF file smaller, but may produce\n"); printf(" graphic errors)\n"); + printf("-z --zlib Use Flash 6 (MX) zlib compression (Needs at least Flash 6 Plugin to play)\n"); printf("-j --jpegquality=quality Set quality of embedded jpeg pictures (default:85)\n"); printf("-v --verbose Be verbose. Use more than one -v for greater effect\n"); printf("-w --samewindow Don't open a new Browser Window for Links in the SWF\n"); diff --git a/pdf2swf/swfoutput.cc b/pdf2swf/swfoutput.cc index 5d4493f..d6974b2 100644 --- a/pdf2swf/swfoutput.cc +++ b/pdf2swf/swfoutput.cc @@ -35,6 +35,7 @@ int ignoredraworder=0; int drawonlyshapes=0; int jpegquality=85; int storeallcharacters=0; +int enablezlib=0; static int flag_protected = 0; typedef unsigned char u8; @@ -1013,8 +1014,14 @@ void swfoutput_destroy(struct swfoutput* obj) tag = swf_InsertTag(tag,ST_END); - if FAILED(swf_WriteSWF(fi,&swf)) - logf(" WriteSWF() failed.\n"); + if(enablezlib) { + if FAILED(swf_WriteSWC(fi,&swf)) + logf(" WriteSWC() failed.\n"); + } else { + if FAILED(swf_WriteSWF(fi,&swf)) + logf(" WriteSWF() failed.\n"); + } + if(filename) close(fi); logf(" SWF written\n"); diff --git a/pdf2swf/swfoutput.h b/pdf2swf/swfoutput.h index 47f1a6c..2aabb5b 100644 --- a/pdf2swf/swfoutput.h +++ b/pdf2swf/swfoutput.h @@ -15,6 +15,7 @@ extern "C" { #include "../lib/rfxswf.h" } +extern int enablezlib; //default:0 extern int opennewwindow; //default:0 extern int ignoredraworder; //default:0 extern int drawonlyshapes; //default:0 -- 1.7.10.4