Expand my Community achievements bar.

SOLVED

AEM Native PDF Screen inside table overflows

Avatar

Level 4

Hello!

 

I'm seeing some issues in our legacy dita material where <screen> tags in tables are pushing past the right margin when I publish with Native PDF. How can I ensure that these screens stay in their cells?

 

Thanks in advance!

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, I looked at your merged HTML file. Non breaking white space seems to be the problem. It is not visible so you can't see it. Can you open your source dita file in some editor which shows this characters and lets you replace by normal space character? I will check in my team in someone has a suggestion.

 

Thanks,

Vivek

View solution in original post

16 Replies

Avatar

Employee

Hi Josh, 

 

Please share a sample dita file where you are facing this issue.

 

Thanks and Regards,
Surbhi Maheshwari

 

Avatar

Level 4

Hi, Surbhi!

Thanks for the quick response!

Apparently I misrepresented the problem - apologies! The offending tag is actually the <lines> tag, which is a rather unique one. 

It seems like our authors are going to have to rebuild most of these, but I still would like to prevent the tag from being able to exceed the border, if possible! Unfortunately, I had to redact the text on this one, but here is what I'm working with:

joshm19816095_1-1721190375095.png

and here is the output:

joshm19816095_2-1721190598269.png

 

Hopefully this is enough information! The plain AEM PDF output wraps the text normally - is Native PDF able to do the same in this case?

 

As always, thank you!

Josh

 

 

Avatar

Employee

Hi Josh,

 

I tried with something like below:

 <simpletable>
        <strow>
          <stentry>
            <lines>
Shall I compare thee to a summer&#39;s day? Thou art more lovely and more temperate:Rough winds do shake the darling buds of May, new lines <apiname>name of api</apiname> some text <keyword>new keyword</keyword> fd </lines>
          </stentry>
        </strow>
      </simpletable>

Text is wrapping fine and not going outside of table. Can you share your use case ? Have you applied any properties on table like width, height?

 

Thanks and Regards,

Surbhi Maheshwari

Avatar

Level 4

Hi again, Surbhi!

 

As always, thanks for your continued support!!

 

I made a quick example to illustrate the issues I'm seeing.

 

Here is a segment of a dita topic:

joshm19816095_0-1721363905584.png

 

Here is the native PDF output:

joshm19816095_2-1721364011669.png

Here is a code snippet if it helps!

 <lines>This is a test to see if this line will run over margins or wrap correct. <uicontrol>This is in a uicontrol tag</uicontrol> and this is normal text. <systemoutput>This is system output text</systemoutput> and this is normal text again.
This should be a new paragraph with normal text. The paragraphs should have wrapped properly. The next section is manually spaced</lines>
    <table id="table_2">
      <title>LINES Test in a table</title>
      <tgroup cols="3">
        <colspec colwidth="1*" colname="col_1"></colspec>
        <colspec colwidth="1*" colname="col_2"></colspec>
        <colspec colwidth="1*" colname="col_3"></colspec>
        <thead>
          <row>
            <entry>Regular</entry>
            <entry>Regular</entry>
            <entry>Testing the spacing when headings WRAP TO SECOND LINE</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>fdafdsadfa</entry>
            <entry>asdfasdfadsf</entry>
            <entry>This is a lines entry:
              <lines><b>25</b> - Test     5 spaces prior<b>13</b> - Test     5 spaces prior<b>28</b> - Test     5 spaces     5 more spaces     5 more spaces<b>84</b> - Test     5 spaces     5 more spaces     5 more spaces</lines>
            </entry>
          </row>
          <row>
            <entry>asdfasdfasd</entry>
            <entry>fadfasdfasd</entry>
            <entry>-------</entry>
          </row>
        </tbody>
      </tgroup>
    </table>

 

I really appreciate your help!

Josh

Avatar

Employee

Hi Josh,

 

I tried the lines and table code shared by you. For me in native PDF it is coming fine. Text is not running out of the cell. It is wrapping correctly. 

Screenshot 2024-07-29 at 10.56.32 AM.png

I think either there is some CSS at play on your end or may be some other content on this page is causing it. Can you try just this table and lines in a new topic and see if it still happens? 

 

Thanks,
Surbhi Maheshwari

Avatar

Level 4

Thanks for the response on this one, Surbhi!

 

I tried this in a new topic and it still displays the same. I'm wondering if maybe the cell or row styles need to have some kind of wrap or margin?

I'm going to look into the different potential styles and see what I can find. If you find/know anything, please let me know!

 

Thanks!!

Josh

Avatar

Employee

Hi Josh,

 

If possible , can you share your template or temporary folder containing mergedHTML.htm? I will take a look and let you know.

For now you can look at what all table styles are applied to it in mergedHTML.htm like we showed it in one of the expert session. This will give you the idea what is causing it.

 

Thanks,
Surbhi Maheshwari

Avatar

Level 4

Hi again, Surbhi!

 

I did look through the entries and I tried to make some changes, but I'm not having much luck. Would you mind looking taking a quick look?

 

Thanks so much!

Josh

Avatar

Level 1

Hi, @Surbhi_Maheshwari ! Any ideas on this one? I've really been spinning my wheels with these unwieldy <lines>!

 

Thank you!!

Josh

Avatar

Correct answer by
Employee

Hi Josh, I looked at your merged HTML file. Non breaking white space seems to be the problem. It is not visible so you can't see it. Can you open your source dita file in some editor which shows this characters and lets you replace by normal space character? I will check in my team in someone has a suggestion.

 

Thanks,

Vivek

Avatar

Level 4

Thanks, Vivek! That certainly would explain why none of my CSS wrapping attempts worked!

If anyone on your team has a suggestion, please let me know! In the meantime, I'm going to let our authors know that a manual fix is required for legacy material at this point.

 

Thanks again!

Josh

Avatar

Employee

Hi Josh,

Reading the DITA specs it seems that purpose of lines is what you are seeing.

 

See https://docs.oasis-open.org/dita/v1.2/os/spec/langref/lines.html.

"The <lines> element may be used to represent dialogs or text fragments where line breaks are significant. The <lines> element is similar to <pre> in that hard line breaks are preserved, but the font style is not set to monospace, and extra spaces inside the lines are not preserved."

 

So lines doesn't seem the correct usage if you are looking for the text to wrap.

 

Thanks,

Vivek

Avatar

Level 4

Thanks for following up, Vivek!

 

I had visited that page while researching. It definitely does make sense to me, being that it's such an open tag.

I guess the confusion from me came from the fact that our old DITA OT (and system) and current DITA OT in AEM does force the wraps. In a way this makes sense to me as well because I don't see the use of a tag running off a page. I wonder if DITA OT forces breaks around margins despite tag instructions...?  What a...unique tag!

 

Thanks again for your help! I really appreciate it!

Josh

Avatar

Administrator

@joshm19816095 Did you find the suggestions from users helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!



Kautuk Sahni

Avatar

Employee

Couple of options without troubling your writers.

  1. use CSS property line-break: anywhere Challenge with this is that it will break words also. Not sure if you will want that.
  2. Write a small JavaScript plugin in the native PDF to remove &nbsp; text for lines text and replace with normal white space. Sample JS is given here: https://stackoverflow.com/questions/34743681/how-do-you-wrap-contents-with-nbsp

Avatar

Level 4

Thanks so much for your above and beyond attention to my issue! I really appreciate it, Vivek!

I will definitely look into these suggestions to help out our authors. 

 

Thanks again!

Josh