+ printf("-T --flashversion=num Set the flash version in the header to num (default: 4)\n");
+ printf("-s insertstop Insert a \"Stop\" Tag in every frame (don't turn pages automatically)\n");
+ printf("-s zoom=factor Scale result, default: 72\n");
+ printf("-s jpegquality=quality Set quality of embedded jpeg pictures (default:85)\n");
+ printf("-s caplinewidth=value Set the minimum line width to trigger cap style handling to value. (3)\n");
+ printf("-s splinequality=value Set the quality of spline convertion to value (0-100, default: 100).\n");
+ printf("-s fontquality=value Set the quality of font convertion to value (0-100, default: 100).\n");
+ printf("-s ignoredraworder Ignore draw order (makes the SWF file smaller and faster, but may produce\n"
+ " graphic errors)\n");
+ printf("-s filloverlap Make intersecting shapes overlap, instead of canceling each\n"
+ " other out. (Needed for some Powerpoint PDFs)\n");
+ printf("Postprocessing options:\n");
+#ifndef SYSTEM_BACKTICKS
+ printf("(They might not work because your system call doesn't support command substitution)\n");
+#endif
+ printf("-b --defaultviewer Link default viewer to the pdf (%s/swfs/default_viewer.swf)\n", SWFTOOLS_DATADIR);
+ printf("-l --defaultpreloader Link default preloader the pdf (%s/swfs/default_loader.swf)\n", SWFTOOLS_DATADIR);
+ printf("-B --viewer=filename Link viewer \"name\" to the pdf (\"%s -B\" for list)\n", name);
+ printf("-L --preloader=filename Link preloader \"name\" to the pdf (\"%s -L\" for list)\n",name);
+}
+
+#ifdef HAVE_DIRENT_H
+void addfontdir(char* dirname, int*numfonts)
+{
+ if(!numfonts)
+ msg("<verbose> Adding %s to search path\n", dirname);
+
+ DIR*dir = opendir(dirname);
+ if(!dir) {
+ msg("<warning> Couldn't open directory %s\n", dirname);
+ return;
+ }
+ dirent*ent;
+ while(1) {
+ ent = readdir (dir);
+ if (!ent)
+ break;
+ int l;
+ char*name = ent->d_name;
+ char type = 0;
+ if(!name) continue;
+ l=strlen(name);
+ if(l<4)
+ continue;
+ if(!strncasecmp(&name[l-4], ".pfa", 4))
+ type=1;
+ if(!strncasecmp(&name[l-4], ".pfb", 4))
+ type=3;
+ if(!strncasecmp(&name[l-4], ".ttf", 4))
+ type=2;
+ if(type)
+ {
+ char*fontname = (char*)malloc(strlen(dirname)+strlen(name)+2);
+ strcpy(fontname, dirname);
+#ifdef WIN32
+ strcat(fontname, "\\");
+#else
+ strcat(fontname, "/");
+#endif
+ strcat(fontname, name);
+ if(!numfonts)
+ msg("<debug> Adding %s to fonts", fontname);
+ pdfswf_addfont(fontname);
+ if(numfonts)
+ (*numfonts)++;
+ }
+ }
+ closedir(dir);
+}
+#endif
+
+char* stripfilename(char*filename, char*newext)
+{
+ char*last1 = strrchr(filename, '/');
+ char*last2 = strrchr(filename, '\\');
+ char*pos = filename;
+ char*name;
+ char*dot;
+ if(last1>pos) pos = last1 + 1;
+ if(last2>pos) pos = last2 + 1;
+ name = (char*)malloc(strlen(pos)+5);
+ strcpy(name, pos);
+ dot = strrchr(name, '.');
+ if(dot) {
+ *dot = 0;
+ }
+ strcat(name, newext);
+ return name;