gpt4 book ai didi

c# - 如何使用 Itextsharp 翻页

转载 作者:行者123 更新时间:2023-12-05 04:40:50 24 4
gpt4 key购买 nike

我找到了一些例子。但是,所有示例都使用 PdfReader。我想使用 PDFWriter

下面是我写的代码。

private void CreatePdf(string strPdfPath)
{
FileStream fs = new FileStream(strPdfPath, FileMode.Create, FileAccess.Write, FileShare.None);
Document document = new Document(PageSize.A4, 45, 45, 80, 80);
PdfWriter writer = PdfWriter.GetInstance(document, fs);
document.Open();
document.AddTitle("This is Title");
document.AddCreationDate();
Paragraph content1 = new Paragraph("This is first Page");
document.Add(content1);

document.NewPage();
Paragraph content2 = new Paragraph("This is second Page");
document.Add(content2);
writer.Close();
fs.Close();
}

如何旋转PDF?

最佳答案

你可以两者兼顾:

 document.open();
// Add some content in portrait
document.setPageSize(PageSize.A4.rotate());
document.newPage();
// Add some content in landscape
document.close();

关于c# - 如何使用 Itextsharp 翻页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70192860/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com