2017-02-09 22 views

ответ

0

я был в состоянии решить эту проблему, используя следующий код:

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

В PDFium имеется флаг FPDF_ANNOT, который может быть передан различным методам FPDF_RenderPage *. Возможно, код PDFiumViewer имеет тот же флаг.