2017-02-09 2 views

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.