使用ZendPDF将PDF文件粘贴到另一个PDF中

时间:2014-04-07 12:34:58

标签: php pdf zend-pdf

是否可以将PDF文件“合并”或“粘贴”为另一种PDF?或者它必须是图像呢?

我想要粘贴或合并的PDF是一个简单的图片,它将出现在完成的PDF的底部:

//Generate the "Original" PDF here..

function addReklam($reklamblad) //The PDF that should be merged into the PDF that is created above
    {

     //Count how many pages that has been created, and add it at the bottom of the PDF:

        if($this->drawed_lines<52)
        {
            $this->active_page = $this->pdf->pages[2];
        }
        elseif($this->drawed_lines<92)
        {
            $this->active_page = $this->pdf->pages[3];
        }
        elseif($this->drawed_lines<132)
        {
            $this->active_page = $this->pdf->pages[4];
        }
        else
        {
            $this->active_page = $this->pdf->pages[5];
        }
        //$this->active_page = $this->pdf->pages[5];        // page 5 is the last
           //Add it here???         

    }

1 个答案:

答案 0 :(得分:0)

我的建议是使用Zend_Pdf::load()方法将“原始”PDF文件加载到Zend_Pdf的本地实例中,然后您可以使用pages[]数组访问这些页面在您的示例代码中,使用所有标准函数(如drawImage()等)在保存更新版本之前进行必要的修改。