These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Convert Colored Text to Black

srprice
Registered: Sep 19 2007
Posts: 138

I'm trying to find a way to batch convert colored text in a PDF to black text. I have checked the preflight fix-up options but it just turns my colored text gray. I tried the print colors as black option but if I have a grayscale image in my PDF then it turns into a black blob.
 
Can someone point me in the right direction? Is there some type of javascript method I could use?
 
Thanks in advance for your help.
 
scopley

My Product Information:
Acrobat Pro 9.4.3, Windows
oald
Registered: Oct 12 2011
Posts: 17
I have the same question with you, I'm looking for resolution for weeks with no answer yet. Today I read Thom Parker's article "What's New with Acrobat 8 JavaScript?" (http://acrobatusers.com/tutorials/whats-new-acrobat-8-javascript) and there is a paragraph about the method colorConvertPage:

"Acrobat 8.0 has three new power features, page content color conversion, booklet printing and the Net Object. A power feature is one that does a lot with very little code and the first one on the list is a good example. The Doc Object has a new function called colorConvertPage(). This amazing function converts the colorspaces for every element drawn on a PDF page; images, text and paths. For example, say you need to convert to CMYK before sending your document out for printing. With this function you can convert not just to CMYK, but to any of several color profiles available on your system. Acrobat ships with several well-known, industry-wide color profiles. Of course, colorspace conversion can be done with the Preflight Tool and the Touchup Object Tool, but this capability allows color-space conversion to be part of an automation or workflow script."

I also refer to the JS API reference, and there is an example for the method colorConvertPage, which converts color profile to RGB, I wonder if there is a way to convert the color space to Gray ('G") and set the color for all text to color.black (["G",0]), let's waiting for an excellent answer together!


Example
Get a colorConvertAction object, set it up to convert everything to RGB. (Note that we do not convert any alternate spaces, hence the “space type” match is for anything but alternate spaces.)

// Get a color convert action
var toRGB = this.getColorConvertAction();
// Set up the action for a conversion to RGB
toRGB.matchAttributesAny = -1;
toRGB.matchSpaceTypeAny = ~toRGB.constants.spaceFlags.AlternateSpace;
toRGB.matchIntent = toRGB.constants.renderingIntents.Any;
toRGB.convertProfile = "Apple RGB";
toRGB.convertIntent = toRGB.constants.renderingIntents.Document;
toRGB.embed = true;
toRGB.preserveBlack = false;
toRGB.useBlackPointCompensation = true;
toRGB.action = toRGB.constants.actions.Convert;
// Convert the first page of the document
var result = this.colorConvertPage(0,[toRGB],[]);


srprice
Registered: Sep 19 2007
Posts: 138
Thanks for your response. I was unable to get the javascript to work like I wanted. I needed the color to be 100% black and all I could achieve was gray. I was able to accomplish what I needed though preflight fixups. Thanks again.