weixin_33735077 2014-09-17 16:44 采纳率: 0%
浏览 25

PDF合并成功的Ajax

I'm creating a couple of pdf invoices and want to merge them into one for easier printing after they've been created. I have this jquery code:

        $('#printinvoice').click(function(){
        $.ajax({
            type:"POST",
            url: "../ajaxcalls/print_invoice.php",

            data: {

                Order: itemstotake1

            },
            dataType:"json",
            success: function(data) {

                $.ajax({
                    type: "POST",
                    url: "../ajax/pdf_merger.php",

                    data: {
                        PDFS: data
                    },

                    success: function (data1) {
                        alert(data1);
                        //window.location.assign('../tools/PDFMerger/samplepdfs/TEST2.pdf');
                        $('.group').removeClass('highlight');
                        itemstotake1 = [];
                    }


                });

            }
        });

});

I use PDFMerge, the Files are merged, but there is no response of my second success function. Here's the PHP code (pdf_merger.php)

include '../tools/PDFMerger/PDFMerger.php'; $files = $_POST['PDFS'];

$pdf = new PDFMerger;

$pdf->addPDF('../tools/PDFMerger/samplepdfs/three.pdf', 'all')
->addPDF('../tools/PDFMerger/samplepdfs/three.pdf', 'all')
->addPDF('../tools/PDFMerger/samplepdfs/three.pdf', 'all')
->merge('file', '../tools/PDFMerger/samplepdfs/TEST22.pdf');

When commenting from $pdf->addPDF, the success alert pops-up(and the window.location).

Can someone tell me what I'm doing wrong?

Thank you!

  • 写回答

1条回答 默认 最新

  • Didn"t forge 2014-10-21 22:20
    关注
    $fileArray= $filer;
    
    $datadir = "../dir/";
    $outputName = $datadir."/filename.pdf";
    
    
    $cmd = "gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$outputName ";
    //Add each pdf file to the end of the command
    foreach($filer as $file) {
        $cmd .= $file." ";
    
    }
    $result = shell_exec($cmd);
    
    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测