We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Force Show/Hide of PDF Elements

I am having difficulty with your Aspose.PDF library to accomplish
certain tasks. I have been able to find proper API to detect/create
bookmarks, annotations, metadata, attached files, and notes.

What I am unable to do however is force a
file to display
or hide bookmarks, annotations, attachments, and/or notes. I believe this is a setting with the PDF files
as I am able to set them when I develop new PDFs from either Adobe
Acrobat or a tool such as iTextSharp. What I want to do is modify an
existing file and change the settings to display

  • Bookmarks Panel
  • Attachments Panel
  • Notes Panel
  • Annotations

    Please advise on as to how I can do this with your API,

Hi Kunal,

We’re looking into your requirement and you’ll be updated the earliest possible.

We’re sorry for the inconvenience.

Hi Kunal,

We’re looking into your requirement, however we need a little more input from your side. The only panels available in Adobe Reader, or other viewers for that matter, are as follows:

Model Tree

Are you interested to be able to show/hide all of the above panels individually? Moreover, can you please share which ‘Notes Panel’ are you referring too? Is it the ‘Comments Panel’? Also, are you interested to be able to show/hide annotations inside the PDF pages?

Please share your thoughts in detail so we could proceed further to help you out.

This is correct, sorry for the confusion, notes and annotations i believe are the same thing.

Otherwise yes - I am trying to either show/hide each of these panels. I want to see if there is any content, and if there is display such a panel, if there is no content then that panel can remain as is (hidden or shown, whatever the file setting was)

Thank you

Hi Kunal,

Thank you very much for sharing the details. We’re looking into your requirement and you’ll be updated shortly.

We’re sorry for the inconvenience.

Hi Kunal,

I’m sorry to inform you that this feature is currently not available. However, I have logged a new feature request as PDFKITNET-14297 in our issue tracking system for this requirement. Our team will look into this and you’ll be updated via this forum thread once the feature is supported.

We’re sorry for the inconvenience.

Hi Kunal,

I would like to update you that Aspose.Pdf.Kit allows you to show or hide some of the panels using PdfContentEditor and ViewerPreference classes. These are the only panels which are allowed by PDF specifications; other elements, which are not allowed according to the specification can’t be provided in Aspose.Pdf.Kit.

Please see an example below:

//creat PdfContentEditor and bind pdf file

Aspose.Pdf.Kit.PdfContentEditor editor = new Aspose.Pdf.Kit.PdfContentEditor();


//show pages panel


//show optional content panel


//show document outlines panel


//show attachment panel



You can also find all other possible flags in ViewerPreference class. Please see the available options in detail to find if it satisfy your requirement.

If you have any further questions, please do let us know.

Thanks this has been most helpful.

There is one issue I see which is adobe allows any of the following items to be displayed

Pages | Bookmarks | Layers AND
Comments | Attachments

Aspose’s code only marks the last selected ViewerPreference.

Is it possible to show 1 item from each group adobe supports, rather than just 1 item out of the 5?

Meaning can I show Pages and Attachments instead of just Pages or attachments?


Hi Kunal,

I have tested this issue at my end and noticed that only one panel is being displayed at one time. I just wanted to make sure that we’re on the same page regarding this issue. Do you want to open multiple panels at the same time i.e. Pages and Attachment panels, using Aspose.Pdf.Kit?

Please confirm, so we could move forward.

That is correct. But it is not even possible in adobe to show any 2 panels.

only one from
Pages | Bookmarks | Layers AND

one from
Comments | Attachments

So Pages + Comments or Pages + Attachments or Bookmarks + comments or Bookmarks + attachments, etc

Hi Kunal,

Thank you very much for the confirmation. I have logged this issue as PDFKITNET-18677 in our issue tracking system. Our team will look into this issue and you’ll be updated via this forum thread once it is resolved.

We’re sorry for the inconvenience.