需要 .net API 来生成带有文本旋转选项的 PDF
我正在从 xml 创建 PDF,我正在寻找一个也允许我旋转文本的 API,是否有适用于 .net 的 API?
I am creating PDFs from xml I am looking for an API which also allows me to rotate text, Is there any API available for .net?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
iText。它是开源的,您甚至可以购买作者写的一本非常好的书。 (是的,它当然支持旋转文本。)
iText. It's Open Source and you can even buy a quite good book on it written by the author. (And yes, of course it supports rotated text.)
假设您要使用库 iTextSharp,如建议的另一个答案(iText 是一个 Java 库;iTextSharp 是它的 .NET 端口),这里有一些示例。这些本质上是 Bruno Lowagie 的书 iText in Action 来自曼宁出版社。
(请注意,这些示例是用 Java 编写的,因为我直接从书中获取它们,但您应该能够轻松地将它们改编为 iTextSharp 库和 C#。)
图像旋转:
这可以在本书第 155 页中找到。
文本旋转:
这可以在书中第 351-352 页找到。
其中
e
和f
是平移值(本质上是坐标),angle
是旋转角度。Assuming that you are going to use the library iTextSharp, as suggested in another answer (iText is a Java library; iTextSharp is a .NET port of it), here's some examples. These are essentially stripped-down versions from Bruno Lowagie's book iText in Action from Manning Publications.
(Note that the examples are written in Java, since I took them straight from the book, but you should be able to easily adapt them to the iTextSharp library and C#.)
Image rotation:
This is found in the book on page 155.
Text rotation:
This is found in the book on page 351-352.
where
e
andf
are translation values (the coordinates, essentially), andangle
is the rotation angle.