How can we add comment in the PDF?

I need to add a comment in the PDF and I am using the xymacro <:pdfs;NOTE;This technical note appears in red;/Color [1 0 0]><:pdfe;NOTE> as mentioned in the xypdf manual but unable to generate the comment in the PDF. Can anybody assist me to generate a comment in the PDF. I am using XPP 9.4.1.0.

Parents
  • Bart, thanks for checking up on me. That's what happens when you look too quickly at the code.  Slight smile

    I looked again and I think you're right that <:pdfs;NOTE;...> should be working with just the -pdfmark option included (and -pdfba or -pdfua are not needed).

    I got confused by code right at the same location that was doing some type of begin "Annot" tagging stuff, that does apply only to PDF/UA.

    But the code actually creating the "Text annotation" does not require -pdfua nor -pdfba.

    Just looking at the code it looks like this should be working, but I've seen the support ticket you opened and what it describes you doing for a test case and that seems to verify (agreeing with Shahnawaz) that in fact it's not working.

    So, opening the ticket was the right way to go.

    Unfortunately, it means that adding the -pdfua option is not a workaround (it wasn't a good one anyway) and your workaround (to use CSS) is the only viable one.

  • Jonathan,

    Thanks for verifying this.

    Hopefully you don't spend too much time fixing this.

    In my test job what I did notice was that Acrobat was showing something completely different for the <:pdfs;NOTE> case than it did for the -xpp-pdf-annotation case. They were both notes but the first one did not get an icon on the page while the second one did get an icon...

  • Hi Bart,

    Thanks for the sample job you provided with your ticket. I think I've identified the problem in divpdf. I have to confess; it looks like I broke this in divpdf around 2016 when we added the ability (in both psfmtdrv and divpdf) for some of the pdfmarks (like NOTE) to be able to be "nested". Looks like I got it right in psfmtdrv, but lost something in the translation when making the parallel code changes in divpdf. At some point fairly soon a fix with be forthcoming.

    But I did see one thing with your sample, that you just mentioned, that is actually not a bug - that I wanted to explain in more detail for everyone's edification: "They were both notes but the first one did not get an icon on the page while the second one did get an icon."

    I'm assuming that you are comparing the result with psfmtdrv on page 1 (<:pdfs;NOTE;...>) with divpdf on page 2 (CSS annotation type={note}).

    I agree that at first glance the psfmtdrv result on page 1 looks like there is no note icon, but in fact that is not the case. It's just that because you did not specify a color for the note icon, and due to the type of note icon (/Name Comment) that you called out, the icon shows as "invisible".

    Here are some pictures to show what I mean.

    On opening the sample PDF from psfmtdrv on page 1 (in Acrobat Reader), this is what I see (which is what you described):

    But I do see a note window "open" (because you specified "/Open true" in the macro) and if I open the Comment panel in Reader I do see a note listed for page 1.

    If I click with the cursor on the area just below the word "text", I then see an outline of the note icon:

    In contrast, on opening the sample PDF from divpdf on page 2 this is what I see (again what you described):

    With the note annotation via CSS, you didn't specify the icon type (iconname) and the default type with divpdf (PDFlib) is "note" (called "Text Note" in Acrobat) - versus icon type "comment" that you have on page 1.

    I noticed with Acrobat Reader that when I use its GUI to add a "Sticky Note" (which is internally icon type "comment") that the default color of the note icon is set to yellow/orange. In fact, as I click on various types of comments to add I see various default colors (e.g. green, yellow, red) for different types. When I actually manually added a "Sticky Note" (with default yellow/orange color), the note icon (type comment) was very visible.

    So, I went back to your sample and both in the pdfmark macro and in the CSS I made changes to specify RGB color "1 .64 0" (orange) for the icon color and produced the PDFs again.

    Then when I open the pdfmtdrv PDF on page 1, and then clicked on the "comment" icon, and then opened the divpdf PDF on page 2 I see these:

                                    

    So, it appears to be a "quirk" of (at least) Acrobat Reader that the icon for a type "comment" comment (the note on page 1), if not given a color, shows as "invisible".

    Everyone please make a note of that.  Slight smile

  • Jonathan,

    Great!

    And a nice explanation about the icon thing.
    (hey there is always more to learn..)

    Just for completeness could you post the complete <:pdfs;NOTE> and -xpp-pdf-annotation command you have been using for the above orange note examples?
    I am sure that it will save a lot of time for somebody some day...

    And maybe I need to open up a documentation ticket.
    The xypdf manual currently says:
    Screenshot of Trados Studio PDF documentation showing a section titled 'NOTE' with details on how to add comments to a PDF document using XyMacro. It includes format, examples, and comments about the feature.

    maybe in the comments it would be nice to add a 'note' about the default being an invisible note icon, so that if you want a visible icon one should add the /Color optional data

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 5:20 AM (GMT 0) on 5 Mar 2024]
  • Yes, if you want that tweak to the PDF Support (xypdf) manual (and it seems like a good suggestion) you will need to open a documentation ticket.

    For the above orange note examples using the sample Bart provided, what follows are the pdfmark and CSS details.

    To color the note orange on page 1, I modified the pdfmark to be this (added part in bold):

    <:pdfs;NOTE;text of note;/Title (My note) /Open true /Name (Comment) /Color [1 .64 0]>

    To color the note orange on page 2, I modified the CSS to be this (added part in bold):

    note {
        -xpp-pdf-annotation: "type={note} text={text as defined in CSS}";
        -xpp-pdf-annotation-options: "annotcolor={rgb 1 .64 0}";
    }

  • downloaded hotfix, tested it and.....
    it is working!

    Thank you Jonathan

Reply Children
No Data