double config_dumpfonts;
double config_ppmsubpixels;
double config_jpegsubpixels;
+ char hasbuttons;
int config_simpleviewer;
int config_opennewwindow;
int config_ignoredraworder;
int config_bboxvars;
int config_disable_polygon_conversion;
int config_normalize_polygon_positions;
+ char config_disablelinks;
RGBA config_linkcolor;
float config_minlinewidth;
double config_caplinewidth;
i->firstpage = 1;
i->pagefinished = 1;
+ i->config_disablelinks=0;
i->config_dumpfonts=0;
i->config_ppmsubpixels=0;
i->config_jpegsubpixels=0;
i->config_internallinkfunction=0;
i->config_externallinkfunction=0;
i->config_reordertags=1;
- i->config_linknameurl=1;
+ i->config_linknameurl=0;
i->config_linkcolor.r = i->config_linkcolor.g = i->config_linkcolor.b = 255;
i->config_linkcolor.a = 0x40;
i->swf->compressed = 1;
}
- /* Initialize AVM2 if it is a Flash9 file */
- if(i->config_flashversion>=9 && i->config_insertstoptag) {
- AVM2_InsertStops(i->swf);
+ /* Add AVM2 actionscript */
+ if(i->config_flashversion>=9 &&
+ (i->config_insertstoptag || i->hasbuttons)) {
+ swf_AddButtonLinks(i->swf, i->config_insertstoptag,
+ i->config_internallinkfunction||i->config_externallinkfunction);
}
// if(i->config_reordertags)
// swf_Optimize(i->swf);
{
swfoutput_internal*i = (swfoutput_internal*)dev->internal;
+ if(i->config_disablelinks)
+ return;
+
if(!strncmp("http://pdf2swf:", url, 15)) {
char*tmp = strdup(url);
int l = strlen(tmp);
endshape(dev);
if(i->textid>=0)
endtext(dev);
+
+ /* TODO: escape special characters in url */
- if(i->config_externallinkfunction) {
+ if(i->config_externallinkfunction && i->config_flashversion<=8) {
actions = action_PushString(actions, url); //parameter
actions = action_PushInt(actions, 1); //number of parameters (1)
actions = action_PushString(actions, i->config_externallinkfunction); //function name
if(i->textid>=0)
endtext(dev);
- if(!i->config_internallinkfunction) {
+ if(!i->config_internallinkfunction || i->config_flashversion>=9) {
actions = action_GotoFrame(actions, page-1);
actions = action_End(actions);
} else {
double posy = 0;
int buttonid = getNewID(dev);
gfxbbox_t bbox = gfxline_getbbox(points);
+
+ i->hasbuttons = 1;
/* shape */
myshapeid = getNewID(dev);
swf_ButtonPostProcess(i->tag, 1);
}
}
+ char buf[80];
const char* name = 0;
if(i->config_linknameurl) {
name = url;
+ } else {
+ name = buf;
+ sprintf(buf, "button%d", buttonid);
}
msg("<trace> Placing link ID %d", buttonid);
i->config_dumpfonts = atoi(value);
} else if(!strcmp(name, "animate")) {
i->config_animate = atoi(value);
+ } else if(!strcmp(name, "disablelinks")) {
+ i->config_disablelinks = atoi(value);
} else if(!strcmp(name, "simpleviewer")) {
i->config_simpleviewer = atoi(value);
} else if(!strcmp(name, "next_bitmap_is_jpeg")) {
printf("animate insert a showframe tag after each placeobject (animate draw order of PDF files)\n");
printf("jpegquality=<quality> set compression quality of jpeg images\n");
printf("splinequality=<value> Set the quality of spline convertion to value (0-100, default: 100).\n");
+ printf("disablelinks Disable links.\n");
} else {
return 0;
}
msg("<error> swf_drawchar called (glyph %d) without font", glyph);
return;
}
+
+ if(i->config_drawonlyshapes) {
+ gfxglyph_t*g = &font->glyphs[glyph];
+ gfxline_t*line2 = gfxline_clone(g->line);
+ gfxline_transform(line2, matrix);
+ dev->fill(dev, line2, color);
+ gfxline_free(line2);
+ return;
+ }
+
if(!i->swffont || !i->swffont->name || strcmp((char*)i->swffont->name,font->id)) // not equal to current font
{
/* TODO: remove the need for this (enhance getcharacterbbox so that it can cope