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

There is a color difference in the non_stroking_color #1043

Open
KaboChow opened this issue Sep 29, 2024 · 2 comments
Open

There is a color difference in the non_stroking_color #1043

KaboChow opened this issue Sep 29, 2024 · 2 comments

Comments

@KaboChow
Copy link

KaboChow commented Sep 29, 2024

Hi Team,
I am trying to use the following JS code to convert the obtained non_stoking.color into RGB color for use in HTML.
`

            if(fillColor.length===1){
                return 'rgb(' + (255*(1.0-fillColor[0])).toFixed(0) + ')';
            }
            
            if(fillColor.length===3){
                const r = 255 * fillColor[0];
                const g = 255 * fillColor[1];
                const b = 255 * fillColor[2];
                return 'rgb(' + r.toFixed(0) + ',' + g.toFixed(0) +',' + b.toFixed(0) + ')';
            }
           
            if(fillColor.length===4){
                const r = 255*(1.0-(fillColor[0]+fillColor[3]));
                const g = 255*(1.0-(fillColor[1]+fillColor[3]));
                const b = 255*(1.0-(fillColor[2]+fillColor[3]));
                return 'rgb(' + r.toFixed(0) + ',' + g.toFixed(0) +',' + b.toFixed(0) + ')';
            }

`

But there are obvious color differences in the obtained colors.
pdf:
image
html:
image

This is the PDF I used for testing:
TEST 5 - 48in-Height-Chef-Supplies-Banner-d4-ced6f345009972ad3e50309422be6654.pdf

Does anyone know how to solve it? thank you

@jollyfish-cjy
Copy link

hi, maybe you can try pymupdf.

@KaboChow
Copy link
Author

hi, maybe you can try pymupdf.

Thanks!@jollyfish-cjy
pymupdf looks like it has a lot more interesting features, I will give it a try

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

3 participants
@KaboChow @jollyfish-cjy and others