Skip to main content
New Participant
November 2, 2023
Question

Convert a PDF with hyperlinks to grayscale

  • November 2, 2023
  • 2 replies
  • 1316 views

I have a PDF (generated by LaTeX by someone who is not me) with a lot of internal hyperlinks. When I open this PDF on a computer or tablet, the hyperlinks have a colored outline, and when I print the PDF, the colored outlines (correctly) vanish.

 

I want to convert the entire document, including the link highlights, to grayscale—I don't want any color at all in the document. But I am not doing this to print the document—I still want the hyperlinks to work.

 

If I follow the usual convert to grayscale instructions (if I open the file in Adobe Acrobat and then go to Compress a PDF/Preflight/Prepress, Color and Transparency/Convert Colors/Convert to Grayscale), images do indeed convert to grayscale, but all of the internal hyperlinks are still highlighted in color.

 

If I instead go to Compress a PDF/Preflight/Prepress, Color and Transparency/Digital Printing and Online Publishing/Digital Printing (B/W)), the colored links vanish—because Acrobat has helpfully disabled all of the useful internal hyperlinks and I can't use them any more.

 

Is there any way to disable the hyperlink highlighting, or change the highlight color to grayscale, without deactivating the links entirely?

 

(If anyone's curious, my use case is annotation: I want to write a lot of comments on the document, in red, on my tablet. So I want to reserve colors for annotations; having a bunch of colored links is distracting. But I also want to navigate the document so I want the links to be there, just more unobtrusive.)

This topic has been closed for replies.

2 replies

try67
Community Expert
November 2, 2023

Set all links' border color to gray with this code:

 

for (var p=0; p<this.numPages; p++) {
	var box = this.getPageBox("Crop", p);
	var links = this.getLinks(p, box);
	if (links==null || links.length==0) continue;
	for (var i in links) {
		links[i].borderColor = ["G", 0.5];
	}
}

 

To hide the border replace this line:

links[i].borderColor = ["G", 0.5];

With:

links[i].borderWidth=0;

New Participant
November 2, 2023

Is there somewhere in Acrobat Pro where I can paste this code? Or is it a Terminal command (I'm on Mac)? What do I do with this?

try67
Community Expert
November 2, 2023

You can rut it from a Custom Command, an Action (in the Action Wizard) or the JS Console.

JR Boulay
Community Expert
November 2, 2023

Can you share a few pages of this document?

Acrobate du PDF, InDesigner et Photoshopographe