Hi,
Wappler v6.5.4, NodeJS, MySQL, Docker
I am getting an error reading _minWidth
in the PDF Creator. The PDF is being generated from a table with 2 nested tables. I have tried various Page Sizes, Margins etc. and none of these settings have resolved this error.
Is there a setting I have missed adding in the PDF element or is it a bug?
How are the tables nested, how does the html structure look like?
Hi Patrick,
The html structure follows this pattern:
Container
Row
Col is="dmx-pdf-content" id="pdfcontent1" table-auto-size="true"
Main-Table
nested-table-1 (in main-table)
nested-table-2 (in main-table -> nested-table-1)
I can send the complete html page in a DM if that will work better in investigating the issue.
The error seems to happen in the pdfmake package, not sure if I can do anything about it. In the console type dmx.debug = true
and then try to generate the PDF. It should output the docDefinition in the console.
You can test the docDefinition in the pdfmake playground at pdfmake.org/playground.html.
You may also send the generated docDefinition to me for testing.
Hi Patrick,
I tried generating the PDF after setting dmx.debug = true
in the dev console, but it didn't output the docDefinition in the console. I kept getting the same error as above.
I tried various other ways by removing CSS classes, elements etc.; I kept getting different errors, such as _calcWidth
or Malformed table row, a cell is undefined
, or the PDF was being generated with the 1st page section being repeated over 20-50 pages.
The only time it generated a PDF was when I removed the 2nd level of nested table. So, from my testing, it seems pdfmake is unable to handle more than 1 level of nested tables.
This limitation in pdfmake doesn't work in this particular report as it requires multiple levels of nested tables, to present information in the format of Headers -> Sections -> Statements
.
I would be interested to know if a different approach is possible in getting this type of report, which may be compatible with pdfmake component.
Is it really needed to use that many nested tables? Perhaps some of it can just be rows and columns instead which I believe doesn't have any nesting problems with pdfmake.
Hi Patrick,
I modified the report structure to a normal repeat, repeat-children and table. This fixed the issue with _minWidth
.
But it still didn't work correctly. I'm using dmx-show
and dmx-bind:condition
properties for table header and rows, and PDF creator component couldn't parse these properties properly. I was getting rows mismatch error.
It seemed that PDFcreator was calculating the number of rows by ignoring the dynamic properties and then failing as the actual number of rows to print were different according to the dynamic properties showing/hiding records on the print canvas.
The dmx-show
attribute only toggles the css for displaying the component (it sets display: none
to hide the element). By hiding the node it isn't removed from the DOM and so the parser still sees these nodes as rows. There is no easy way to select only visible elements within the DOM.
I've checked our component code, but we don't seem to do any row counting. It's probably something in the 3rd party package html-to-pdfmake
that it's not checking if the node is visible.