Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to layout item: JSHandle@node when cells have significant size #267

Open
rohel01 opened this issue Jun 25, 2020 · 8 comments
Open
Labels
🐛 bug Something isn't working 🙃 upstream

Comments

@rohel01
Copy link

rohel01 commented Jun 25, 2020

Hello,

I use the following on an up to date Ubuntu 19.10

  • node v12.18.1 (npm v6.14.5)
  • Asciidoctor PDF 1.0.0-alpha.8 using Asciidoctor.js 2.2.0 (Asciidoctor 2.0.10) [https://asciidoctor.org]
  • Runtime Environment (node v12.18.1 on linux)
  • CLI version 3.4.0

The install log of asciidoctor-web-pdf was :

install.log

If I try to generate example.txt, I get this errors:

mmelchiore:doc$ asciidoctor-pdf example.adoc
Unable to layout item: JSHandle@node
Unable to find destination _a_section while generating PDF outline! This likely happened because an anchor link contained an > umlaut (https://bugs.chromium.org/p/chromium/issues/detail?id=985254).

I have done a bit of testing, and if you comment the last "Lorem...", the error goes away. So I guess something is up with the layout of big cells...

@ggrossetie
Copy link
Owner

Paged.js has updated the logic to avoid infinite loop so now when the "layouter" cannot fit an element into the page, this element is left on the "invisible" column (on the right).

If you open the developer tools on the HTML page, you can see the table on the right:

right-column

And apparently Paged.js does not know how to break a cell but that's not an easy task!
I will open an issue upstream with your example.

@rohel01
Copy link
Author

rohel01 commented Jun 26, 2020

Automatically breaking up the cells is the full feature required to fix my issue. I understand this requires much more work so I think we should aim for a shorter term workaround.

Diagnostic messages would help the author manually break up the cells. Currently, I only see a cryptic error with no information on the elements causing the problems.... and the document can be quite long...

FYI, asciidoctor-pdf does not implement automatic cell break on page boundaries either. This is something I need to manually fix, which is a pity since it is dependent on the currently active template

@ggrossetie
Copy link
Owner

Diagnostic messages would help the author manually break up the cells. Currently, I only see a cryptic error with no information on the elements causing the problems.... and the document can be quite long...

The error is a bit better on the developer console:

warn

I believe that our logger cannot create a string representation of a Node that's why we get JSHandle@node instead of <tr ...>.
Do you think that would be enough to troubleshoot? If not, what information should we add? Maybe the page number?

Unable to layout <tr> element on page 2

FYI, asciidoctor-pdf does not implement automatic cell break on page boundaries either. This is something I need to manually fix, which is a pity since it is dependent on the currently active template

It should be possible to do it with Paged.js but as mentioned there are a few things to consider.

@rohel01
Copy link
Author

rohel01 commented Jun 29, 2020

We need to consider the target user profile, when troubleshooting:

  • End-users
    We cannot expect them to know about the intermediate HTML code, it is an implementation details. Further, using chromium with the development console is burdensome and requires advanced skills. This is why logging is important for them. Here is the Cursor interface, which AsciidoctorJ uses to trace source location throughout the compilation pipeline.

  • Hackers
    I don't miond using chromium and the development console to troubbleshoot. But, I am not familiar with those technlogies. Maybe, we should provide a debugging procedure ?

@ggrossetie
Copy link
Owner

We need to consider the target user profile, when troubleshooting:
End-users
We cannot expect them to know about the intermediate HTML code, it is an implementation details. Further, using chromium with the development console is burdensome and requires advanced skills. This is why logging is important for them. Here is the Cursor interface, which AsciidoctorJ uses to trace source location throughout the compilation pipeline.

That's a good idea but it probably won't be easy to infer the line number in the AsciiDoc document from the Paged.js error.

Hackers
I don't miond using chromium and the development console to troubbleshoot. But, I am not familiar with those technlogies. Maybe, we should provide a debugging procedure ?

Yes that's a good idea.
We can start by adding documentation and improving the error messages. Feel free to suggest improvements and/or open pull request to update the documentation.

Here's the upstream issue for the table issue: https://gitlab.pagedmedia.org/tools/pagedjs/issues/227
Actually, there are several issues depending on which styles are applied to the table but even when using an unstyled table Paged.js does not chunk the table properly and some cells/columns are missing.

I will look into the "Unable to find destination _a_section while generating PDF outline!" issue.

@ggrossetie ggrossetie added the 🐛 bug Something isn't working label Jul 6, 2020
@ggrossetie
Copy link
Owner

I will look into the "Unable to find destination _a_section while generating PDF outline!" issue.

It's related to the table bug, the PDF generated (by Chrome) does not contain the Dest entry for "_a_section".

@albertosantini
Copy link

Also it happens when the table is very long and one page is not enough.
It gives Unable to layout item: JSHandle@node for the element between the two pages.

As workaround I need to split the table and to fit manually the table "children" in different pages.

@ggrossetie
Copy link
Owner

I'm moving @dgslos comment here since it's related:

I'm still getting this error. Downloaded the v1.0.0-alpha.14 release. Tried both linux and windows versions

Error:
Unable to layout item:  JSHandle@node
Unable to find destination _overview_size_of_the_subcollection_mostly_by_year_if_database_in_access while generating PDF > outline! This likely happened because an anchor link contained an umlaut (https://bugs.chromium.org/p/chromium/issues/detail?id=985254).
Unable to find destination _additional_questions while generating PDF outline! This likely happened because an anchor link  contained an umlaut (https://bugs.chromium.org/p/chromium/issues/detail?id=985254).
Unable to find destination _possible_improvements while generating PDF outline! This likely happened because an anchor link > contained an umlaut (https://bugs.chromium.org/p/chromium/issues/detail?id=985254).

#340 (comment)

I will open a pull request to remove the message:

This likely happened because an anchor link contained an umlaut (https://bugs.chromium.org/p/chromium/issues/detail?id=985254).

This message is misleading and the error is now fixed. I think we should replace it by:

This likely happened because Paged.js was unable to layout a portion of your document (i.e., missing from the output). It can happen when using tables that don't fit on one page.

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🙃 upstream
Projects
None yet
Development

No branches or pull requests

3 participants