chengse66 / alivepdf

Automatically exported from code.google.com/p/alivepdf
0 stars 0 forks source link

PDF not visible on browser when using HttpService call to AlivePDF servlet #184

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create an alivepdf servlet
2. Override the save method in the alivepdf servlet and replace the 
URLRequest with HttpService (code shown below)
2. Create a pdf object and add a page with some ImageStream
3. Invoke the overriden save method

<SaveCode>
 override public function save ( method:String, url:String='', 
downloadMethod:String='inline',
         fileName:String='output.pdf', frame:String="_blank" ):*
         {
            dispatcher.dispatchEvent( new ProcessingEvent ( 
ProcessingEvent.STARTED ) );
            var started:Number = getTimer();
            finish();
            dispatcher.dispatchEvent ( new ProcessingEvent ( 
ProcessingEvent.COMPLETE, getTimer() - started ) );
            buffer.position = 0;
            var output:* = null;
            switch (method)
            {
            case Method.LOCAL :
            output = buffer;
            break;
            case Method.BASE_64 :
            output = Base64.encode64 ( buffer );
            break;
            case Method.REMOTE :
            var myServ:HTTPService = new HTTPService(); 
            myServ.method = "POST";
            var params:Object = {};         
            params["name"] = fileName;
            params["myContent"] = Base64.encode64(buffer);   //base 64 
encoded bytestream
            params["method"] = downloadMethod;            
            myServ.url = url; 
            var call:AsyncToken = myServ.send(params);
            break;
            default:
            throw new Error("Unknown Method \"" + method 
+ "\"");
            }
            return output;
            }
</SaveCode>

What is the expected output? 
Popup should open displaying the pdf in the browser
What do you see instead?
No change

What version of the product are you using? On what operating system?
Version: 1.4.9
OS: Windows XP Professional

Please provide any additional information below.

When using the default save of alivepdf (which uses UrlRequest) everything 
works as expected (pdf opens up in a popup). But using HttpService I am 
facing the problem described above. Using HttpService, I can see the 
request and response headers as well, and all looks ok (contentlength is 
set, contenttype is also set to application/pdf). I have also tried 
trapping the alivepdf bytestream on the server and creating a file out of 
it, that opens up fine as well.
Please advice!

Original issue reported on code.google.com by abhigyan...@gmail.com on 21 Dec 2009 at 6:52

GoogleCodeExporter commented 8 years ago
hello, i am having a similar issue

or, rather, i would like to force the pdf to open in a new window as opposed to 
a
save dialog

was there any resolution to this?

Original comment by ScottCah...@gmail.com on 4 May 2010 at 4:52

GoogleCodeExporter commented 8 years ago
hi have you found an answer?

Original comment by ice8...@gmail.com on 29 May 2010 at 12:32