How to add a sticky note to a PDF file

Help
rubo song
2011-02-28
2013-05-28
  • rubo song

    rubo song - 2011-02-28

    Hello!

    Thanks for this library!

    I'm using jpod for adding comments.

    I add a PDTextAnnotation like this:

    public void addTextAnnotation(PDPage page) {
            PDTextAnnotation annot=(PDTextAnnotation)PDTextAnnotation.META.createNew();
            CDSRectangle rect = new CDSRectangle(77.9222f,529.357f ,97.9222f ,547.357f);
            annot.setRectangle(rect);
            annot.setColor(new float[] { 1.0f, 1.0f, 0.0f  });
            annot.setContents("note");
            annot.setSubject("objSub");
    
            PDPopupAnnotation pop0=(PDPopupAnnotation)PDPopupAnnotation.META.createNew();
            pop0.setRectangle(new CDSRectangle(284.903f,451.708f,464.903f,571.707f));
            pop0.setColor(new float[] { 1.0f, 1.0f, 0.0f  });
            pop0.setOpen(true);
    
            pop0.setParent(annot);
            annot.setPopup(pop0);
    
            page.addAnnotation(annot);
    
        }
    

    Popup can not be displayed when opened by Reader 10 and Acrobat 7.It can not be displayed when I double click the icon.

    But it can be displayed when opened by Foxit Reader.

    What should I do to avoid this problem?

    Thanks a lot!

     
  • mtraut

    mtraut - 2011-03-03

    Sorry for beeing a little late.

    The one thing that is different in our own popup creation is that we add the popup to the page's annotation, too. While i didn't run a test case explicitly, that may be the cause of the problem.

    Another difference is in the text annotation creation. We do set an icon explicitly AND add an appearance (which is some work to do).

     
  • rubo song

    rubo song - 2011-03-08

    It works.

    public void addTextAnnotation(PDPage page) {
            PDTextAnnotation annot=(PDTextAnnotation)PDTextAnnotation.META.createNew();
            CDSRectangle rect = new CDSRectangle(77.9222f,529.357f ,97.9222f ,547.357f);
            annot.setRectangle(rect);
            annot.setColor(new float[] { 1.0f, 1.0f, 0.0f  });
            annot.setContents("note");
            annot.setSubject("objSub");
    
            PDPopupAnnotation pop0=(PDPopupAnnotation)PDPopupAnnotation.META.createNew();
            pop0.setRectangle(new CDSRectangle(284.903f,451.708f,464.903f,571.707f));
            pop0.setColor(new float[] { 1.0f, 1.0f, 0.0f  });
            pop0.setOpen(true);
    
            pop0.setParent(annot);
            annot.setPopup(pop0);
    
            page.addAnnotation(annot);
            page.addAnnotation(pop0);
        }
    
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks