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

Missing linked images and text #418

Open
theoryshaw opened this issue Mar 13, 2024 · 6 comments
Open

Missing linked images and text #418

theoryshaw opened this issue Mar 13, 2024 · 6 comments

Comments

@theoryshaw
Copy link

theoryshaw commented Mar 13, 2024

Is it possible to convert the following files into a pdf? They were created with https://blenderbim.org/
I couldn't get linked pngs to work, and text doesn't show up.

svg: https://github.com/Kozea/CairoSVG/assets/507113/a9d54c99-9ae3-4c2a-8f50-63faae67f8dc
png referenced into svg: https://github.com/Kozea/CairoSVG/assets/507113/2b7a7c31-8b43-4431-8c1d-bfaf18439d90)

Here's the output....
image

What it should look like:
image

@theoryshaw theoryshaw changed the title Missing embededimages and text Missing embeded images and text Mar 13, 2024
@theoryshaw theoryshaw changed the title Missing embeded images and text Missing embedded images and text Mar 13, 2024
@theoryshaw theoryshaw changed the title Missing embedded images and text Missing linked images and text Mar 13, 2024
@liZe
Copy link
Member

liZe commented Mar 18, 2024

Hello!

Here’s the PDF I get

out.pdf

This result is much better than yours!

The image size is wrong, but I get the same rendering with my browsers, that’s not a problem with CairoSVG.

@theoryshaw
Copy link
Author

cool!, if i can ask, what was the command line you used?

@theoryshaw
Copy link
Author

The image size is wrong, but I get the same rendering with my browsers...

That's weird, just to be sure i downloaded the svg/png from this github issue, and it seems to render correctly in Chorme and Firefox...

2024-03-18_08-41-32_explorerDesktopexplorer.mp4

@liZe
Copy link
Member

liZe commented Mar 18, 2024

cool!, if i can ask, what was the command line you used?

cairosvg file.svg -o file.pdf -u

I’ve just changed the name of the PNG image in the SVG file so that it can it on disk.

That's weird, just to be sure i downloaded the svg/png from this github issue, and it seems to render correctly in Chorme and Firefox...

My bad, I don’t know what I’ve done with this image!

out.pdf

@theoryshaw
Copy link
Author

Thanks @liZe,

I ran it again, using your suggested command line prompt. I got the background image, but the text doesn't show up.

2024-03-18_09-30-50_Revutesty5_-_Bluebeam_Revu_x64Revu

Ryan Schultz@DESKTOP-8GRDBJI MINGW64 /d/Dropbox/Gitea_OD/Highland_Haven/Open/Models_and_CAD/BlenderBIM/drawings (main)
$ cairosvg "D:/Dropbox/Gitea_OD/Highland_Haven/Open/Models_and_CAD/BlenderBIM/drawings/test.svg" -o "D:/Dropbox/Gitea_OD/Highland_Haven/Open/Models_and_CAD/BlenderBIM/drawings/testy5.pdf" -u
_cairo_win32_scaled_font_set_metrics:GetTextMetrics: The operation completed successfully.
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Python312\Scripts\cairosvg.exe\__main__.py", line 7, in <module>
  File "C:\Python312\Lib\site-packages\cairosvg\__main__.py", line 78, in main
    SURFACES[output_format.upper()].convert(**kwargs)
  File "C:\Python312\Lib\site-packages\cairosvg\surface.py", line 133, in convert
    instance = cls(
               ^^^^
  File "C:\Python312\Lib\site-packages\cairosvg\surface.py", line 225, in __init__
    self.draw(tree)
  File "C:\Python312\Lib\site-packages\cairosvg\surface.py", line 472, in draw
    self.draw(child)
  File "C:\Python312\Lib\site-packages\cairosvg\surface.py", line 404, in draw
    TAGS[node.tag](self, node)
  File "C:\Python312\Lib\site-packages\cairosvg\text.py", line 69, in text
    surface.context.font_extents())
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\cairocffi\context.py", line 1927, in font_extents
    self._check_status()
  File "C:\Python312\Lib\site-packages\cairocffi\context.py", line 107, in _check_status
    _check_status(cairo.cairo_status(self._pointer))
  File "C:\Python312\Lib\site-packages\cairocffi\__init__.py", line 87, in _check_status
    raise exception(message, status)
cairocffi.CairoError: cairo returned CAIRO_STATUS_WIN32_GDI_ERROR: b'error occurred in the Windows Graphics Device Interface'

@liZe
Copy link
Member

liZe commented Mar 18, 2024

I suppose that it’s the same problem as #377. The bug is probably in Cairo: https://gitlab.freedesktop.org/cairo/cairo/-/issues/530

You can try to use another font and see if it works. I’ll be even easier if you can use a Linux computer.

If it doesn’t work, you can try to add a comment on Cairo’s issue and hope for an answer. 🤞🏽

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants