generated from pdf2swf_usage.html
[swftools.git] / pdf2swf / HOWTO_pdf2swf
1
2 Creating browseable SWFs from PDFs
3
4    Suppose you have an arbitrary pdf file, "document.pdf". Furthermore,
5    you have downloaded [1]SimpleViewer.swf into the directory where
6    document.pdf lies.
7    Now call:
8    $ pdf2swf -o tmp.swf document.pdf
9    $ swfcombine -o flashfile.swf SimpleViewer.swf viewport=tmp.swf 
10    Now, flashfile.swf should be a browseable flash representation of
11    document.pdf which can be embedded into your web page.
12    If you don't know how to embed SWFs into html pages, it's explained at
13    [2]http://www.macromedia.com/support/flash/ts/documents/tn4150.html .
14    
15 Creating JPEG Slideshows
16
17    You can do the same thing described above with jpeg files. Simply use
18    $ jpeg2swf -o tmp.swf pic1.jpeg pic2.jpeg ...
19    $ swfcombine -o flashfile.swf SimpleViewer.swf viewport=tmp.swf 
20    
21 Linking a Preloader
22
23    Depending on the size of your PDFs/SWFs, you may want to have some
24    kind of loading animation displayed while the browser is busy getting
25    the actual document. Assuming you have some file like flashfile.swf
26    above, you furthermore need the file [3]PreLoader.swf and an arbirtary
27    loading animation of your choice. (To get started, try [4]loading.swf,
28    or just convert a "Loading" JPEG picture to swf (jpeg2swf -o
29    loading.swf picture.jpg)) Now use
30    $ swfcombine -o flashfilewithloader.swf PreLoader.swf
31    loader=loading.swf movie=flashfile.swf 
32    
33 Creating your own Viewers
34
35    If you know about Flash, and you want to substitute SimpleViewer from
36    above with something more sophisticated, follow these rules:
37    1. There has to be some rectangle (Movieclip, whatever... ) in your
38    Viewer, named "viewport". (This name is used to reference the object
39    when using swfcombine for merging it with the converted pdfs)
40    2. Browsing buttons next to the rectangle (which turn pages in the
41    shown pdf) should trigger some Actionsscript events, like
42    
43      SetTarget "viewport"
44      NextFrame
45      SetTarget ""
46      
47    to set the frame in the to-be-replaced rectangle. (It will be replaced
48    with a MovieClip, therefore a SetTarget is neccessary)
49      _________________________________________________________________
50    
51    [5]Back to the SWFTools Project page
52
53 References
54
55    1. http://www.quiss.org/swftools/SimpleViewer.swf
56    2. http://www.macromedia.com/support/flash/ts/documents/tn4150.html
57    3. http://www.quiss.org/swftools/PreLoader.swf
58    4. http://www.quiss.org/swftools/loading.swf
59    5. http://www.quiss.org/swftools