我是一只新的flex软件。 我想要做的是生成并保存在服务器上的PDF格式的布局设计,只有画布。目前,我可以在浏览器中显示PDF(请参阅下面的功能:),但无法将文件保存在服务器上。在服务器上保存PDF时的Flex问题
private function continueToPdf():void{
myPDF = new PDF( Orientation.LANDSCAPE, Unit.MM, Size.A4);
myPDF.setDisplayMode (Display.FULL_WIDTH);
myPDF.addPage();
myPDF.addImage(layout_cnv);
myPDF.save(Method.REMOTE, "http://flexindia.org/designtool/upload/create.php",Download.INLINE ,"drawing.pdf");
}
其中layout_cnv是一个画布。我也使用AlivePDF.swc lbrary。 在服务器PHP文件是create.php
<?php
$method = $_GET['method'];
$name = $_GET['name'];
if (isset ($GLOBALS["HTTP_RAW_POST_DATA"])) {
// get bytearray
$pdf = $GLOBALS["HTTP_RAW_POST_DATA"];
// add headers for download dialog-box
header('Content-Type: application/pdf');
header('Content-Length: '.strlen($pdf));
header('Content-disposition:'.$method.'; filename="'.$name.'"');
echo $pdf;
} else echo 'An error occured.';
?>
有人可以帮我请。
有人请帮助。 – 2009-07-08 14:21:21
我很困惑。客户端是flex,服务器端是php。谁需要保存PDF,客户端或服务器? – 2009-07-08 15:58:06