简体   繁体   English

如何在itextsharp中将自定义页面大小打印为纵向

[英]How to print custom page size as portrait in itextsharp

Below is my code to create custom page size in ItextSharp. 下面是我在ItextSharp中创建自定义页面大小的代码。 Page is now printing in landscape mode. 页面现在以横向模式打印。 I want print in Portrait. 我想在Portrait中打印。

document = new Document(new iTextSharp.text.Rectangle(410f, 288f));

Replace: 更换:

document = new Document(new iTextSharp.text.Rectangle(410f, 288f));

With: 附:

document = new Document(new iTextSharp.text.Rectangle(410f, 288f).Rotate());

And the custom page will be rotated by 90 degrees, if that's what you want. 并且自定义页面将旋转90度,如果这是您想要的。

  Document document = new Document(default(iTextSharp.text.Rectangle));
  document.SetPageSize(new iTextSharp.text.Rectangle(410f, 288f).Rotate());

please try this. 请试试这个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM