% SL Script to filter text by color in PDF % PStill 1.72.7+ needed to run % % You can define 'intercept' functions here: % interceptShow() - is called for each text processed % interceptFill() - is called for each fill processed % interceptStroke() - is called for each stroke processed % interceptImage() - is called for each image (mask) processed % % We are using only interceptShow here, for we are only interested in text for now define interceptShow() { variable colorspace; variable cyan, yellow, magenta, black; % logprint("Calling interceptShow\n"); % get the current colorspace, return values are % GRAY == 1 % RGB/HSB == 2 % CMYK == 3 % INDEXED == 4 % SPOT == 5 % PATTERN == 6 % DEVICEN == 7 colorspace = currentColorspace(); % logprintint(colorspace); % get the current color as CMYK (cyan,magenta,yellow,black) = currentCMYKColor(); if (colorspace < 4) { % we process only plain DEVICEGRAY,RGB and CMYK Colorspaces % INFO: uncomment next line for debug color output as CMYK % logprint(sprintf("%f %f %f %f",cyan,magenta,yellow,black,4)); % looking for a color of cyan 0 magenta 0.01 yellow 0.02 black 0.58 if ((black > 0.57 and black < 0.59) and (cyan == 0.0) and (magenta > 0.0 and magenta < 0.03) and (yellow > 0.01 and yellow < 0.03)) { % text in matching color, now convert to pure white setRGBColor(1.0,1.0,1.0); } } }