在iTextSharp中旋转PDF 90度

时间:2018-02-15 22:05:16

标签: c# pdf itext

我试图找出如何在iTextSharp中将PDF旋转90度,但我能找到的是如何将其旋转180度,如下所示:

PdfContentByte pcb = writer.DirectContentUnder;
int page_count = pdf_reader.NumberOfPages;
for (int z = 1; z <= page_count; z++)
{
    PdfImportedPage pdf_page = writer.GetImportedPage(pdf_reader, z);
    double pdfWidth = pdf_page.Width;
    double pdfHeight = pdf_page.Height;

    if (pdfWidth > pageWidth)
    {
        pcb.AddTemplate(pdf_page, -1f, 0, 0, -1f, pdfWidth, pdfHeight);
    }

    [...]
}

最后的pcb.AddTemplate行是旋转发生的地方。我尝试过更改参数,但我所能做的就是将pdf页面缩小一半,或者完全消失。

我没时间让这个得到解决;任何援助都会得到很大的帮助。

0 个答案:

没有答案