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

Nested fixed elements produce error on multi-page layouts #171

Closed
iabw opened this Issue Feb 22, 2014 · 1 comment

Comments

2 participants
@iabw
Copy link

iabw commented Feb 22, 2014

When content is only 1 page in length, nested fixed position elements work as I expect. When content is more than 1 page in length, Weasyprint throws a TypeError.

Error Produced:
TypeError: coercing to Unicode: need string or buffer, int found

Reduced test case:

<style>
    .header{ position: fixed; top: 0 }
    .footer { position: fixed; bottom: 0; }
</style>

<div>Text</div> <!-- Repeated enough to produce more than 1 page of content -->

<div class='header'>
    <div class='footer'>Footer</div>
</div>

Traceback:

  File "/weasyprint/__init__.py", line 132, in render
    return Document._render(self, stylesheets, enable_hinting)
  File "/weasyprint/document.py", line 308, in _render
    return cls([Page(p, enable_hinting) for p in page_boxes],
  File "/weasyprint/layout/__init__.py", line 62, in layout_document
    layout_backgrounds(page, get_image_from_uri)
  File "/weasyprint/layout/backgrounds.py", line 213, in layout_backgrounds
    layout_box_backgrounds(page, page, get_image_from_uri)
  File "/weasyprint/layout/backgrounds.py", line 59, in layout_box_backgrounds
    layout_box_backgrounds(page, child, get_image_from_uri)
  File "/weasyprint/layout/backgrounds.py", line 59, in layout_box_backgrounds
    layout_box_backgrounds(page, child, get_image_from_uri)
  File "/weasyprint/layout/backgrounds.py", line 59, in layout_box_backgrounds
    layout_box_backgrounds(page, child, get_image_from_uri)
  File "/weasyprint/layout/backgrounds.py", line 56, in layout_box_backgrounds
    resolve_radiii_percentages(box)
  File "/weasyprint/layout/percentages.py", line 125, in resolve_radiii_percentages
    ry = _percentage(ry, box.border_height())
  File "/weasyprint/formatting_structure/boxes.py", line 151, in border_height
    return self.padding_height() + self.border_top_width + \
  File "/weasyprint/formatting_structure/boxes.py", line 142, in padding_height
    return self.height + self.padding_top + self.padding_bottom
TypeError: coercing to Unicode: need string or buffer, int found
@liZe

This comment has been minimized.

Copy link
Member

liZe commented Mar 7, 2019

Fixed with 1eea5a4 (see #728).

@liZe liZe closed this Mar 7, 2019

@liZe liZe added this to the 46 milestone Mar 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.