Tables in PDF spanning right margin

<oXygen/> general issues.
AnalogKid82
Posts: 6
Joined: Fri Nov 15, 2019 9:13 pm

Tables in PDF spanning right margin

Post by AnalogKid82 » Fri May 15, 2020 5:06 pm

We're using the latest DITA OT and the latest version of Oxygen Editor. Some, but not all, tables are spanning the right margin and running off the page in PDF output.
pdf_table_margin.png
pdf_table_margin.png (138.21 KiB) Viewed 185 times
Is there a global setting we can apply to all tables or is this something we need to set in XSL? The attached zip contains our XSL file, which I believe controls table behavior in PDF output. Thanks!
commons-attr.zip
(3.12 KiB) Downloaded 7 times

Radu
Posts: 6981
Joined: Fri Jul 09, 2004 5:18 pm

Re: Tables in PDF spanning right margin

Post by Radu » Mon May 18, 2020 9:18 am

Hi,

It would have helped if you would have posted the DITA content for that table which overflows. Column spans can be defined in DITA tables either as proportional like:

Code: Select all

 <colspec colname="c1" colnum="1" colwidth="1*"/>
or fixed like:

Code: Select all

<colspec colname="c1" colnum="1" colwidth="75pt"/>
When you add a new table in the Author visual editing mode you can decide if the column widths should be proportional or fixed.
If they are proportional, the table should fit the page width if the processor can manage to split the contents in each cell. But if they are fixed maybe the sum of all column widths is larger than the page width.

You seem to be using the classic XSL-FO based approach to building the PDF output.
Oxygen also has the possibility to produce a PDF using our CSS-based Chemistry publishing engine.
What PDF processor are you using to produce the PDF? Is it the Apache FOP bundled with Oxygen or a commercial PDF processor like Antenna House?
In the case in which you have table cells or code blocks with long words which cannot be divided on multiple lines, the Apache FO processor has support for hyphenation:

https://www.oxygenxml.com/doc/versions/ ... ation.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

AnalogKid82
Posts: 6
Joined: Fri Nov 15, 2019 9:13 pm

Re: Tables in PDF spanning right margin

Post by AnalogKid82 » Mon May 18, 2020 4:20 pm

Hi Radu,

Here's a sample of the table code - the colwidth clearly huge fixed values. We have several tables like this, likely caused during the conversion from HTML to DITA and writers reusing these tables instead of creating new ones with the correct colwidths. I assumed the issue was with our PDF transform. I'll go through and fix these tables to be proportional. We use the Apache FOP processor. Thanks!

Code: Select all

 <table frame="all" rowsep="1" colsep="1" id="table_beginprescan">
      <tgroup cols="3">
        <colspec colname="c1" colnum="1" colwidth="239.25pt" align="left"/>
        <colspec colname="c2" colnum="2" colwidth="76.5pt" align="left"/>
        <colspec colname="c3" colnum="3" colwidth="360pt" align="left"/>
        <thead>
          <row>
            <entry>Name</entry>
            <entry>Type</entry>
            <entry>Description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry><codeph>app_id</codeph><p conkeyref="r_disclaimers/ckr-required"/></entry>
            <entry>Integer</entry>
            <entry><ph conkeyref="r_disclaimers/ckr-app_id"/></entry>
          </row>
          <row>

Radu
Posts: 6981
Joined: Fri Jul 09, 2004 5:18 pm

Re: Tables in PDF spanning right margin

Post by Radu » Tue May 19, 2020 7:41 am

Hi,

Right, for conversion from fixed to proportional widths you could use an XML refactoring action.
I created a custom Oxygen XML refactoring action based on XSLT and uploaded it here:

https://github.com/oxygenxml/dita-refac ... oportional

There are instructions about how the actions can be used here:

https://github.com/oxygenxml/dita-refactoring-examples

On your sample DITA table, it converts this:

Code: Select all

  <colspec colname="c1" colnum="1" colwidth="239.25pt" align="left"/>
                    <colspec colname="c2" colnum="2" colwidth="76.5pt" align="left"/>
                    <colspec colname="c3" colnum="3" colwidth="360pt" align="left"/>
to this:

Code: Select all

  <colspec colname="c1" colnum="1" align="left" colwidth="35*"/>
                    <colspec colname="c2" colnum="2" align="left" colwidth="11*"/>
                    <colspec colname="c3" colnum="3" align="left" colwidth="53*"/>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply