0
我们有一个文档在其布局部分作为singel pdf文件进行切割: 例如标题 - > headline.pdf,段落 - > paragraph01.pdf等 为了达到我们使用坐标来了解这些零件的放置位置。 (源文件来自OCR工具,保存这些坐标)PDFLib:提取部分导入页面
我们的问题是:切割件是原始文档的简单副本,但带有蒙版内容,文档边界排列为只留下期望的部分可见。 所以生成的文档都是相同的文件大小。 我们如何强制PDFLib去掉不需要的部分?我希望有一个解决方案。我们尝试了很多trimboxes,cropboxes等的组合,但没有结果。
这里是我们使用的代码:
$fWidth = 200;//width of document part
$fHeight = 20;//height of document part
$fMinXPoint = 10;//left coordinate x
$fMinYPoint = 10;//left coordinate y
$oPdf = new \PDFLib();
$oPdf->begin_document('', 'optimize=true linearize=true inmemory=true');
$oPdf->set_option('compress=9');
$oPdf->set_option('topdown=true');
$oLoadedDocument = $oPdf->open_pdi_document($sRealFilePath, '');// original pdf
$oPage = $oPdf->open_pdi_page(
$oLoadedDocument,
1,
'clippingarea=crop'
);
$oPdf->begin_page_ext($fWidth, $fHeight, '');
$oPdf->fit_pdi_page($oPage, -$fMinXPoint, -$fMinYPoint, 'position={left top}');
$oPdf->end_page_ext("cropbox={0 0 $fWidth $fHeight}");
$oPdf->close_pdi_page($oPage);
$oPdf->close_pdi_document($oLoadedDocument);
$oPdf->end_document('');
谢谢。所以我们必须搜索另一个没有PDFLib的解决方案。你知道一个图书馆,可以实现这一目标吗? – Jensman 2014-09-23 14:46:53