iText - 如何在pdf中下移当前内容 [英] iText - how to move down the current contents in a pdf

查看:562
本文介绍了iText - 如何在pdf中下移当前内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要求在现有PDF的顶部添加几行。
我使用PdfReader和PdfStamper完成了这项工作。
为了在页眉区域中有更多空间,我需要将当前内容向下移动1或2行。
以下是来自论坛。但它没有解决问题。
如何使用IText在PDF的页面中间插入内容

I have a requirement to add few lines at the top of an existing PDF. I have done this using a PdfReader and a PdfStamper. In order to have more space in the page header area, i need to move down the current contents by 1 or 2 lines. Below is from the forum. but it doesn't solve the issue. How to insert content in the middle of a page in a PDF using IText

有任何建议吗?

-i无法上传pdf或pdf的图像,因为我是新用户

推荐答案

如果我认为你真的想要移动页面上的所有内容并在上面添加一些行,我能正确解释你的问题吗?

Do I interpret your question correctly if I assume that you really want to move down everything on the page and add some lines above?

你可以通过更改媒体框(以及裁剪框以及可能为您的页面明确定义的其他框),然后以与现在相同的方式添加几行。

You can do that by changing the media box (and crop box and what other boxes might be explicitly defined for your page) and then add the few lines on top the same way you already do it now.

您可以访问相应页面字典中的那些框,您可以通过PdfReader检索这些框。查看PDF规范以获取有关这些框的详细信息。

You can access those boxes in the respective page dictionary which you can retrieve via the PdfReader. Look up the PDF specification for details on those boxes.

或者我是否错误地解释了您并且您只想在保留现有页眉和页脚的同时向下移动一些文本?在这种情况下,亚历克西斯对你提到的另一个问题的回答仍然有效。

Or do I interpret you incorrectly and you only want to move down some text while keeping existing headers and footers in place? In that case Alexis' answer to the other question you refer to still holds.

这篇关于iText - 如何在pdf中下移当前内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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