pdf2swf - convert PDF files into SWF
.SH Synopsis
.B pdf2swf
-[\fIoptions\fR] \fIfile.pdf\fR -o \fIfile.swf\fR
+[\fIoptions\fR] \fIfile.pdf\fR [-o \fIfile.swf\fR]
.SH DESCRIPTION
This tools converts Acrobat PDF files into Flash SWF Animation
files.
void args_callback_usage(char*name)
{
- printf("Usage: %s [-si] [-j quality] [-p range] [-P password] input.pdf -o output.swf\n", name);
+ printf("Usage: %s [-si] [-j quality] [-p range] [-P password] input.pdf [-o output.swf]\n", name);
printf("\n");
printf("-p --pages=range Convert only pages in range\n");
printf("-P --password=password Use password for deciphering the pdf\n");
}
#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;
+}
+
int main(int argn, char *argv[])
{
int ret;
initLog(0,-1,0,0,-1,loglevel);
if(!outputname)
{
+ if(filename) {
+ outputname = stripfilename(filename, ".swf");
+ logf("<notice> Output filename not giving. Writing to %s", outputname);
+ }
+ }
+
+ if(!outputname)
+ {
fprintf(stderr, "Please use -o to specify an output file\n");
exit(1);
}