Skip to content

Drawing just one path for different elements #4369

Answered by JorjMcKie
AvivEsh asked this question in Q&A
Discussion options

You must be logged in to vote

I did it and ...

No, you did not!
Here is the code you should have used:

import pymupdf

doc = pymupdf.open()
page = doc.new_page()
shape = page.new_shape()
# make sure to always use the returned last point for starting the next draw
lp = shape.draw_rect(
    (302.15997314453125, 428.1600036621094, 302.5799865722656, 438.7799987792969)
)
lp = shape.draw_line(lp, (291.9599914550781, 428.1600036621094))
lp = shape.draw_line(lp, (292.0799865722656, 429.6600036621094))
lp = shape.draw_bezier(
    lp,
    (292.7049865722656, 434.39801025390625),
    (296.4010009765625, 437.9540100097656),
    (301.0799865722656, 438.7200012207031),
)
lp = shape.draw_line(lp, (302.5799865722656, 438.779998779…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@AvivEsh
Comment options

@JorjMcKie
Comment options

Answer selected by AvivEsh
@AvivEsh
Comment options

@JorjMcKie
Comment options

@JorjMcKie
Comment options

@AvivEsh
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants