change color changes path operator too

PDF-XChange Editor SDK for Developers

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
MiBa
User
Posts: 17
Joined: Fri Feb 19, 2016 1:30 pm

change color changes path operator too

Post by MiBa »

Hello everybody,

when I tested the color replacement with different pdf files. I found a weird problem. I one pdf I wanted to replace yellow by green but the color of the background changes too (see picture).

before
Image

after
Image

I investigated the pdf source code and found out that a "stroke path" (Path Painting Operator 'S') is replaced by "fill then stroke path" (Path Painting Operator 'B').

Is this a bug in the SDK or is something wrong in my code?
I attached a sample project (VS2013/C#) if somebody want to reproduce this behaviour.

Thanks for your comments
You do not have the required permissions to view the files attached to this post.
Sasha - PDF-XChange
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: change color changes path operator too

Post by Sasha - PDF-XChange »

Hello MiBa,

This piece of code is wrong

Code: Select all

cState.FillColor[ColorType.ColorType_CMYK].GetCMYK(out c, out m, out y, out k);
You've done the same mistake again, as I previously described here:
https://forum.pdf-xchange.com/ ... 66&t=25276

HTH,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
MiBa
User
Posts: 17
Joined: Fri Feb 19, 2016 1:30 pm

Re: change color changes path operator too

Post by MiBa »

Hi Alex,

your right. Now I get the cmyk values by "GetComponents()" but this doesn't fix my Problem. After the color conversion one path operator has changed.

Thanks for your support
Michael
Sasha - PDF-XChange
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: change color changes path operator too

Post by Sasha - PDF-XChange »

Hello MiBa,

Can you post the updated code part so that i can check that?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
MiBa
User
Posts: 17
Joined: Fri Feb 19, 2016 1:30 pm

Re: change color changes path operator too

Post by MiBa »

Hi Alex,

attached is my sample project (VS2013 / C#). It shows a simple menu. With "Load" you can load the sample pdf and with "Change color" the yellow parts should be changed to green. unfortunately the white background becomes green too.

Thank you for your support

Michael
You do not have the required permissions to view the files attached to this post.
Sasha - PDF-XChange
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: change color changes path operator too

Post by Sasha - PDF-XChange »

Hello MiBa,

I've updated your ChangeColorOnPage method:
https://gist.github.com/Polaringu/20070f9d7ecb3810d5d6

HTH,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ