开发者

Need a .net API to produce PDF with the option of text rotation [closed]

It's diffic开发者_开发技巧ult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

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?


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.)


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.

Image img = Image.getInstance("foo.jpg");
img.setRotationDegrees(45);

Text rotation:

This is found in the book on page 351-352.

PdfContentByte cb = ...;
cb.showTextAligned(PdfContentByte.ALIGN_LEFT, "Some text", e, f, angle);

where e and f are translation values (the coordinates, essentially), and angle is the rotation angle.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜