C# 如何使用pdfium查看器在pdf中显示批注?

C# 如何使用pdfium查看器在pdf中显示批注?,c#,winforms,pdf,pdf-annotations,pdfium,C#,Winforms,Pdf,Pdf Annotations,Pdfium,我正在使用PDfiumViewer winform控件显示PDF。而且,我已经在pdf中添加了一些注释,但是这些注释没有显示在pdfviewer控件中。那么,如何实现这一点呢?在PDFium中,有一个FPDF_ANNOT标志,可以传递给各种FPDF_RenderPage*方法。PDFiumViewer代码可能在某个地方提供了相同的标志。在PDFium中,有一个FPDF_ANNOT标志可以传递给各种FPDF_RenderPage*方法。PDFiumViewer代码可能在某个地方提供了相同的标志。我

我正在使用PDfiumViewer winform控件显示PDF。而且,我已经在pdf中添加了一些注释,但是这些注释没有显示在pdfviewer控件中。那么,如何实现这一点呢?

在PDFium中,有一个FPDF_ANNOT标志,可以传递给各种FPDF_RenderPage*方法。PDFiumViewer代码可能在某个地方提供了相同的标志。

在PDFium中,有一个FPDF_ANNOT标志可以传递给各种FPDF_RenderPage*方法。PDFiumViewer代码可能在某个地方提供了相同的标志。

我能够使用以下代码解决此问题:

doc = PDDocument.load(FilePath);
PDPage page = (PDPage)doc.getDocumentCatalog().getAllPages().get(pageNum);
int rotPD = page.findRotation();
PDRectangle pageBound = page.findCropBox();
PDRectangle rect = ModifyRectAccordingToRotation(rectangle, rotPD, pageBound);
PDAnnotationLink txtLink = new PDAnnotationLink();
    PDBorderStyleDictionary borderULine = new PDBorderStyleDictionary();
                    borderULine.setStyle(PDBorderStyleDictionary.STYLE_UNDERLINE);
borderULine.setWidth(0);
txtLink.setBorderStyle(borderULine);
PDActionRemoteGoTo remoteGoto = new PDActionRemoteGoTo();
PDComplexFileSpecification fileDesc = new PDComplexFileSpecification();
fileDesc.setFile(System.IO.Path.GetFileName(path));
remoteGoto.setOpenInNewWindow(true);
remoteGoto.setFile(fileDesc);
txtLink.setAction(remoteGoto);
txtLink.setRectangle(rect);
page.getAnnotations().add(txtLink);

我能够使用以下代码解决此问题:

doc = PDDocument.load(FilePath);
PDPage page = (PDPage)doc.getDocumentCatalog().getAllPages().get(pageNum);
int rotPD = page.findRotation();
PDRectangle pageBound = page.findCropBox();
PDRectangle rect = ModifyRectAccordingToRotation(rectangle, rotPD, pageBound);
PDAnnotationLink txtLink = new PDAnnotationLink();
    PDBorderStyleDictionary borderULine = new PDBorderStyleDictionary();
                    borderULine.setStyle(PDBorderStyleDictionary.STYLE_UNDERLINE);
borderULine.setWidth(0);
txtLink.setBorderStyle(borderULine);
PDActionRemoteGoTo remoteGoto = new PDActionRemoteGoTo();
PDComplexFileSpecification fileDesc = new PDComplexFileSpecification();
fileDesc.setFile(System.IO.Path.GetFileName(path));
remoteGoto.setOpenInNewWindow(true);
remoteGoto.setFile(fileDesc);
txtLink.setAction(remoteGoto);
txtLink.setRectangle(rect);
page.getAnnotations().add(txtLink);