AEM Native PDF: How to add chapter number to PDF Bookmark | Community
Skip to main content
Level 4
July 24, 2024
Solved

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

  • July 24, 2024
  • 1 reply
  • 1457 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Surbhi_Maheshwari

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

1 reply

Adobe Employee
July 26, 2024

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

Level 4
July 26, 2024

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

rkody
Level 3
September 4, 2024

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


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