Describe the bug
When following the example for PDF generation with the drawing addon (specifically the example for PDF creation), I keep running into an error where PDF generation fails.
Specifically, the get_pdf_bytes method call is where the function breaks down, with the trace going back to PyMuPdfRenderBackend.set_background in ezdxf/addons/drawing/pymupdf.py. That method fails because when it tries to run shape.drawRect it throws AttributeError: 'Shape' object has no attribute 'drawRect'.
Tracing where the shape object comes from, it looks like it uses the fitz module from pymupdf, and looking at the most recent pymupdf docs, it seems like the Shape class doesn't have a drawRect method, but rather a draw_rect method. It makes me think that maybe that function name changed in pymupdf and the change hasn't been reflected in this codebase.
Could this code be updated to match the new class definition in pymupdf? Or is there a old version of pymupdf that I should install specifically instead of the latest one to get this to work?
To Reproduce
Run the example at https://github.com/mozman/ezdxf/blob/stable/examples/addons/drawing/pdf_export.py with the latest version of pymupdf installed (1.23.5), and see the error that pops up when get_pdf_bytes is called.
Expected behavior
The set_background method of the PyMuPDFRenderBackend should complete without error.
Describe the bug
When following the example for PDF generation with the drawing addon (specifically the example for PDF creation), I keep running into an error where PDF generation fails.
Specifically, the
get_pdf_bytesmethod call is where the function breaks down, with the trace going back toPyMuPdfRenderBackend.set_backgroundinezdxf/addons/drawing/pymupdf.py. That method fails because when it tries to runshape.drawRectit throwsAttributeError: 'Shape' object has no attribute 'drawRect'.Tracing where the shape object comes from, it looks like it uses the fitz module from pymupdf, and looking at the most recent pymupdf docs, it seems like the Shape class doesn't have a
drawRectmethod, but rather adraw_rectmethod. It makes me think that maybe that function name changed in pymupdf and the change hasn't been reflected in this codebase.Could this code be updated to match the new class definition in pymupdf? Or is there a old version of pymupdf that I should install specifically instead of the latest one to get this to work?
To Reproduce
Run the example at https://github.com/mozman/ezdxf/blob/stable/examples/addons/drawing/pdf_export.py with the latest version of pymupdf installed (1.23.5), and see the error that pops up when
get_pdf_bytesis called.Expected behavior
The
set_backgroundmethod of the PyMuPDFRenderBackend should complete without error.