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    (Also, you can simply type
15    swfdump --html flashfile.swf 
16    and insert the output into your html document)
17    
18 Creating JPEG Slideshows
19
20    You can do the same thing described above with jpeg files. Simply use
21    jpeg2swf -o tmp.swf pic1.jpeg pic2.jpeg ...
22    swfcombine -o flashfile.swf SimpleViewer.swf viewport=tmp.swf 
23    
24 Linking a Preloader
25
26    Depending on the size of your PDFs/SWFs, you may want to have some
27    kind of loading animation displayed while the browser is busy getting
28    the actual document. Assuming you have some file like flashfile.swf
29    above, you furthermore need the file [3]PreLoader.swf and an arbirtary
30    loading animation of your choice. (To get started, try [4]loading.swf,
31    or just convert a "Loading" JPEG picture to swf (jpeg2swf -o
32    loading.swf picture.jpg)) Now use
33    swfcombine -o flashfilewithloader.swf PreLoader.swf loader=loading.swf
34    movie=flashfile.swf 
35    
36 Creating your own Viewers
37
38    If you know about Flash, and you want to substitute SimpleViewer from
39    above with something more sophisticated, follow these rules:
40    1. There has to be some rectangle (Movieclip, whatever... ) in your
41    Viewer, named "viewport". (This name is used to reference the object
42    when using swfcombine for merging it with the converted pdfs)
43    2. Browsing buttons next to the rectangle (which turn pages in the
44    shown pdf) should trigger some Actionsscript events, like
45    
46      SetTarget "viewport"
47      NextFrame
48      SetTarget ""
49      
50    to set the frame in the to-be-replaced rectangle. (It will be replaced
51    with a MovieClip, therefore a SetTarget is neccessary)
52    It's important that the Target Name ist "viewport", not "/viewport",
53    as the Movie will get inserted into a Movieclip.
54      _________________________________________________________________
55    
56    [5]Back to the SWFTools Project page
57
58 References
59
60    1. http://www.quiss.org/swftools/SimpleViewer.swf
61    2. http://www.macromedia.com/support/flash/ts/documents/tn4150.html
62    3. http://www.quiss.org/swftools/PreLoader.swf
63    4. http://www.quiss.org/swftools/loading.swf
64    5. http://www.quiss.org/swftools