2 Step 1: Converting the documents
4 Suppose you have an arbitrary pdf file, "document.pdf".
6 pdf2swf -o tmp.swf document.pdf
7 Now, tmp.swf is a Flash Movie generated from document.pdf. Movie means
8 that there are no navigation elements whatsoever. Just frames which
9 get displayed one by one, at a rate of approx. 1/2 frames/second. How
10 to make document browsable is explained below.
11 (You can do the same things described below with jpeg files. Simply
13 jpeg2swf -o tmp.swf pic1.jpeg pic2.jpeg ...
16 Step 2: Linking a viewer
18 Just take a viewer of your choice (e.g. [1]SimpleViewer.swf ) and put
19 it in the same directory where you entered the commands above.
21 swfcombine -o flashfile.swf SimpleViewer.swf viewport=tmp.swf
22 Now, 'flashfile.swf' is "browsable", i.e. there are some buttons in it
25 Step 3: Linking a Preloader
27 Depending on the size of your PDFs/SWFs, you may want to have some
28 kind of loading animation displayed while the browser is busy getting
29 the actual document. Assuming you have some file like flashfile.swf
30 above, you furthermore need the file [2]PreLoader.swf and an arbirtary
31 loading animation of your choice. (To get started, try [3]loading.swf,
32 or just convert a "Loading" JPEG picture to swf (jpeg2swf -o
33 loading.swf picture.jpg)) Now use
34 swfcombine -o flashfile.swf PreLoader.swf loader=loading.swf
36 (Most loaders are smaller than the document they load. They usually
37 need some centering so they appear in the middle of the page to be
38 displayed, not in the upper left corner. Replace the above command
40 swfcombine -o flashfile.swf PreLoader.swf -x 3000 -y 3000
41 loader=loading.swf movie=flashfile.swf
42 and try playing around with the values after -x and -y)
44 Step 4: Correcting the size and framerate
46 Sometimes, the bounding box of the generated flash file is not
47 correct. This happens because when linking a viewer or preloader to
48 the SWFs, the new dimensions are those of the PreLoader and Viewer
49 templates, and not those of your pdf or jpeg files. To fix this, use
50 swfcombine --dummy `swfdump -XY tmp.swf` flashfile.swf -o
52 (tmp.swf is your 'original' swf, generated like above)
53 You may also want to adjust the framerate of the movie to that of the
54 preloader. (As the preloader is usually the only animated part of e.g.
57 swfcombine --dummy `swfdump -r loading.swf` flashfile.swf -o
60 Step 5: Embedding the SWF into a html page
62 Usually, one wants to put the generated SWFs on his web page. To do
63 so, you have to embed the SWF file into html. If you don't know how to
64 embed SWFs into html pages, it's explained at
65 [4]http://www.macromedia.com/support/flash/ts/documents/tn4150.html .
66 Also, you can simply type
67 swfdump --html flashfile.swf
68 and insert the output into your html document
70 Appendix A: Creating your own Viewers
72 If you know about Flash, and you want to substitute SimpleViewer from
73 above with something more sophisticated, follow these rules:
74 1. There has to be some rectangle (Movieclip, whatever... ) in your
75 Viewer, named "viewport". (This name is used to reference the object
76 when using swfcombine for merging it with the converted pdfs)
77 2. Browsing buttons next to the rectangle (which turn pages in the
78 shown pdf) should trigger some Actionsscript events, like
84 to set the frame in the to-be-replaced rectangle. (It will be replaced
85 with a MovieClip, therefore a SetTarget is neccessary)
86 It's important that the Target Name ist "viewport", not "/viewport",
87 as the Movie will get inserted into a Movieclip.
88 _________________________________________________________________
90 [5]Back to the SWFTools Project page
94 1. http://www.quiss.org/swftools/SimpleViewer.swf
95 2. http://www.quiss.org/swftools/PreLoader.swf
96 3. http://www.quiss.org/swftools/loading.swf
97 4. http://www.macromedia.com/support/flash/ts/documents/tn4150.html
98 5. http://www.quiss.org/swftools