我在Adobe Illustrator中打开了*.ai文件,并将文件保存为“Illustrator 3”版本,以克服该问题。任何更高版本都会产生你所描述的结果(除了“Illustrator 8”,它给出了我的*.ai文件的黑白版本)。
虽然晚了点,但我也遇到同样的问题。
我的解决办法是将文件导出为PDF格式,在TCPDF/FPDI中重新使用此PDF:
$num_pages = $pdf->setSourceFile(path_to_file);
$template_id = $pdf->importPage(1); //if the grafic is on page 1
$pdf->useTemplate($template_id,$x,$y,$width,$height);
/**
* Embed vector-based Adobe Illustrator (AI) or AI-compatible EPS files.
* NOTE: EPS is not yet fully implemented, use the
* setRasterizeVectorImages() method to enable/disable rasterization of
* vector images using ImageMagick library.
* ...
*/
public function ImageEps(...){/*...*/}
由于未解析prolog,因此正确解释文件会有问题。
Inkscape(0.48.3.1 r9886)使用cairo创建eps,不会出现错误,函数将继续执行。 TCPDF将部分解释eps,但由于它不输出任何内容,因此输出可能被某些错误处理删除。但这只是一个猜测。
我尝试使用inkscape -D --file=filename.eps --export-plain-svg=filename.svg将我的eps文件导出为svg格式,并使用ImageSVG
进行处理,效果更好。请注意:这个函数也没有完全实现,所以我不能保证它会起作用。我只测试了一个相当基本的eps文件。