2012-01-13 81 views
0

我想知道它是一個錯誤,還是我做錯了什麼。在我向作者報告之前,有人可以確認嗎?TCPDF ImageSVG圖片旋轉

的SVG(file.svg):

<svg style="overflow: hidden; position: relative;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1226" version="1.1" height="826"><image transform="matrix(1.0364,-0.3305,0.3305,1.0364,-41.846,108.0143)" preserveAspectRatio="none" x="10" y="10" width="205" height="154" xlink:href="wallpaper.jpg" opacity="1" stroke-width="1"></image><rect transform="matrix(1.0364,-0.3305,0.3305,1.0364,-41.846,108.0143)" x="165" y="114" width="50" height="50" r="0" rx="0" ry="0" fill="#C0C0C0" stroke="#000" opacity="0" stroke-width="1"></rect><image transform="matrix(1.1575,0.2385,-0.2385,1.1575,-442.1395,-145.4163)" preserveAspectRatio="none" x="500" y="10" width="205" height="154" xlink:href="wallpaper.jpg" opacity="1" stroke-width="1"></image><rect transform="matrix(1.1575,0.2385,-0.2385,1.1575,-442.1395,-145.4163)" x="655" y="114" width="50" height="50" r="0" rx="0" ry="0" fill="#C0C0C0" stroke="#000" opacity="0" stroke-width="1"></rect></svg> 

PHP代碼:

require_once('../config/lang/eng.php'); 
require_once('../tcpdf.php'); 

$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); 
$pdf->setPrintHeader(false); 
$pdf->setPrintFooter(false); 
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); 
$pdf->setLanguageArray($l); 
$pdf->AddPage(); 
$pdf->ImageSVG($file='file.svg', $x=15, $y=30, $w='', $h='', $link='', $align='', $palign='', $border=0, $fitonpage=false); 
$pdf->Output('sample.pdf', 'F'); 

SVG文件看起來很好的瀏覽器,但在thefinished PDF圖像雙方都有問題:他們看像鋸:

http://img215.imageshack.us/img215/816/pdfproof.jpg

+0

什麼是PDF_IMAGE_SCALE_RATIO。當你增加它會發生什麼?我相信有一個setImageScale,你可以嘗試改變,例如PDF-> setImageScale(1.53); – 2012-01-13 10:51:25

+0

不幸的是,它與問題無關.TCPDF :: setImageScale($ scale)\t 設置調整因子以將像素轉換爲用戶單位。 =它使圖片變大/變小 – user1140774 2012-01-13 14:54:27

+0

這絕對是TCPDF問題嗎?您可以使用InDesign或Illustrator生成類似的PDF並查看它是否顯示相同?我沒有使用過TCPDF,但是從我的經驗來看,舊版本的PDF規範沒有或者很差的抗鋸齒(這是去除鋸齒邊緣的效果)。檢查您的Acrobat視圖設置,或嘗試保存爲更新版本的PDF(如果它是較舊的格式)。 – 2013-02-09 20:50:50

回答

0
$pdf->ImageSVG($file='file.svg', $x=15, $y=30, $w='', $h='', $link='', $align='', $palign='', $border=0, $fitonpage=false); 

我覺得上述行,你有錯誤的$file='file.svg'通常需要打開該文件,並將其存儲在變量並使用以下格式解析變量:

$pdf->ImageSVG('@'. $svgString1, $x=15, $y=$line, $w='', $h='', $link='', $align='center', $palign='', $border=0, $fitonpage=true); 

其中$svgString1是我的SVG圖像從HTML的帖子