如何使用 pdfium 查看器在 pdf 中显示注释?

How to show annotations in a pdf using pdfium viewer?

我正在使用 PDfiumViewer winform 控件来显示 pdf。而且,我在 pdf 中添加了一些注释,但这些注释没有显示在 pdfviewer 中 control.So,如何实现?

在 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);

在 PdfDocument.cs class 下的 'public Image Render' 方法中使用下面的代码