swftools-common
[Top][All Lists]
Advanced

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

Re: [Swftools-common] Getting page count from SWF


From: Ricardo Pedroso
Subject: Re: [Swftools-common] Getting page count from SWF
Date: Fri, 13 Nov 2009 01:32:43 +0000

On Thu, Nov 12, 2009 at 10:00 PM, Chris Pugh <address@hidden> wrote:
> I'm not sure that this information is given by any of the swftools commands.
>
> When you use pdt2swf to convert a pdf, then the resulting swf usually has
> one frame per page.  So, the total number of pages equals the total number
> frames.
>
> In actionscript you can get the total number of frames in a movie by using
> totalframes, as in,
>
>    myMovie.totalframes
>

You can get the total frames, also, with:

swfdump -f file.swf


In python you can do:
import gfx
swf = gfx.open("swf", "file.swf")
print swf.pages


In C:
/*
Compile with:
    gcc -c swfpages.c -o swfpages.o
    gcc swfpages.o -o swfpages path/to/librfxswf.a path/to/libbase.a -lz
*/
#include <stdio.h>
#include "path/to/rfxswf.h"

int main (int argc,char ** argv)
{
    SWF swf;
    int f;

    f = open("file.swf", O_RDONLY|O_BINARY);
    swf_ReadSWF(f, &swf);
    printf("%d\n", swf.frameCount);
    close(f);

    return 0;
}


Ricardo




reply via email to

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