如何将源PDF嵌入PDF中的现有页面? [英] How do I embed a source PDF onto an existing page in a PDF?

查看:172
本文介绍了如何将源PDF嵌入PDF中的现有页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要以编程方式将现有PDF(小图形)嵌入到现有PDF的特定页面上。使用iTextSharp我已经能够添加包含此嵌入式PDF的新页面,但需要通过添加此图形来修改现有页面。这可能是使用iTextSharp或任何其他PDF生成的图书馆吗?

I need to programmatically embed an existing PDF (a small graphic) onto a specfic page on an existing PDF. Using iTextSharp I've been able to add a new page containing this embedded PDF, but what need is to modify an existing page by adding this graphic. Is this possible using iTextSharp or any other PDF-generation libarary?

推荐答案

我倾向于使用上下文,这是一个基于Tex的布局工具,集成到pdftex Tex / Metapost引擎中。这涉及到一个学习曲线,并且安装Context并不是完全无关紧要的,但是一旦你掌握了它,它就会使涉及PDF的非常一般的程序化文档处理变得容易。

I tend to do this sort of thing using Context, which is a Tex-based layout tool that in integrated into the pdftex Tex/Metapost engine. There's a learning curve involved, and installing Context isn't entirely trivial, but it makes very general programmatic document processing involving PDFs easy once you get the hang of it.

对于这个问题,你要定义两个叠加层,第一个叠加层是你设置为背景的主PDF,然后是你要改变的页面,使用 \setlayer 命令定义前景叠加层,该命令包含一个 \framed 框,其中叠加了第二个PDF使用 \ externalfigure 命令。

For this problem, you'd define two overlays, with the first overlay being the main PDF that you set to a background, and then on the page you want to change, defining a foreground overlay with a \setlayer command, which contains a single \framed box, which superimposes the second PDF using a \externalfigure command.

这种任务的关于Context的好处是它使用PDF作为其内部表示,所以文件大小没有意外爆炸或图像质量下降,您可以使用其他格式之间转换的工具。

The nice thing about Context for this kind of task is that it works with PDF as its internal representation all the way through, so there is no unexpected blow up in file size or deterioration in image quality, which you can get with other tools that convert between formats.

这篇关于如何将源PDF嵌入PDF中的现有页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆