【发布时间】:2015-03-01 22:46:35
【问题描述】:
旋转到纵向视图后,如何确保所有内容都可见(在页面范围内)?
PDFsharp 在旋转 +90 度时截断我的页面,但在旋转 -90 度时不会截断。
PdfDocument outputDocument = new PdfDocument();
XPdfForm old = XPdfForm.FromFile(in_filename);
PdfPage newP = outputDocument.AddPage();
if (old.Page.Orientation == PageOrientation.Landscape)
{
old.Page.Rotate= (old.Page.Rotate - 90) % 360;
old.Page.Orientation = PageOrientation.Portrait;
}
newP.Height = old.Page.Height;
newP.Width = old.Page.Width;
// Get a graphics object for page1
XGraphics gfx = XGraphics.FromPdfPage(newP);
// Draw the page identified by the page number like an image
gfx.DrawImage(old, new XRect(0, 0, old.PointWidth, old.PointHeight));
以上适用于一些 pdf 测试用例,但我怀疑这是巧合/运气
我正在使用 PDFsharp 1.50 测试版。
【问题讨论】:
标签: c# pdf rotation pdfsharp portrait