J'utilise PDFiumViewer winform control pour afficher pdfs. Et, j'ai ajouté quelques annotations au pdf, mais ceux-ci n'apparaissent pas dans le pdfviewer control.So, comment peut réaliser ceci?Comment afficher les annotations dans un fichier pdf en utilisant pdfium viewer?
0
A
Répondre
0
j'ai pu résoudre le problème en utilisant le code suivant:
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);
2
Dans PDFium, il existe un indicateur FPDF_ANNOT qui peut être transmis aux différentes méthodes FPDF_RenderPage *. Il est possible que le code PDFiumViewer fournisse le même drapeau quelque part.