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

Support CSS functions & variables for size definitions #743

Open
chanchalsen opened this issue Jan 1, 2024 · 0 comments
Open

Support CSS functions & variables for size definitions #743

chanchalsen opened this issue Jan 1, 2024 · 0 comments
Labels
bug Something isn't working CSS Issues with CSS properties

Comments

@chanchalsen
Copy link

chanchalsen commented Jan 1, 2024

The code throws error with cannot convert to float in this statement:

return max(MIN_FONT_SIZE, relative * float(value)) 

in the path: xhtml2pdf/util.py

when a string: "<css function: var(--lwc-spacingxxxsmall. ('0.25'. 'rem'))>" is passed to the getSize function.

Need help in resolving this issue.

Full stack trace:

2023-12-18 06:19 - xhtml2pdf - ThreadPoolExecutor-0_0  - SpawnProcess-4 - DEBUG - [document.py:99] pisaDocument options:
  src = <_io.BufferedReader name='./output/lob2358069041046861738.HTML'>
  dest = <_io.BufferedWriter name='./output/temp_document_converted_file.pdf'>
  path = None
  link_callback = None
  xhtml = False
  context_meta = None
2023-12-18 06:19 - xhtml2pdf - ThreadPoolExecutor-0_0  - SpawnProcess-4 - WARNING - [util.py:295] getSize <CSS function: var(--lwc-varSpacingXxSmall, ('0.25', 'rem'))> 9.75
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/xhtml2pdf/util.py", line 287, in getSize
    return max(MIN_FONT_SIZE, relative * float(value))
ValueError: could not convert string to float: "<css function: var(--lwc-varspacingxxsmall. ('0.25'. 'rem'))>"
@chanchalsen chanchalsen added the bug Something isn't working label Jan 1, 2024
@timobrembeck timobrembeck added the CSS Issues with CSS properties label Jan 20, 2024
@timobrembeck timobrembeck changed the title Getting could convert string to float error Support CSS functions & variables for size definitions Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CSS Issues with CSS properties
Projects
None yet
Development

No branches or pull requests

2 participants