【问题标题】:How can I stitch two pdf pages together with pdfbox (java)?如何将两个 pdf 页面与 pdfbox (java) 拼接在一起?
【发布时间】:2012-03-20 00:52:55
【问题描述】:

我找不到这样做的方法。我需要的是一页作为背景,另一页作为前景。

【问题讨论】:

  • 定义合并...一个 pdf 在一个文档中跟随另一个?
  • 一页作为背景,另一页作为前景
  • 如果您想要更多示例,请在此处查看我的答案:stackoverflow.com/a/33778107/5576194

标签: java pdf pdf-generation pdfbox


【解决方案1】:

我找到了!

LayerUtility lu = new LayerUtility( doc );
PDXObjectForm form = lu.importPageAsForm( doc2, 0 );
PDPage page = (PDPage) doc.getDocumentCatalog().getAllPages().get( 0 );
lu.wrapInSaveRestore( page );
AffineTransform at = new AffineTransform();
lu.appendFormAsLayer( page, form, at, "new_layer_name" );

【讨论】:

  • 如果您要合并的 PDF 的页面大小不同怎么办?它破坏了输出 - 使用比导入图层更小的基础 PDF 进行测试。需要设置大小或更改我猜测的媒体框/裁剪框值。
猜你喜欢
  • 1970-01-01
  • 2019-09-03
  • 1970-01-01
  • 2013-05-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-06-13
  • 1970-01-01
相关资源
最近更新 更多