A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 21

Thread: .swf to PDF on the fly?

  1. #1
    Junior Member
    Join Date
    Nov 2000
    Posts
    19

    Wink

    Has anyone successfully created a Flash app that can import movies/images and output the imported results to PDF or postscript?

    Is there any middleware available to convert .swf's to PDF on the fly (serverside)? Is there any reason this isn't possible? Since the Flash/.swf format is primarily vector-based, I would think that it's a no-brainer.

    Any insight would be greatly appreciated.
    ---
    c

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi cwhite,

    I usually comprehend pdf as a static, print-like medium and swf as one that typically includes movement and action.

    It can be done, since you can obviously print a flash, and if you are printing on a computer where your "printer" happens to be pdf-writer, ...

    There are a few drawbacks, though: swf internally uses something for fonts that could be described as truetype without hints. Therefore using type that can not be substituted by the original font (an swf normally includes the font name, but it must be present on the machine doing the conversion) will probably degrade type quality

    And, as far as action is concerned, how would you want to specify which frames to print?
    Maybe tell a little more about your project, and you'll receive a few ideas that really help you. May I guess that you are considering a unix type server where you are allowed to install C programs for the cgi part?

    Musicman

  3. #3
    Junior Member
    Join Date
    Nov 2000
    Posts
    19
    Hi Musicman,
    Thanks for the response, maybe this will help clarify a bit. The .swf to output would only be a single frame -- no animation or actions -- pretty much static, so there would be no need to specify which frames to print.

    The server is running UNIX/apache.

    The font thing could be an issue since our desired end-product is print. Thanks again!

    Anymore thoughts, let me know.
    ---
    c

  4. #4

    resolved Check this

    Im not quite sure what you specifically want to do, but some time ago I needed to output flash to a printer as postscript.
    Here are the results, printout the drawings to observe the quality, nice!!

    http://www.keynet.ie/~holden/coldrooms.html#tour

    If you have any question give us a shout

    Regards,

    Sacevoy

    "Hardcore till the end \n"

  5. #5
    Junior Member
    Join Date
    Nov 2000
    Posts
    19
    Thanks Sacevoy - nice diagrams by the way. Still not quite what I'm looking for, but is another idea.

    I Could set up a dedicated machine to (post process from the Flash app and) print .swf to Postsript or PDF (as Musicman suggested). However, I need this to be a fully automated, serverside process that can process large batches of .SWF files very quickly.

    The final output from the PDF or raw Postscript will be used to go straight to a printing press. There are other issues involved with going to press obviously, such as resolution, and CMYK conversion -- which I think we have developed work-arounds for. The main hurdle is just getting the file from .swf to a postscript-friendly format.

  6. #6

    Post

    Heres a thought,
    You'd have to be more specific so I could try to solve the problem completely.
    As far as I can tell heres what I would do -> Say for instance you have a picture and you want to display it in flash over the net, but you want to print it using PDF.

    Basically you will import Images into flash using the MING library for PHP.

    reference :: http://www.php.net/manual/en/ref.ming.php

    /****************************************
    * CODE for displaying picture in flash *
    * Output 400 by 400 movie *
    * Would probably need to *
    * crop and resize pic (use ImageMigick) *
    * Or other native PHP resizing tools *
    ****************************************/

    $s = new SWFShape();
    $f= $s->addFill(new SWFBitmap("imported_picture.jpg"));
    $s->setRightFill($f);
    $s->drawLine(400, 0);
    $s->drawLine(0, 400);
    $s->drawLine(-400, 0);
    $s->drawLine(0, -400);

    $m = new SWFMovie();
    $m->setDimension(400, 400);
    $m->add($s);

    header("Expires: ".gmdate("D, d M Y H:i:s")."GMT");
    header("Cache-Control: no-cache, must-revalidate");
    header("Pragma: no-cache");
    header('Content-type: application/x-shockwave-flash');

    $m -> output();

    /*********************************************
    * Then you could provide a link to a PDF *
    * formatted version of the pic using *
    * the PDF library by Thomas Merz *
    *********************************************/

    reference :: http://www.php.net/manual/en/ref.pdf.php

    $pdf = PDF_new();
    PDF_open_file($pdf, "imported_picture.pdf");
    PDF_set_info($pdf, "Author", "Sacevoy");
    PDF_set_info($pdf, "Title", "Test for cwhite771");
    PDF_set_info($pdf, "Creator", "Sacevoy");
    PDF_set_info($pdf, "Subject", "Testing");
    PDF_begin_page($pdf, 400, 400);
    PDF_add_outline($pdf, "Page 1");

    etc, etc, etc ;

    /************************************************** *******/

    Now you have a web app that displays a picture in flash but also formats the picture in PDF for printing!

    Regards;

    Sacevoy ~:-)

    "Hardcore till the end \n"

  7. #7
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi cwhite,

    could you perhaps post a sample swf. I think I have some code that might be a good starting point for the conversion, and it would definitely want to run on unix. I do not consider flash or flash player for the printing, and I dont know whether either of these could be run in a server environment at all. I'm rather thinking about some kind of swf disassembler which I used before to reconstruct fonts from swf showings.


    Musicman

  8. #8
    Junior Member
    Join Date
    Nov 2000
    Posts
    19
    Sorry if I've been too vague. What I'm trying to create is essentially a stripped down page layout app using graphical templates (predetermined fonts, styles, colors, etc.) with some basic import resizing and placement capabilities for vector and bitmap art. The vector and bitmap images would either reside in or be imported into a database. The final output is intended for use on a commercial printing press (hence the desired PDF/postscript part).

    How about this: The Flash app would function as a "for position only" tool that would allow you to import, (using a Generator) resize, and move around images and type withinin a workspace. The app would then output all of the properties (x and y position, xscale, yscale) of the objects/files placed to either a text file or database.

    A serverside app would reconstruct the desired formatting taken from the Flash app output into postscript which would then be output to PDF (thanks for the link to PDFlib, Sacevoy). Images would be converted using Image Majik - 1 (low-res) for Flash placement (the app preview image) and 1 (high-res) for the final print assembly. The PDF is intended as a print proof representing the final output.

    Musicman, I'm also quite curious about your disassembler and how that could tie in. The files created to be output will be nothing special (no actions or animation) -- just text and imported vector art and bitmap images (artwork would be pulled from a database).

    Thanks again for your input guys. Any more thoughts, let me know.
    ---
    c
    [Edited by cwhite771 on 04-07-2001 at 02:57 AM]

  9. #9
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi cwhite,

    I am working on something similar (vinyl cutting rather than printing, so there won't be images....)
    One thing that is missing from your design is generating actual typeset text as flash in usual typographic quality: while ming etc. allow you to put text on the swf, you will probably want to go one step further and send the output from a page layout program to some sort of flash printer driver.
    The example http://www.maas-noten.de/cgi-bin/plo...32%2c227&swf=1 is made using a "layout" program running on the webserver that pipes into a "print as swf" app. The same layout program would then be used to create a postscript version for the signcutter. A little bit of info about the "print as" program can be found here: http://board.flashkit.com/board/show...hreadid=106254

    Musicman

  10. #10

    Post Maybe this will help

    Yo,

    I have converted postscript to pdf before using the following :->

    (Alain M.Samoun Tutorial)

    If you want to transform a postscript document to PDF ::

    Adobe has a program called Distiller with a windows version that can be instantiated using PHP COM as follows (Must be installed on server!):-

    reference :: http://www.adobe.com/products/acrdis/main.html

    <?php
    $pdf = new COM("pdfdistiller.pdfdistiller.l");
    $pdf -> FileToPdf ($postscript_file, "", "");
    ?>

    #last 2 options left blank to use defaults
    #where $postscript_file could be Myfile.ps and the result would be Myfile.pdf


    Perhaps the same is possible with Adobe Capture a tool for converting print to PDF ???????????

    Check it out!!


    reference :: http://www.adobe.com/products/acrcapture/main.html

  11. #11
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi sacevoy,

    if I had to convert swf to pdf, I would probably write the code so that it could either generate postscript or pdf and not rely on distiller.
    I have observed in the past that distiller would reject some postscript code I generated, while both mere printers and expensive phototype machines accepted it. You can really just expect that ps generated by well-known applications works fine. These apps will probably support a pdf writer output anyway


    Musicman

  12. #12
    Junior Member
    Join Date
    Nov 2000
    Posts
    19
    I've had some issues with Distiller in the past as well. You'd think that Adobe, the company that invented postscript, would get it right every time (Pagemaker is also rather wretched at creating clean postscript files). Oh well.

    Writing postscript would probably be the way to go.

    Musicman, the concept of your signcutter app seems like it's headed in the right direction - without the vector/bitmap image placement capability, of course. The Flash printer driver concept you've provided seems quite cool -- have to investigate it a bit further.
    ---
    c

  13. #13
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi cwhite,

    want to discuss these things in more detail privately?
    Leave me a mail, then

    Musicman

  14. #14
    Junior Member
    Join Date
    Oct 2001
    Posts
    23

    Lightbulb

    Hi,

    cwhite, did you get the insite that you needed for this
    thread? Looks like I might stumble into a project
    like you described and was wondering if you can
    give me a hint on how to go about it...

    Anything at this point will be greatly appreciated.
    Thanks in advance.

    Samantha

  15. #15
    Junior Member
    Join Date
    Oct 2001
    Posts
    23

    Does anyone Know if this can be done?

    Hello,

    Has anyone been successful with this?
    If so, we need to talk...I am willing
    to $hare re$ource$.

    thanks
    samantha

  16. #16
    Junior Member
    Join Date
    Nov 2000
    Posts
    19
    Hi Samantha,
    We had actually dropped the project up until a few weeks ago, but have just started specing out something with similar functionality. I can't get into too much detail yet, but we're going to use Adobe Framemaker to generate the output and Flash as a "for position only" screen proof.

    It'll be interesting to see if Macromedia decides to build any real print output options into their future server technologies (although I really don't find ColdFusion too appealing of an app platform).

    Our project should be somewhat together over the next month or two -- i'll do my best to post the outcome.
    ---
    c

  17. #17
    Senior Member
    Join Date
    Feb 2001
    Posts
    475
    I once prepared a similar concept for a customer using SVG. I think doing this XML based is perfect for your needs. scripting the layout engine (i don't know how powerful u need this) may get tricky as this is done with ECMAscript (Javascript) and there's no IDE for this (yet) like Flash has.
    the SVG plugin has support for color profiles, CMYK and all the other fancy stuff these printing people need.

    Maybe you can use your existing frontend to customize the SVG and pass it to a browser popup. BTW Illustrator 10 has full support of SVG so designing the templates goes with ease.

    To create SVG from scratch, insert custom elements or change text within it there's much knowledge of XML and friends needed...

    hth
    Yours
    HTD

  18. #18
    Senior Member
    Join Date
    Feb 2001
    Posts
    475
    speaking of XML and SVG i forgot to mention XSL:FO - Formatting Objects, another XML technology.

    goto http://xml.apache.org and get FOP. It will convert XSL:FO and Images to PDF - creating formatting objects is easier than SVG and it has probably enough support for basic layouts.

    But then it'll get tricky doing a flash frontend looking like the output, because template design must be done by hand...

    maybe my second 2 Euro cent help you
    Yours
    HTD
    [Edited by HowardTheDuck on 03-20-2002 at 12:01 PM]

  19. #19
    Junior Member
    Join Date
    Oct 2001
    Posts
    23

    HTD, your input was helpful considering i was
    looking at adobe indesign 2.0 a few days ago
    which had XMP technology that allows for XML programming as well. I have heard it can be done with indesign, but never have seen it.

    I will take a closer look at your suggestion.

    Thanks alot,

    samantha




  20. #20
    Junior Member
    Join Date
    Sep 2015
    Posts
    23
    I wonder whether the PDF converter I am testing these days could help with that or not? Any suggestion will be appreciated. Thanks in advance.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center