swftools-common
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Swftools-common] pdf2swf: internal linking


From: james.jones
Subject: RE: [Swftools-common] pdf2swf: internal linking
Date: Fri, 23 Apr 2010 08:54:51 -0400

> -----Original Message-----
> From: Chris Pugh [mailto:address@hidden
>
> ttbomk, no, it doesn't look like it, as yet.  Unfortunately
> it currently
> takes me an inordinate length of time to decipher the source code.
> Maybe another one for the smelting pot?

Maybe. But having looking at the code for a bit I'm pretty sure *I do* 
understand where the call is made. I can calculate the fraction of the page 
needed to scroll to the right place, too. What I don't know how to do is 
translate this into ActionScript. (I know C++. I don't know AS.)

What I was thinking (I posting this idea to the FlexPaper Google group, too, 
btw; that discussion is here: 
http://groups.google.com/group/flexpaper/browse_thread/thread/a9d551ecbd31a29) 
was that what is needed is an additional runtime flag for pdf2swf that would 
indicate that when using an internal link function, the fractional part should 
also be passed. Then your internal link function could use that to determine 
how to scroll after going to the right page.

Conceptually this is simple. Here's the code (from 
lib/devices/swf.c/swfoutput_linktopage) that draws internal links:

  if(!i->config_internallinkfunction || i->config_flashversion>=9) {
     actions = action_GotoFrame(actions, page-1);
     actions = action_End(actions);
  } else {
     actions = action_PushInt(actions, page); //parameter
     actions = action_PushInt(actions, 1); //number of parameters (1)
     actions = action_PushString(actions, i->config_internallinkfunction); 
//function name
     actions = action_CallFunction(actions);
     actions = action_End(actions);
  }

My proposal would change that to (something like):

  if(!i->config_internallinkfunction || i->config_flashversion>=9) {
     actions = action_GotoFrame(actions, page-1);
     actions = action_End(actions);
  } else {
     if(i->config_internallinkfraction) { // new runtime parameter
        actions = action_PushInt(actions, page); //parameter
        actions = action_PushDouble(actions, page_fraction); //parameter
        actions = action_PushInt(actions, 2); //number of parameters (1)
     } else { // default behavior
        actions = action_PushInt(actions, page); //parameter
        actions = action_PushInt(actions, 1); //number of parameters (1)
     }
     actions = action_PushString(actions, i->config_internallinkfunction); 
//function name
     actions = action_CallFunction(actions);
     actions = action_End(actions);
  }

Then you need an external viewer that can handle this. Which is why I'm talking 
to the FlexPaper guys, too. Any thoughts?

-
James Jones             Administrative Data Mgmt.
Webmaster               375 Raritan Center Pkwy, Suite A
Data Architect          Edison, NJ 08837




reply via email to

[Prev in Thread] Current Thread [Next in Thread]