PDF使用分页First, Next, Previous, Last的元数据视图



我创建了一个类,用于从PDF文件读取元数据到单独表单(InfoForm1)上的文本框

private void Info_Click(object sender, EventArgs e)
{
PdfInformation info = pdfViewer1.Document.GetInformation();
StringBuilder sz = new StringBuilder();
sz.AppendLine($"Title:tt {info.Title}");
sz.AppendLine($"Subject:tt {info.Subject}");
sz.AppendLine($"Author:tt {info.Author}");
InfoForm1_Link.Show();
InfoForm1_Link.InfoText = sz.ToString();
}

现在我正试图实现分页按钮(第一,下一步,上一个,最后一个)来查看文件夹中的其他文件。到目前为止,我只创建了这些方法。

我搜索了关于分页系统的答案,但是没有与这个案例相关的答案。知道怎么做吗?谢谢你

InfoForm1_Link.ButtonInfoFormClickedFirst += (s, eF) =>
{
};
InfoForm1_Link.ButtonInfoFormClickedPrevious += (s, eP) =>
{
};
InfoForm1_Link.ButtonInfoFormClickedNext += (s, eN) =>
{
};
InfoForm1_Link.ButtonInfoFormClickedLast += (s, eL) =>
{
};

经过大量的研究和试验错误,this works:

InfoForm1_Link.ButtonInfoFormClickedFirst += (s, eF) =>
{
if (pFileNames.Length > 0)
{
i = 0;
pdfViewer1.Document = OpenDocument(pFileNames[i]);
txtInputFileT.Text = (pFileNames[i]);
PdfInformation infoVar = pdfViewer1.Document.GetInformation();
StringBuilder szVar = new StringBuilder();
szVar.AppendLine($"Title:tt {info.Title}");
szVar.AppendLine($"Subject:tt {info.Subject}");
szVar.AppendLine($"Author:tt {info.Author}");
InfoForm1_Link.InfoText = szVar.ToString();
}
};

最新更新