2013-12-12 50 views
0

我使用Zend_PDF的drawImage以pdf形式绘制图像。我检查图像的纵横比,因为它们是水平或垂直的。然后将它们绘制到我的PDF中。所有的水平图像效果很好。所有垂直图像变黑,但有些不完全。这似乎是颜色倒置。您仍然可以看到图像的某些部分。 jpeg对我来说都很好看。Zend_PDF drawImage将图像变成黑色

$page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4); 

$orientation = $this->checkAspect($imageFullPath); 
$image = Zend_Pdf_Image::imageWithPath($imageFullPath); 

if($orientation == 'vertical') { 
    $imgWidth = 475; 
    $imgHeight = 672; // DINA4 shrinked to 475 width 
    $x = 68; // margin left 
    $y = 130; // start bottom 
    $page->drawImage($image, $x, $y, $x + $imgWidth, $y + $imgHeight); 
} else { 
    $imgWidth = 500; 
    $imgHeight = 330; 
    $x = 68; // margin left 
    $y = 450; // start bottom 
    $page->drawImage($image, $x, $y, $x + $imgWidth, $y + $imgHeight); 
} 

我只是不明白我在做什么错?

问候

回答

0

其实答案很简单。它与垂直或水平的图像无关,而与色彩空间相关。由于某些原因,垂直图像全部在CMYK和水平图像RGB中。

转换所有图像,现在一切都很好。