2011-04-21 39 views
0

我在html頁面中有一個大約10列的表,當我轉換爲pdf時,最後一個colums被截斷。如何解決這個問題。有沒有PDF格式的選項?將html轉換爲pdf,調整寬度

幹活的笨:使用DOMPDF轉換器

$this->load->plugin('to_pdf'); 
$this->load->helper('file'); 
$html  = $this->load->view('export_pdf'), $data, TRUE); 
      pdf_create($html, $this->session->userdata('site_id'),TRUE); 
       } 

我也用pdf_create($html, $this->session->userdata('site_id'),TRUE,$papersize = 'a3', $orientation = 'landscape');但如果紙張大小和方向我給結果issame什麼

+3

轉換如何?使用什麼工具? – 2011-04-21 09:28:06

+0

使用插件:'to_pdf' – aparna 2011-04-21 09:33:20

+1

啊,好的。如果您將鏈接添加到確切版本 – 2011-04-21 09:33:20

回答

0

使用

pdf_create($html, $this->session->userdata('site_id'),TRUE, 'a3', 'landscape'); 
1

如果您正在使用codeigniter,使用dompdf助手,您可以在助手/ dompdf_helper.php中使用此修改

<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); 
function pdf_create($html, $filename, $stream=TRUE) 
{ 
    require_once("dompdf/dompdf_config.inc.php"); 

    $dompdf = new DOMPDF(); 
    $dompdf->load_html($html); 
    $dompdf->set_paper("a4"); 
    $dompdf->render(); 
    $dompdf->stream($filename . ".pdf"); 
} 

function pdf_create_params($html, $filename, $stream=TRUE, $paper = 'a4', $orientation = "portrait") 
{ 
    require_once("dompdf/dompdf_config.inc.php"); 

    $dompdf = new DOMPDF(); 
    $dompdf->load_html($html); 
    $dompdf->set_paper($paper, $orientation); 
    $dompdf->render(); 
    $dompdf->stream($filename . ".pdf"); 
} 

?> 

改爲調用pdf_create調用pdf_create_params並使用所需的參數。默認情況下,它有A4和肖像。

0

我有類似的問題。我沒使用後調整我的列寬:

$htmlToPdf->WriteHTML($this->view->render($fileRender)); 

爲了解決這個問題,只是採用的風格屬性,您TD過,在你的視圖文件

<td style:"width:10%;"> </td>