X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2FHOWTO_pdf2swf;h=a2095b80375653942c70abde78307d079de06d2e;hb=7be64767e7b09e1d331d30450811a8af82978ee6;hp=016a031b219b47e7bae5aeb8eb0a089f24d8f449;hpb=75113f5da612811ff614d867fdfbc04e37789c61;p=swftools.git diff --git a/pdf2swf/HOWTO_pdf2swf b/pdf2swf/HOWTO_pdf2swf index 016a031..a2095b8 100644 --- a/pdf2swf/HOWTO_pdf2swf +++ b/pdf2swf/HOWTO_pdf2swf @@ -1,39 +1,81 @@ -Creating browseable SWFs from PDFs +Notice - Suppose you have an arbitrary pdf file, "document.pdf". Furthermore, - you have downloaded [1]SimpleViewer.swf into the directory where - document.pdf lies. - Now call: - pdf2swf -o tmp.swf document.pdf - swfcombine -o flashfile.swf SimpleViewer.swf viewport=tmp.swf - Now, flashfile.swf should be a browseable flash representation of - document.pdf which can be embedded into your web page. - If you don't know how to embed SWFs into html pages, it's explained at - [2]http://www.macromedia.com/support/flash/ts/documents/tn4150.html . - (Also, you can simply type - swfdump --html flashfile.swf - and insert the output into your html document) - -Creating JPEG Slideshows + This documentation is a little outdated. As with swftools-0.2.1 and + above, you can simply do + pdf2swf -bl -o document.swf document.pdf + to link viewer and preloader. + However, the Steps below are still valid for jpeg2swf. - You can do the same thing described above with jpeg files. Simply use +Step 1: Converting the documents + + Suppose you have an arbitrary pdf file, "document.pdf". + Call: + pdf2swf -o tmp.swf document.pdf + Now, tmp.swf is a Flash Movie generated from document.pdf. Movie means + that there are no navigation elements whatsoever. Just frames which + get displayed one by one, at a rate of approx. 1/2 frames/second. How + to make document browsable is explained below. + (You can do the same things described below with jpeg files. Simply + use jpeg2swf -o tmp.swf pic1.jpeg pic2.jpeg ... + and read on) + +Step 2: Linking a viewer + + Just take a viewer of your choice (e.g. [1]SimpleViewer.swf ) and put + it in the same directory where you entered the commands above. + Now call: swfcombine -o flashfile.swf SimpleViewer.swf viewport=tmp.swf - -Linking a Preloader + Now, 'flashfile.swf' is "browsable", i.e. there are some buttons in it + for turning pages. + +Step 3: Linking a Preloader Depending on the size of your PDFs/SWFs, you may want to have some kind of loading animation displayed while the browser is busy getting the actual document. Assuming you have some file like flashfile.swf - above, you furthermore need the file [3]PreLoader.swf and an arbirtary - loading animation of your choice. (To get started, try [4]loading.swf, + above, you furthermore need the file [2]PreLoader.swf and an arbirtary + loading animation of your choice. (To get started, try [3]loading.swf, or just convert a "Loading" JPEG picture to swf (jpeg2swf -o loading.swf picture.jpg)) Now use - swfcombine -o flashfilewithloader.swf PreLoader.swf loader=loading.swf + swfcombine -o flashfile.swf PreLoader.swf loader=loading.swf movie=flashfile.swf - -Creating your own Viewers + (Most loaders are smaller than the document they load. They usually + need some centering so they appear in the middle of the page to be + displayed, not in the upper left corner. Replace the above command + with e.g. + swfcombine -o flashfile.swf PreLoader.swf -x 3000 -y 3000 + loader=loading.swf movie=flashfile.swf + and try playing around with the values after -x and -y) + +Step 4: Correcting the size and framerate + + Sometimes, the bounding box of the generated flash file is not + correct. This happens because when linking a viewer or preloader to + the SWFs, the new dimensions are those of the PreLoader and Viewer + templates, and not those of your pdf or jpeg files. To fix this, use + swfcombine --dummy `swfdump -XY tmp.swf` flashfile.swf -o + flashfile.swf + (tmp.swf is your 'original' swf, generated like above) + You may also want to adjust the framerate of the movie to that of the + preloader. (As the preloader is usually the only animated part of e.g. + pdf viewers) + Use: + swfcombine --dummy `swfdump -r loading.swf` flashfile.swf -o + flashfile.swf + +Step 5: Embedding the SWF into a html page + + Usually, one wants to put the generated SWFs on his web page. To do + so, you have to embed the SWF file into html. If you don't know how to + embed SWFs into html pages, it's explained at + [4]http://www.macromedia.com/support/flash/ts/documents/tn4150.html . + Also, you can simply type + swfdump --html flashfile.swf + and insert the output into your html document + +Appendix A: Creating your own Viewers If you know about Flash, and you want to substitute SimpleViewer from above with something more sophisticated, follow these rules: @@ -42,23 +84,23 @@ Creating your own Viewers when using swfcombine for merging it with the converted pdfs) 2. Browsing buttons next to the rectangle (which turn pages in the shown pdf) should trigger some Actionsscript events, like - + SetTarget "viewport" NextFrame SetTarget "" - + to set the frame in the to-be-replaced rectangle. (It will be replaced with a MovieClip, therefore a SetTarget is neccessary) It's important that the Target Name ist "viewport", not "/viewport", as the Movie will get inserted into a Movieclip. _________________________________________________________________ - + [5]Back to the SWFTools Project page References 1. http://www.quiss.org/swftools/SimpleViewer.swf - 2. http://www.macromedia.com/support/flash/ts/documents/tn4150.html - 3. http://www.quiss.org/swftools/PreLoader.swf - 4. http://www.quiss.org/swftools/loading.swf + 2. http://www.quiss.org/swftools/PreLoader.swf + 3. http://www.quiss.org/swftools/loading.swf + 4. http://www.macromedia.com/support/flash/ts/documents/tn4150.html 5. http://www.quiss.org/swftools