[英]Java Editing PDFs
Is there a way to draw lines on a graph for an existing PDF? 有没有办法在现有PDF的图形上画线? I have a custom graph that I need to plot the lines for and I wanted to see if there was anyway to do it with itext or any other open source PDF software.
我有一个需要绘制线条的自定义图形,我想看看是否可以使用itext或任何其他开源PDF软件来进行绘制。 Thank you for your consideration of this matter.
感谢您对此事的考虑。
First take a look at the StampText example. 首先看一下StampText示例。 It shows you how to create a
PdfStamper
and how to obtain a PdfContentByte
object. 它显示了如何创建
PdfStamper
以及如何获取PdfContentByte
对象。 In this example, we stamp text on the existing PDF. 在此示例中,我们在现有PDF上标记文本。
You want to draw lines, which also requires a PdfContentByte
because that class has an abundance of methods to draw paths and shapes. 您想要绘制线条,这也需要一个
PdfContentByte
因为该类有很多绘制路径和形状的方法。 These methods are all explained in chapter 14 of my book . 这些方法都在我的书的第14章中进行了说明。 See for instance paths.pdf and the code that was used to draw these paths, PathConstructionAndPainting .
例如,请参阅path.pdf以及用于绘制这些路径的代码PathConstructionAndPainting 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.