#include "../lib/devices/swf.h"
#include "../lib/devices/polyops.h"
#include "../lib/devices/record.h"
+#include "../lib/devices/rescale.h"
#include "../lib/pdf/pdf.h"
#include "../lib/log.h"
static gfxsource_t*driver = 0;
static gfxdevice_t*out = 0;
+static int maxwidth=0, maxheight=0;
+
static char * outputname = 0;
static int loglevel = 3;
static char * pagerange = 0;
ynup = 3;
return 0;
}
+ else if (!strcmp(name, "X"))
+ {
+ maxwidth = atoi(val);
+ return 1;
+ }
+ else if (!strcmp(name, "Y"))
+ {
+ maxheight = atoi(val);
+ return 1;
+ }
else if (!strcmp(name, "q"))
{
loglevel --;
{"G", "flatten"},
{"I", "info"},
{"Q", "maxtime"},
+{"X", "width"},
+{"Y", "height"},
{0,0}
};
}
-static gfxdevice_t swf,wrap;
+static gfxdevice_t swf,wrap,rescale;
gfxdevice_t*create_output_device()
{
gfxdevice_swf_init(&swf);
- gfxdevice_removeclippings_init(&wrap, &swf);
- out = &wrap;
- if(!flatten) {
- out = &swf;
+
+ /* set up filter chain */
+
+ out = &swf;
+ if(flatten) {
+ gfxdevice_removeclippings_init(&wrap, &swf);
+ out = &wrap;
}
+
+ if(maxwidth || maxheight) {
+ gfxdevice_rescale_init(&rescale, out, maxwidth, maxheight, 0);
+ out = &rescale;
+ }
+
/* pass global parameters to output device */
parameter_t*p = device_config;
while(p) {
char t1searchpath[1024];
int nup_pos = 0;
int x,y;
- char* installPath = getInstallationPath();
- char one_file_per_page = 0;
+ int one_file_per_page = 0;
initLog(0,-1,0,0,-1,loglevel);
if((u = strchr(outputname, '%'))) {
if(strchr(u+1, '%') ||
strchr(outputname, '%')!=u) {
- msg("<error> only one %%d allowed in filename\n");
+ msg("<error> only one %% allowed in filename\n");
return 1;
}
if(preloader || viewer) {
- msg("<error> -b/-l/-B/-L not supported together with %%d in filename\n");
+ msg("<error> -b/-l/-B/-L not supported together with %% in filename\n");
return 1;
}
msg("<notice> outputting one file per page");
if(one_file_per_page) {
gfxresult_t*result = out->finish(out);out=0;
char buf[1024];
- sprintf(buf, outputname, one_file_per_page++);
+ sprintf(buf, outputname, pagenr);
if(result->save(result, buf) < 0) {
return 1;
}
if(result->save(result, outputname) < 0) {
exit(1);
}
- int width = (int)result->get(result, "width");
- int height = (int)result->get(result, "height");
+ int width = (int)(ptroff_t)result->get(result, "width");
+ int height = (int)(ptroff_t)result->get(result, "height");
result->destroy(result);result=0;
if(preloader || viewer) {