我使用 PDF 生成 PDF,然后将其保存到服务器,如下所示:
$fp = fopen( '$createdId.'.pdf', 'wb' );
fwrite( $fp, $pdf->Output('example_009.pdf', 'S'));
fclose( $fp );
用户将在我们的网站上设计一些东西,然后转到调用上述代码的 php 页面,然后我希望他们重定向到购物车,以便他们可以结帐。
使用
jQuery(document).ready(function() {redirect() })
在重定向之前似乎没有等待 PDF 完全完成。我尝试将大图像嵌入到 pdf 中进行测试...我还尝试直接离开页面以确保输出和保存实际上不会在离开页面后发生在幕后。
在完全创建 PDF 并保存到服务器之前,我应该如何确保页面不会被重定向?
谢谢,
乔
我在下面所做的概述 - 例如构建 pdf obj,输出 pdf obj 然后希望在 pdf 完成后重定向页面
// 初始化 PDF OBJ $pdf2 = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// 设置默认值 setPDFDefaults($pdf2,$pl,$resolution);
// ADD BG addBackground($pdf2,$templated,$bannerInfo['backgroundColour'],$marginTop,$bleedTop,$bleedBottom,$bleedLeft,$bleedRight, $bannerWidth, $bannerHeight,$this);
// 循环图像和文本对象并添加到 PDF OBJ drawObjects($pdf2,$json,$images,$sizeRatio,$countBG,$marginTop,$bleedTop,$margLeft,$this,$debugga);
$fp = fopen( '/homepages/40/d449000017/htdocs/BannerPlanetMagento/js/bannercreator/savedBanners/'.$nSize.'/customer/banner'.$createdId.'.pdf', 'wb' );
fwrite( $fp, $pdf->Output('example_009.pdf', 'S'));
fclose( $fp );
$fpCustomer = fopen( '/homepages/40/d449000017/htdocs/BannerPlanetMagento/js/bannercreator/savedBanners/'.$nSize.'/print/banner'.$createdId.'_print.pdf', 'wb' );
fwrite( $fpCustomer, $pdf2->Output('example_009.pdf', 'S'));
fclose( $fpCustomer );
var target = document.getElementById('loading-spinner'); var spinner = new Spinner(opts).spin(target);
jQuery(文档).ready(函数($) {
// performRedirectAction()
});