in Technology

PDF2SWF – swf not showing up in the Loader component

I am facing a peculiar problem. Looks like it is a pdf2swf issue, I am pretty much frustrated with it. Posting it here to see if somebody can solve it!

I have pdf2swf installed on a Linux server. A user would upload a PDF file, pdf2swf converts that to swf and then we show it in a Flash app. We also show JPGs in the app – uploaded in a similar manner.

Now, the PDF is being converted to SWF successfully. If I load up the SWF in the browser, it shows up fine. But it does not show up in the Flash app.

We are using the Loader component in Flash 8. It does emit all the events of load progress, and also shows the event when the file has been completely loaded. Despite it being loaded completely, the swf does NOT show up in the loader.

I checked up for stupid mistakes I could make. Position of the content in loader, transparency, correct filenames, permission check – but everything seems to be in order. The same loader can easily load JPGs and other SWFs – the ones which are not created by pdf2swf.

I tried various options with pdf2swf command line – but none solved the problem.

I am stuck with this and would really like some help!

Can anybody throw some light on this?

Write a Comment

Comment

19 Comments

  1. I could not also load the swf locally in the app. That was keeping the swf in the same folder.

    I can’t load the swf (or even the jpeg) from the server when I test locally giving the server URL. I get security sandbox error (as expected)!

    On the server, the URL’s to access the jpeg / other swfs / and the pdf2swf generated swfs are the same. All files are placed in the same folder on the server. And the app and those files are in the same domain. App is one folder above the files.

    I don’t know if this would have something to do with it, but I am appending a random number to the URLs to make sure they don’t come from cache. The file did not load even if I removed it though.

    TIA..

  2. Ok, figured this out finally with Greg Burch’s help.

    The SWF was not loading because we were resizing it to fit in the Loader. If we did not resize the content, the SWF generated via pdf2swf loaded correctly.

    Very weird. Sent a note to pdf2swf guys about this.

  3. How exactly were you resizing SWF file received from pdf2swf converted, I do not get it from the sentence “we were resizing it to fit in the Loader”.

    I am using MovieClipLoader class from Flash 8 with SWF file from pdf2swf and everything works fine.

    BTW, are you using PDF hyperlinks converted to button actions in SWF? If yes, then I have an question to you 🙂

  4. If I remember it correctly, we were scaling the swf using _xscale and _yscale. We used loadMovie and put it in a Loader component.

    We did not use PDF hyperlinks. How is it?

    We are using pdf2swf for another project now – with Flex actually, and it loads up all well without any problems.

  5. All right, Nirav, thanks for you answer.

    Do you know BTW, for your previous situation with resizing you could probably rely on special pdf2swf.exe parameter -s zoom=10?

    Resizes PDF during convertion with a size ratio 10, how cool is that? 😉

    OK, back to PDF hyperlinks. If you use PDF hyperlinks feature of PDF file, than after the convertion to SWF is over by pdf2swf tool PDF hyperlinks are converted into Flash button action onPress and inside there is an old friend getURL(myURL, “_self”).

    This brings into resulted SWF some interactivity.

    Example of our Bat file that does the convertion:

    “C:\tools\pdf2swf.exe” –flashversion=6 -z -s zoom=10 -s ignoredraworder -s jpegquality=20 -s splinequality=5 -s fontquality=50 input.pdf -o output.swf –pages=1

    I’m glad PDF2SWF works fine with Flex 2 apps, we are looking forward to use this tool along with Flex 2.

  6. Hi,
    I am having a similar issue.
    I am using Pdf2Swf to convert PDF files to Swf on the server.
    I am using ASP.Net 2.0 and while it works perfectly on my machine (Win XP) it fails when posted on Win 2003 server.
    If I run the pdf2swf.exe directly on the server it works perfectly but not when I run it through my ASP Code.

    Can Anyone help please? I have tried almost everything but not succeeded so if anyone can help me on this it would be great.

    I personally think its a security issue but not sure how to resolve it.

  7. How did you get pdf2swf files to work with flex? I have loaded them in, but since they are VM1 I cannot access any properties on the loaded in swf. Like gotoAndStop(2) for example to go to the next page.

  8. I’m having this issue too. I’m loading an SWF created by pdf2swf using actionscript 3, but when I try to “gotoAndStop(3)” it doesn’t doing anything, also printing out “totalFrames” only shows 1. Does anyone know of a work around or a way to access SWF’s created by pdf2swf in AS3?

  9. Haven’t used this lately. We are doing everything with Flex now, and things work great in Flex.

    Noah, bwise, Abhi: Are you using Flash? Could you get further into this?

    :Nirav

  10. I am having this same problem. a pdf has been converted, and running it solo works just fine. I am trying to load this swf into my flash project so I can control it from there. I made a loader which works fine as well, but I never actually see the swf I have loaded. Here is the code I used:

    package {
    import flash.events.Event;
    import flash.display.MovieClip;
    import flash.events.ProgressEvent;
    import flash.geom.Rectangle;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.display.Loader;

    public class Katalog extends MovieClip {

    private var loader:Loader;
    private var request:URLRequest;
    private var url:String;
    private var loaderline:LoaderLine;

    public function Katalog() {
    var url:String = “katalog.swf”;
    loaderline = new LoaderLine();
    request = new URLRequest(url);
    loader = new Loader();
    loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progress);
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, init);
    var urlReq:URLRequest = new URLRequest(url);
    loader.load(request);
    addChild(loaderline);
    }
    private function progress(e:ProgressEvent) {
    //trace(“loading bg … ” e.bytesLoaded “/” e.bytesTotal);
    loaderline.y = stage.stageHeight / 2;

    var percentageDone:Number = e.bytesLoaded / e.bytesTotal;
    trace(percentageDone*100 “% loaded”);
    loaderline.scaleX = percentageDone;
    }
    private function init(e:Event) {
    addChild(loader);
    loader.y = 10;
    //loaderline.visible = false;
    loader.width = stage.stageWidth;
    loader.height = stage.stageHeight 10;
    trace(“the swf has been loaded.”);
    }

    }

    }

  11. PsychoFreud: Here’s something you can try.

    Check the properties of the loader variable in init() function. I am not sure if doing just a simple addChild(loader) will add the loader to the stage. Also, don’t size the loader. Let it take the default size. Then see what you get.

  12. Couple things you may want to look at.
    When you pull in Bitmaps larger that 2880px, they don’t come through. It’s possible you have items in your external swf that are too big.

    Secondly: If your host flash app is in AS3 and the external swf is in AS1 or AS2 then it comes in as an AVM1Movie DisplayObject. Which is essentially a stub class. You might want to make sure that you have pdf2swf set to output at Flash 8.
    ex) pdf2swf –flashversion 8 source.pdf -o output.swf

    You may also want to insure that there is only one page with the swf. I found I needed to break the pdf pages into several swfs to use a custom page turner in my flash app.

  13. I made a nice flyout menu in flash. I use the loadmovie command to display the flyouts in the menu. the menuboxes that flyout in the menu are very big, so that is why I load them seperat. Everything works fine in flash, also if I publish it in html. But when I upload it to my website, the command does not work anymore, and I have no idea why. Could this be a similar problem?

  14. even I have a question here.
    I load swfs ( created by pdf to swf) in as3.
    now the hyperlink in these swfs work on my local system but not when the player is uploaded to website.
    Kindly mail me…I am stuck with this for a long time now:)

  15. I got same problem with flex builder SWFloader loading a VM1 swf generated by pdf2swf, latest version works but is a developer version and so not so stable and easy to install on a Linux server 🙁

    anyone got some hints how to navigate trought frames using flex3 and loading swfs generated by pdf2swf?

    Nirav how you solved the problem? you are using always flex also to read swf generated by pdf?

    thanks hope someone can help me!!

  16. Hi Guys,

    When we use this tool to convert the PDF in SWFs, most of the hyperlinks in the original PDF are lost and only few are retained, despite of using the Hyperlink feature. Anybody having an idea about this?

    Any help would be appreciated.

    Thanks.

  17. Hi all,

    how to give the alldomain(‘*’) property while genarating the swf from the pdf

    Thanks & Regards
    Shankar Naspuri