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: Chris Pugh
Subject: Re: [Swftools-common] pdf2swf: internal linking
Date: Sat, 24 Apr 2010 06:03:00 +0100

On 23 April 2010 13:54,  <address@hidden> wrote:
>> -----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?

I'll dig in the direction you've pointed me in.  See if I can make head or tails
of it!   I'm not that familiar with c++ as yet though.  Certainly not as
comfortable with it as your good self.  That said, I can't see any reason why
the above could not be implemented, and used by a viewer in a viewer.   A
couple of them are actually in c.   If you haven't already found them, take a
look in the swfs directory of the source distribution of SWFTools.

Somewhere I also have a scrappy basic viewer I wrote for testing bits - no fancy
graphics, simply functional.  Could use it for testing.when and if I find it.

Regards,


Chris.




reply via email to

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