iTextSharp的:表中的风景 [英] iTextSharp: table in landscape
本文介绍了iTextSharp的:表中的风景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用iTextSharp的生成一个大的文档。在这份文件中我想的景观某些特定页面。其余全是肖像。有谁知道我能做到这一点?
开始一个新的文件是不是一种选择。
I'm using iTextSharp to generate a large document. In this document I want some specific pages in landscape. All the rest is portrait. Does anyone know how I can do this? Starting a new document is not an option.
谢谢!
推荐答案
您可以设置文件的大小,它会影响到下一个页面。一些片段:
You can set the document size and it will affect the next pages. Some snippets:
某处设置你的文件(你已经知道了):
Set up your document somewhere (you know that already):
var document = new Document();
PdfWriter pdfWriter = PdfWriter.GetInstance(
document, new FileStream(destinationFile, FileMode.Create)
);
pdfWriter.SetFullCompression();
pdfWriter.StrictImageSequence = true;
pdfWriter.SetLinearPageMode();
现在在你的网页环(你可能做到这一点也已经),并决定你想要什么页面大小每页:
Now loop over your pages (you probably do that as well already) and decide what page size you want per page:
for (int pageIndex = 1; pageIndex <= pageCount; pageIndex++) {
// Define the page size here, _before_ you start the page.
// You can easily switch from landscape to portrait to whatever
document.SetPageSize(new Rectangle(600, 800));
if (document.IsOpen()) {
document.NewPage();
} else {
document.Open();
}
}
这篇关于iTextSharp的:表中的风景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文