0

This question featured a PDF where the heading and background colors had different CMYK values, but what if they had the same CMYK values? Then how can I change only the background color, withotu affecting the headings' and subheadings' colors?

1

There is no answer to your question series. The methods you have been proposed just happen to work because of circumstances. Ultimately you have to consider what the data model is.

First, theres no such thing as background color. That's not how a PDF works. There are just objects that have stroke color, a fill color or both. Now it so happens that text is generally a special text object type. So it is easy to distinguish when a color is applied to text. However, not all text like things are necessarily text objects. One can decompose text into normal beerier paths, which would be bulk of all other objects.

So the easiest, slightly more robust detection method would be to use the area of path objects, that have fill, to determine if they are backgrounds or not. Possibly that they are square, or not too.

But ultimately what you ask can not be automatically detected in a general sense, since there is a chance that this would eliminate figures. There simply is no such thing as a background.

  • 1
    I agree with all said before, but also would like to add that every time you ask for something, please also add PDF file so it would be much easier to understand particular case. – mrserge Jan 27 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.