Adobe Flash (SWF) to SVG and PDF

Updated 2020/04/19: Uploaded source code on GitHub.

Recently, I found some documents exported as SWF. It would be certainly more convenient for me if I could read these documents in my PDF reader. So I needed a utility to convert content from Adobe Flash to PDF. For this reason, I’ve written a small Python program that utilizes the SWFTools in order to parse the SWF and exports output in SVG and PDF file formats.

You can download the utility from here: SWF to SVG/PDF. It is still very experimental and will certainly need some tuning in order to produce perfect output. In order to use it, you need, of course, Python and, also, the SWFTools. You need to add a few lines in lib/Makefile of SWFTools in order to create a dynamic library for Python:

librfxswf.$(SLEXT): $(rfxswf_objects) rfxswf.$(O) drawer.$(O) $(lame_in_source) $(h263_objects) $(as12compiler_in_source) $(as3compiler_objects) libbase$(A)
  $(L) -g -shared -o $@ $^ -lz

The utility is split into two parts. The uses Python ctype in order to communicate with the dynamic library and the is the main engine that performs the transformation. Currently shapes and text are supported. Eventually, more stuff could be implemented. It should be possible to transform a Flash application completely into an equivalent HTML5 application. I’ll leave that as an exercise for the reader!

You can see here an example of the utility:

  • The original PDF.
  • The SWF produced by SWFTools’ pdf2swf tool.
  • The output SVG produced by the SWF to SVG/PDF utility presented here.
  • The output PDF produced by the SWF to SVG/PDF utility presented here.

26 Responses to “Adobe Flash (SWF) to SVG and PDF”

  1. Pat Coyne Says:


    Very interesting post. I would like to convert static SWF files into SVG. I have used swftools but I’m afraid my knowledge of Python is non-existent. Is it possible to run your utility on Windows? if so how should it be installed and run?


    Pat Coyne

    • prekageo Says:

      It should be possible to use it under Windows. I recommend installing Cygwin. Then you need to compile swftools and use the Python utility.

  2. rageahol Says:

    what version of swftools was this? there is a separate tool that is supposed to do something similar, gfx2gfx, but it’s not very helpful for my purposes.

    if you could give some tips on tuning this it would be helpful too, i keep getting upside down text, and am not sure how to troubleshoot that.

    • prekageo Says:

      Can you give an example of an SWF file that gives you upside down text? I guess you need to fine tune the transformation matrix.

  3. Anonymous Says:

    how can i use it under linux?
    is it necessary to recompile swftools?

    • prekageo Says:

      Yes, it is necessary. You have to add the lines mentioned in the Makefile in order to build a library that exposes the functionality of SWFTools.

  4. Mike Says:

    Hello! I tried adding that line you mentioned, but all that is produced during make is librfxswf.a; there is no librfxswf.dll. I am adding those two lines to lib/ What could I be doing wrong? (I am using SWFTools 0.6.2). Cheers 🙂

  5. Francisco Espinoza Says:

    An excellent tool, looking at the examples you have posted. I am interested in spending many swf files to pdf format. I would like you to give some more details about the installation and use, for newbies like me if possible. Please, I really urges me to use your tool, so far had only managed to convert swf to png.

    • prekageo Says:

      You must first install Python and then the SWFTools. Then you must change a little bit the Makefile and compile SWFTools. If you find any problem, you can ask here for clarifications.

  6. Francisco Espinoza Says:

    Please, tell me what I do it wrong (Im using Ubuntu 13.10):

    pacoesni@ubuntu:~/Downloads/swf_to_svg_pdf$ python
    Traceback (most recent call last):
    File “”, line 18, in
    s = swf_lib.SWF()
    File “/home/pacoesni/Downloads/swf_to_svg_pdf/”, line 218, in __init__
    self.lib = cdll.LoadLibrary(LIB_PATH)
    File “/usr/lib/python2.7/ctypes/”, line 443, in LoadLibrary
    return self._dlltype(name)
    File “/usr/lib/python2.7/ctypes/”, line 365, in __init__
    self._handle = _dlopen(self._name, mode)
    OSError: librfxswf.dll: cannot open shared object file: No such file or directory

    • prekageo Says:

      Since you are using Linux you must change the .DLL extension to .so and ensure that you have built the file

  7. J Skoba Says:

    Would it be possible to share ‘’ ? Even after making the changes you mention above to ‘’, I can only find an ‘librfxswf.a’ file on the system. Running Ubuntu 13.10 x86

    • prekageo Says:

      Check this comment reply ( It might provide the solution you are seeking.

      • J Skoba Says:

        prekageo, thanks for your reply!

        Unfortunately that link does not help. I am adding the code above to “”, and I have verified that the code also appears in “Makefile” once I run “./configure”

        Here is a dump of my and the resulting Makefile. Can you please let me know if perhaps I have inserted the code in the wrong place?



      • prekageo Says:

        Just try to execute: make

      • J Skoba Says:

        Thanks for your quick reply!

        I didn’t even think of that (was trying to “make librfxswf” at one point).

        Unfortunately GCC produces an error (at the end):

        root@/home/swftools/lib# make
        gcc -DHAVE_CONFIG_H -g -shared -o modules/swfaction.o modules/swfbits.o modules/swfbutton.o modules/swfcgi.o modules/swfdraw.o modules/swfdump.o modules/swffilter.o modules/swffont.o modules/swfobject.o modules/swfrender.o modules/swfshape.o modules/swfsound.o modules/swftext.o modules/swftools.o modules/swfalignzones.o rfxswf.o drawer.o lame/psymodel.o lame/fft.o lame/newmdct.o lame/quantize.o lame/takehiro.o lame/reservoir.o lame/quantize_pvt.o lame/vbrquantize.o lame/encoder.o lame/id3tag.o lame/version.o lame/tables.o lame/util.o lame/bitstream.o lame/set_get.o lame/VbrTag.o lame/lame.o h.263/dct.o h.263/h263tables.o h.263/swfvideo.o action/assembler.o action/compile.o action/lex.swf4.o action/lex.swf5.o action/libming.o action/ action/ action/actioncompiler.o as3/abc.o as3/pool.o as3/files.o as3/opcodes.o as3/code.o as3/registry.o as3/builtin.o as3/tokenizer.yy.o as3/ as3/scripts.o as3/compiler.o as3/import.o as3/expr.o as3/parser_help.o as3/state.o as3/common.o as3/initcode.o as3/assets.o libbase.a -lz

        gcc: error: No such file or directory
        make: *** [] Error 1

        Sorry if this is a noob problem! Really appreciate your advice 🙂

      • prekageo Says:

        You are right that it doesn’t work. The -o was in the wrong place. I’ve fixed the inline code in the post above! Thanks for spotting it!

      • J Skoba Says:

        Many thanks, I am now able to build

        I receive an “undefined symbol: jpeg_resync_to_restart” error when running

        I suspect it is a configuration problem. I have libjpeg62-dev installed, but the libjpeg*.so files are appearing in /usr/lib/i386-linux-gnu instead of /usr/lib as I’ve read they should be.

        I will continue looking into this problem, thanks again for your help and hopefully I get this working!

  8. tony Says:

    Any solution about this 😦
    Traceback (most recent call last):
    File “”, line 18, in
    s = swf_lib.SWF()
    File “/home/mac/swftools/lib/swf2pdf/”, line 218, in __init__
    self.lib = cdll.LoadLibrary(LIB_PATH)
    File “/usr/lib/python2.7/ctypes/”, line 443, in LoadLibrary
    return self._dlltype(name)
    File “/usr/lib/python2.7/ctypes/”, line 365, in __init__
    self._handle = _dlopen(self._name, mode)
    OSError: ../ undefined symbol: jpeg_resync_to_restart

  9. zerocoll Says:

    working perfectly for me 🙂

    no extract image from original swf ..

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: