C# 选择.Pdf加载现有.Pdf

C# 选择.Pdf加载现有.Pdf,c#,C#,Select.Pdf for.Net v 2.22的文档使用以下代码段加载现有文档。但是,在实际库中,没有将字符串作为参数的构造函数。有人知道如何加载现有的.pdf文件吗?我也在使用该产品的社区版 string file = Server.MapPath("~/files/doc1.pdf"); // load the pdf document PdfDocument doc = new PdfDocument(file); // add a new page to the document

Select.Pdf for.Net v 2.22的文档使用以下代码段加载现有文档。但是,在实际库中,没有将字符串作为参数的构造函数。有人知道如何加载现有的.pdf文件吗?我也在使用该产品的社区版

string file = Server.MapPath("~/files/doc1.pdf");

// load the pdf document
PdfDocument doc = new PdfDocument(file);

// add a new page to the document
PdfPage page = doc.AddPage();

// create a new pdf font (component standard font)
PdfFont font = doc.AddFont(PdfStandardFont.Helvetica);
font.Size = 20;

// create text element and add it to the new page
PdfTextElement text = new PdfTextElement(100, 100,
    "Sample text added to an existing pdf document.", font);
page.Add(text);

// save pdf document
doc.Save(Response, false, "Sample.pdf");

// close pdf document
doc.Close();

根据Jason的建议,以下是我的评论作为回答:

我已从下载了最新版本(16.2),并且.net 4 DLL确实包含
PdfDocument(字符串文件名)
constructor

我还下载了社区版并检查了相同的
PdfDocument
类。在此版本中,构造函数的重载更少


因此,我猜社区版是一个旧得多的版本,您无法将完整版本示例应用于社区版。

什么是“Select.Pdf”?如果是,则说明存在一个以文件名作为参数的构造函数。我还从他们的网站下载了最新版本(16.2),并且.net 4 DLL也包含此
PdfDocument(字符串文件名)
构造函数。@UweKeim您下载了社区版本吗?我下载了完整版本。社区版的构造函数更少。我猜这是基于一个更老的版本。因此,您可能无法将完整版本的示例应用于Comunity版本。这对我来说已经足够好了。如果你把它作为一个真实的答案,我会把它标记为被接受的答案。