Skip to content

PDF to SVG conversion. Colors are changed visually. #3648

Discussion options

You must be logged in to vote

Ah, no: PyMuPDF is out of the loop anyway, because all is done by MuPDF - which PyMuPDF simply invokes.
It appears that we have a conversion problem PDF <-> HTML colors. Your example color=(0.13669031858444214, 0.12195010483264923, 0.1252918243408203) for SVG is correctly converted into a HTML color: stroke="#231f20", see here:

b=(0.13669031858444214, 0.12195010483264923, 0.1252918243408203)
[hex(int(round(b[i]*255))) for i in range(3)]
['0x23', '0x1f', '0x20']

If you convert that back to PDF, the result is

[int(svgcolor[i], 16)/255 for i in range(3)]
[0.13725490196078433, 0.12156862745098039, 0.12549019607843137]

Which is not the exact same value as you extracted it, but still significan…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@serhii-brovarnyk
Comment options

@serhii-brovarnyk
Comment options

Comment options

You must be logged in to vote
1 reply
@serhii-brovarnyk
Comment options

Answer selected by serhii-brovarnyk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants