Expand my Community achievements bar.

SOLVED

AEM Native PDF: Print=No, ToC=No

Avatar

Level 4

Hi there!

 

I'm trying to suppress some topics in a map from making it to the Native PDF output. For these topics, I'm using the attribute of print=no. Is there something that I need to set up in a stylesheet to prevent these topics showing up in the PDF? Is conditionalizing the only way to currently accomplish this? Can I utilize deliverytarget for this somehow?

I have a similar question with the toc=no attribute. We had previously used this to suppress ToCs in our old system. Is there another method for making this work? Is another Native PDF template without the ToC the way to go?

 

Thanks for your help!

Josh

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Employee

@TimothyJ ,

You can achieve this by applying outputclass to the topicref which you want to exclude like below: 

<topicref href="topic.dita" outputclass="no-toc"/>

 

Now navigate to template Stylesheets and add below css in layout.css to exclude toc from pdf output.

 

CSS Rule:

.toc-body .no-toc,
.toc-level-1 .no-toc,
.toc-level-2 .no-toc,
.toc-level-3 .no-toc,
.toc-level-4 .no-toc {
  display: none !important;
}

PrashantPa_0-1727687732806.png

 

Please let me know if that doesn't works.

 

Thanks,

Prashant

 

 

View solution in original post

8 Replies

Avatar

Employee

Did you try setting the processing-role="resource-only" as follows

<topicref href="GUID-b9023d35-2f2b-44f2-a98d-7f16a79855af.dita" type="concept" processing-role="resource-only"/>

 

For TOC, there is a toggle that can be used in template or custom logic (using javascript) to suppress based on your business logic.

Avatar

Level 4

The processing-role attribute did the trick - thank you!!

 

Could we incorporate the ToC=no to suppress the ToC? If I wanted to omit the ToC from maps, as needed, what type of javascript could I use to accomplish this?

 

Thanks again!

Josh

Avatar

Level 2

processing-role="resource-only" will omit the whole topic from being processed in the content body as well as the toc.

 

I would like to to remove it from the toc only.  Usually that is done with toc="no" in the topicref in the map.

How can I accomplish this using native pdf?

Avatar

Employee

You are correct that using processing-role="resource-only" will remove the entire topic from both the content body and the Toc, while toc="no" in the topicref typically only excludes it from the Toc. 
I see toc="no" is not excluding topicref in Native PDF.

I've flagged this behavior internally for further investigation, and our team is actively looking into it.(GUIDES-20156).
I will share if I have any more updates or workaround here.

Avatar

Correct answer by
Employee

@TimothyJ ,

You can achieve this by applying outputclass to the topicref which you want to exclude like below: 

<topicref href="topic.dita" outputclass="no-toc"/>

 

Now navigate to template Stylesheets and add below css in layout.css to exclude toc from pdf output.

 

CSS Rule:

.toc-body .no-toc,
.toc-level-1 .no-toc,
.toc-level-2 .no-toc,
.toc-level-3 .no-toc,
.toc-level-4 .no-toc {
  display: none !important;
}

PrashantPa_0-1727687732806.png

 

Please let me know if that doesn't works.

 

Thanks,

Prashant

 

 

Avatar

Employee

@TimothyJ did this solve the issue? If so please mark this closed (by accepting the solution.

Avatar

Level 6

The code did help me suppress the <example> element (that doesn't render correctly) from the ToC and the chapter-level mini-ToC, so thank you. You helped me resolve an issue that will remain an issue until the Adobe dev team fixes it.

Avatar

Level 2

Yes this is a good workaround.

 

I do not see an option to accept the solution as there is already an acceptance above, despite it not being an actual resolution until your answer.