2014-04-07 98 views
0

是否可以將PDF文件「合併」或「粘貼」到antother PDF中?或者它必須是一個圖像呢?使用ZendPDF將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???   

    } 

回答

0

我的建議是使用Zend_Pdf::load()方法加載將「原始」PDF文件轉換爲Zend_Pdf的本地實例,然後您可以使用pages[]陣列訪問頁面(如示例代碼中所示),並使用drawImage()等所有標準功能在保存更新版本之前進行所需的修改。

+0

非常感謝 – user500468

相關問題