0

I have implemented functionality to add a relative link into a pdf using the pdfbox library.Below is the code that I am using for adding the link:

 PDAnnotationLink txtLink = new PDAnnotationLink();
 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);

Here is the command entered in the pdf:

14 0 obj
<<
/Type /Filespec
/F (A-201-NORTH & SOUTHSITE ELEVATIONS.pdf)
>>
endobj

The links work in adobe, ios viewer. But does not work in PSPDF. Also, I have file whose link work in PSPDF. But the commands in that file differ slightly from the above.Here is the link command that works in the PSPDF:

113 0 obj
<<
/Type /Filespec
/F (A8.1 - INTERIOR ELEVATION.pdf)
/UF (A8.1 - INTERIOR ELEVATION.pdf)
/Desc()
>>

So, how do I create this command using pdfbox.

V K
  • 1,645
  • 3
  • 26
  • 57
  • This issue has been fixed in PSPDFKit 7.0.3 for iOS. Thanks for reporting! https://pspdfkit.com/changelog/ios/#7.0.3 (#12884). If you have further issues, feel free to ping us on https://pspdfkit.com/support/request/ - your license subscription includes support and the team is happy to help. – steipete Nov 03 '17 at 15:06

1 Answers1

1

To add the /UF entry, use setFileUnicode(String file).

To add the /Desc entry, use setFileDescription(String description).

I'm also including the answer by Rad, which is rather a comment and may be deleted:

If you believe there's an issue in PSPDFKit, please open a support request here. We'd love to help!

Tilman Hausherr
  • 17,731
  • 7
  • 58
  • 97