Forum Stats

  • 3,838,514 Users
  • 2,262,378 Discussions
  • 7,900,678 Comments

Discussions

Got stuck at page links in PDF

908059
908059 Member Posts: 50
edited Jan 18, 2012 12:41PM in Java Desktop Applications
Hi,

I got stuck at this problem: when trying to parse the links in a PDF document, I can detect the links which are URI, but for the links that go to other pages in the same document, I haven't found any solution. Search the web for hours but no luck.

Here is the code:
PdfObject aData = annotObj.getDictionary(PdfDictionary.A);

if (aData != null && aData.getNameAsConstant(PdfDictionary.S) == PdfDictionary.URI) 
                            {                
                                String text = aData.getTextStreamValue(PdfDictionary.URI);
                                System.out.println("text=" + text);
                                ret.urlList.add(text);
                            }
                            else {

                                ret.urlList.add("");
                            }
Please help.

Answers

  • gimbal2
    gimbal2 Member Posts: 11,949 Gold Trophy
    You are basically asking for tech support on some third party PDF library which you do not even identify by name. Do you really expect answers?
  • 908059
    908059 Member Posts: 50
    Yes, I really need a solution.
    I am using Sun PDF Viewer library.
  • 908059
    908059 Member Posts: 50
    Good news: after spending hours in the PDF spec, I solved the problem.
  • gimbal2
    gimbal2 Member Posts: 11,949 Gold Trophy
    Sun PDF viewer library? Never heard of it. Are you perhaps talking about this thing?

    http://java.net/projects/pdf-renderer/

    Good news: after spending hours in the PDF spec, I solved the problem.
    Then please post the solution so you may help others that run into the same problem.
  • 908059
    908059 Member Posts: 50
    gimbal2 wrote:
    Sun PDF viewer library? Never heard of it. Are you perhaps talking about this thing?

    http://java.net/projects/pdf-renderer/
    I have some source code that has some packages start with com.sun.pdf.* so that I think it is the Sun PDF viewer. Sorry I am not sure.


    >
    Good news: after spending hours in the PDF spec, I solved the problem.
    Then please post the solution so you may help others that run into the same problem.
    OK, I will post the solution in a separate thread.
This discussion has been closed.