Solved! Go to Solution.
var file : FileReference = new FileReference() file.save(myPDF.save(Method.LOCAL),"my.pdf");
Are you sure you need to be sending custom HTTP headers when using navigateToUrl() in your flex widget? There might be a way to do it without using those HTTP headers? Mind posting the relevant code where you are using navigateToUrl() with AlivePDF?
myPDF.save(Method.REMOTE, pdfGeneratorURL, Download.ATTACHMENT, "lcGisMap.pdf");
Here is more of the error:
SecurityError: Error #3769: Security sandbox violation: Cannot send HTTP headers when using navigateToUrl().
at global/flash.net::navigateToURL()
at org.alivepdf.pdf::PDF/save()[/Users/adobe/Desktop/AlivePDF/src/org/alivepdf/pdf/PDF.as:3495]
at components.printing::PrintSetupWindow/sendPrint()
The line in my code at 319 is:
myPDF.save(Method.REMOTE, pdfGeneratorURL, Download.ATTACHMENT, "lcGisMap.pdf");
The alivepdf code at line 3495 is not available to me as that is within the alivepdf binary library.
As far as i can tell, I'm not explicitly sending custom headers but that doesn't mean something isn't going on within the alivepdf code.
public function savePDF( pMethod:String, pURL:String='', pDownload:String='inline', pName:String='generated.pdf' ):* { finish(); if ( pMethod == Method.LOCAL ) return this.buffer; var header:URLRequestHeader = new URLRequestHeader ("Content-type", "application/octet-stream"); var myRequest:URLRequest = new URLRequest ( pURL+'?name='+pName+'&method='+pDownload ); myRequest.requestHeaders.push (header); myRequest.method = URLRequestMethod.POST; myRequest.data = savePDF( Method.LOCAL ); navigateToURL ( myRequest, "_blank" ); return null; }
(var header:URLRequestHeader = new URLRequestHeader ("Content-type", "application/octet-stream");)
var file : FileReference = new FileReference() file.save(myPDF.save(Method.LOCAL),"my.pdf");
prompting the user to save the file locally will work.var file : FileReference = new FileReference() file.save(myPDF.save(Method.LOCAL),"my.pdf");
I too am looking for a better workaround, everyone likes to see the PDF before they print or save. I would encourage everyone who is experiencing the issue to vote on the bug
Anyone else doing anything differently since May?
We discovered the same thing here. I still have FP 11.x so I wasn't noticing any issues, but others with 13.x are.
Will try the above just to have *something* work but I agree with Aaron - people like to see what they are downloading before downloading!
Just trying to keep our Flex app going for a while longer as-is.....
Thanks,
Carmen