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