Expand my Community achievements bar.

SOLVED

AEM Native PDF: How to add chapter number to PDF Bookmark

Avatar

Level 4

Hello!

Is there a way to tell Native PDF to output its chapter numbers so that the PDF output shows them on the bookmarks tab? Right now I have the chapters autonumbered and they look/work well in the content, but the asset loses some clarity when there are no chapter numbers in the bookmarks pane.

Any help is much appreciated!

 

Thanks!

Josh

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi Josh,

 

Let's say you have made h1 as autonumber for your chapter titles to be autonumbered. Then you can add -ro-bookmark-label to it. e.g.

h1 {
  font-size: 24pt;
  --autonumber: autonumber;
  margin-left: calc(var(--list-indent) + var(--prefix-size) + var(--prefix-gap));
  margin-top: calc(var(--vertical-spacing) / 2);
  margin-bottom: calc(var(--vertical-spacing) / 2);
  --prefix-size: 24px;
  --prefix-fixed-size: 0;
  --prefix-gap: 4px;
  --vertical-spacing: 0px;
  --list-indent: 0px;
  counter-reset: h21 0;
  position: relative;
  -ro-bookmark-label: content(before) content(text);
}

Let me know if it works for you.

 

Thanks,
Surbhi Maheshwari

View solution in original post

6 Replies

Avatar

Employee

Hi Josh,

 

For the autonumbered chapters you can add  something like below in your CSS.

 -ro-bookmark-label: content(before) content(text);

  If you want to add some space or any other string in between chapter number and text then you can give it using double quotes e.g.  -ro-bookmark-label: content(before) " " content(text); 

Please give this a try and let us know how it goes.

 

Thanks and Regards,
Surbhi Maheshwari

Avatar

Level 4

Hi, Surbhi!

 

As always, I appreciate your help!!

 

I did add this to the content.css, but unfortunately I'm not seeing any change in the PDF bookmarks. Is there any context or specific location within the css I should place this?

 

Thanks!!

Josh

Avatar

Correct answer by
Employee

Hi Josh,

 

Let's say you have made h1 as autonumber for your chapter titles to be autonumbered. Then you can add -ro-bookmark-label to it. e.g.

h1 {
  font-size: 24pt;
  --autonumber: autonumber;
  margin-left: calc(var(--list-indent) + var(--prefix-size) + var(--prefix-gap));
  margin-top: calc(var(--vertical-spacing) / 2);
  margin-bottom: calc(var(--vertical-spacing) / 2);
  --prefix-size: 24px;
  --prefix-fixed-size: 0;
  --prefix-gap: 4px;
  --vertical-spacing: 0px;
  --list-indent: 0px;
  counter-reset: h21 0;
  position: relative;
  -ro-bookmark-label: content(before) content(text);
}

Let me know if it works for you.

 

Thanks,
Surbhi Maheshwari

Avatar

Level 4

I put it in h1.chapter and it works like a charm. thank you so much, Surbhi!!  

Avatar

Level 3

Hey @Surbhi_Maheshwari ,

 

Is there a list of these kinds of things to use in CSS? I've seen a few of your responses with very specific CSS solutions.

 

i.e.

-ro-bookmark-label

@PAGE Common:-ro-last

 

Avatar

Employee

Very valid point @rkody We shall work on it and provide documentation.