Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
pagedjs
pagedjs
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 153
    • Issues 153
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 11
    • Merge Requests 11
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Tools
  • pagedjspagedjs
  • Issues
  • #251

Closed
Open
Opened Sep 23, 2020 by florin cosmin onciu@sesa535202
  • Report abuse
  • New issue
Report abuse New issue

sample html won't break correctly on the next page

Hi,

I am trying to render a hierarchy like in the picture I attached Screenshot_2020-09-23_at_14.29.53

The html that builds that hierarchy is attached below. If the html for the hierarchy can fit on a single page there are no issues, but once the hierarchy grows such that it needs extra pages I get an error like in the pictureScreenshot_2020-09-23_at_14.49.14

html-to-render-paged.html

I inspected the source code of pagedjs and the error seems to be thrown at line 171 inside layout.js

// Only check x characters
if (length >= this.maxChars) {

	this.hooks && this.hooks.layout.trigger(wrapper, this);

	let imgs = wrapper.querySelectorAll("img");
	if (imgs.length) {
		await this.waitForImages(imgs);
	}

	newBreakToken = this.findBreakToken(wrapper, source, bounds, prevBreakToken);

	if (newBreakToken && newBreakToken.equals(prevBreakToken)) {
                // HERE
		console.warn("Unable to layout item: ", node);
		return undefined;
	}

	if (newBreakToken) {
		length = 0;
	}
}

It seems that If I replace the funny characters in the hierarchy with empty spaces it works fine. I believe that the real issue is about those characters.

Edited Sep 23, 2020 by florin cosmin onciu
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
0
Labels
None
Assign labels
  • View project labels
Reference: tools/pagedjs#251