Removed spurious final blank page from PDF Writer output
git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@91328 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
parent
0502d215d0
commit
4fa6c2ceaf
|
@ -630,7 +630,9 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
||||||
|
|
||||||
// table { }
|
// table { }
|
||||||
$css['table']['border-collapse'] = 'collapse';
|
$css['table']['border-collapse'] = 'collapse';
|
||||||
|
if (!$this->_isPdf) {
|
||||||
$css['table']['page-break-after'] = 'always';
|
$css['table']['page-break-after'] = 'always';
|
||||||
|
}
|
||||||
|
|
||||||
// .gridlines td { }
|
// .gridlines td { }
|
||||||
$css['.gridlines td']['border'] = '1px dotted black';
|
$css['.gridlines td']['border'] = '1px dotted black';
|
||||||
|
@ -916,6 +918,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
||||||
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn()) - 1;
|
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn()) - 1;
|
||||||
$i = -1;
|
$i = -1;
|
||||||
while($i++ < $highestColumnIndex) {
|
while($i++ < $highestColumnIndex) {
|
||||||
|
if (!$this->_isPdf) {
|
||||||
if (!$this->_useInlineCss) {
|
if (!$this->_useInlineCss) {
|
||||||
$html .= ' <col class="col' . $i . '">' . PHP_EOL;
|
$html .= ' <col class="col' . $i . '">' . PHP_EOL;
|
||||||
} else {
|
} else {
|
||||||
|
@ -924,6 +927,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
||||||
$html .= ' <col style="' . $style . '">' . PHP_EOL;
|
$html .= ' <col style="' . $style . '">' . PHP_EOL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
return $html;
|
return $html;
|
||||||
|
|
|
@ -67,17 +67,9 @@ class PHPExcel_Writer_PDF_DomPDF extends PHPExcel_Writer_PDF_Core implements PHP
|
||||||
|
|
||||||
// Set PDF
|
// Set PDF
|
||||||
$this->_isPdf = true;
|
$this->_isPdf = true;
|
||||||
|
|
||||||
// Build CSS
|
// Build CSS
|
||||||
$this->buildCSS(true);
|
$this->buildCSS(true);
|
||||||
|
|
||||||
// Generate HTML
|
|
||||||
$html = '';
|
|
||||||
$html .= $this->generateHTMLHeader(false);
|
|
||||||
$html .= $this->generateSheetData();
|
|
||||||
$html .= $this->generateHTMLFooter();
|
|
||||||
|
|
||||||
|
|
||||||
// Default PDF paper size
|
// Default PDF paper size
|
||||||
$paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.)
|
$paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.)
|
||||||
|
|
||||||
|
@ -102,26 +94,19 @@ class PHPExcel_Writer_PDF_DomPDF extends PHPExcel_Writer_PDF_Core implements PHP
|
||||||
$printPaperSize = $this->getPaperSize();
|
$printPaperSize = $this->getPaperSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isset(self::$_paperSizes[$printPaperSize])) {
|
if (isset(self::$_paperSizes[$printPaperSize])) {
|
||||||
$paperSize = self::$_paperSizes[$printPaperSize];
|
$paperSize = self::$_paperSizes[$printPaperSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Create PDF
|
// Create PDF
|
||||||
$pdf = new DOMPDF();
|
$pdf = new DOMPDF();
|
||||||
$pdf->set_paper(strtolower($paperSize), strtolower($orientation));
|
$pdf->set_paper(strtolower($paperSize), strtolower($orientation));
|
||||||
|
|
||||||
// Document info
|
$pdf->load_html(
|
||||||
// $pdf->SetTitle($this->_phpExcel->getProperties()->getTitle());
|
$this->generateHTMLHeader(false) .
|
||||||
// $pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator());
|
$this->generateSheetData() .
|
||||||
// $pdf->SetSubject($this->_phpExcel->getProperties()->getSubject());
|
$this->generateHTMLFooter()
|
||||||
// $pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords());
|
);
|
||||||
// $pdf->SetCreator($this->_phpExcel->getProperties()->getCreator());
|
|
||||||
|
|
||||||
// echo '<hr />',htmlentities($html),'<hr />';
|
|
||||||
|
|
||||||
$pdf->load_html($html);
|
|
||||||
$pdf->render();
|
$pdf->render();
|
||||||
|
|
||||||
// Write to file
|
// Write to file
|
||||||
|
|
|
@ -67,17 +67,9 @@ class PHPExcel_Writer_PDF_mPDF extends PHPExcel_Writer_PDF_Core implements PHPEx
|
||||||
|
|
||||||
// Set PDF
|
// Set PDF
|
||||||
$this->_isPdf = true;
|
$this->_isPdf = true;
|
||||||
|
|
||||||
// Build CSS
|
// Build CSS
|
||||||
$this->buildCSS(true);
|
$this->buildCSS(true);
|
||||||
|
|
||||||
// Generate HTML
|
|
||||||
$html = '';
|
|
||||||
$html .= $this->generateHTMLHeader(false);
|
|
||||||
$html .= $this->generateSheetData();
|
|
||||||
$html .= $this->generateHTMLFooter();
|
|
||||||
|
|
||||||
|
|
||||||
// Default PDF paper size
|
// Default PDF paper size
|
||||||
$paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.)
|
$paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.)
|
||||||
|
|
||||||
|
@ -91,6 +83,7 @@ class PHPExcel_Writer_PDF_mPDF extends PHPExcel_Writer_PDF_Core implements PHPEx
|
||||||
$printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
|
$printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
|
||||||
$printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
|
$printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
|
||||||
}
|
}
|
||||||
|
$this->setOrientation($orientation);
|
||||||
|
|
||||||
// Override Page Orientation
|
// Override Page Orientation
|
||||||
if (!is_null($this->getOrientation())) {
|
if (!is_null($this->getOrientation())) {
|
||||||
|
@ -102,12 +95,10 @@ class PHPExcel_Writer_PDF_mPDF extends PHPExcel_Writer_PDF_Core implements PHPEx
|
||||||
$printPaperSize = $this->getPaperSize();
|
$printPaperSize = $this->getPaperSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isset(self::$_paperSizes[$printPaperSize])) {
|
if (isset(self::$_paperSizes[$printPaperSize])) {
|
||||||
$paperSize = self::$_paperSizes[$printPaperSize];
|
$paperSize = self::$_paperSizes[$printPaperSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Create PDF
|
// Create PDF
|
||||||
$pdf = new mpdf();
|
$pdf = new mpdf();
|
||||||
$pdf->_setPageSize(strtoupper($paperSize), strtolower($orientation));
|
$pdf->_setPageSize(strtoupper($paperSize), strtolower($orientation));
|
||||||
|
@ -119,9 +110,11 @@ class PHPExcel_Writer_PDF_mPDF extends PHPExcel_Writer_PDF_Core implements PHPEx
|
||||||
$pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords());
|
$pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords());
|
||||||
$pdf->SetCreator($this->_phpExcel->getProperties()->getCreator());
|
$pdf->SetCreator($this->_phpExcel->getProperties()->getCreator());
|
||||||
|
|
||||||
// echo '<hr />',htmlentities($html),'<hr />';
|
$pdf->WriteHTML(
|
||||||
|
$this->generateHTMLHeader(false) .
|
||||||
$pdf->WriteHTML($html);
|
$this->generateSheetData() .
|
||||||
|
$this->generateHTMLFooter()
|
||||||
|
);
|
||||||
|
|
||||||
// Write to file
|
// Write to file
|
||||||
fwrite($fileHandle, $pdf->Output('','S'));
|
fwrite($fileHandle, $pdf->Output('','S'));
|
||||||
|
|
|
@ -68,16 +68,9 @@ class PHPExcel_Writer_PDF_tcPDF extends PHPExcel_Writer_PDF_Core implements PHPE
|
||||||
|
|
||||||
// Set PDF
|
// Set PDF
|
||||||
$this->_isPdf = true;
|
$this->_isPdf = true;
|
||||||
|
|
||||||
// Build CSS
|
// Build CSS
|
||||||
$this->buildCSS(true);
|
$this->buildCSS(true);
|
||||||
|
|
||||||
// Generate HTML
|
|
||||||
$html = '';
|
|
||||||
//$html .= $this->generateHTMLHeader(false);
|
|
||||||
$html .= $this->generateSheetData();
|
|
||||||
//$html .= $this->generateHTMLFooter();
|
|
||||||
|
|
||||||
// Default PDF paper size
|
// Default PDF paper size
|
||||||
$paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.)
|
$paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.)
|
||||||
|
|
||||||
|
@ -94,7 +87,8 @@ class PHPExcel_Writer_PDF_tcPDF extends PHPExcel_Writer_PDF_Core implements PHPE
|
||||||
|
|
||||||
// Override Page Orientation
|
// Override Page Orientation
|
||||||
if (!is_null($this->getOrientation())) {
|
if (!is_null($this->getOrientation())) {
|
||||||
$orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
|
$orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ?
|
||||||
|
'L' : 'P';
|
||||||
}
|
}
|
||||||
// Override Paper Size
|
// Override Paper Size
|
||||||
if (!is_null($this->getPaperSize())) {
|
if (!is_null($this->getPaperSize())) {
|
||||||
|
@ -123,7 +117,11 @@ class PHPExcel_Writer_PDF_tcPDF extends PHPExcel_Writer_PDF_Core implements PHPE
|
||||||
|
|
||||||
// Set the appropriate font
|
// Set the appropriate font
|
||||||
$pdf->SetFont($this->getFont());
|
$pdf->SetFont($this->getFont());
|
||||||
$pdf->writeHTML($html);
|
$pdf->writeHTML(
|
||||||
|
$this->generateHTMLHeader(false) .
|
||||||
|
$this->generateSheetData() .
|
||||||
|
$this->generateHTMLFooter()
|
||||||
|
);
|
||||||
|
|
||||||
// Document info
|
// Document info
|
||||||
$pdf->SetTitle($this->_phpExcel->getProperties()->getTitle());
|
$pdf->SetTitle($this->_phpExcel->getProperties()->getTitle());
|
||||||
|
|
Loading…
Reference in New Issue