6

Inline Note annotations in Okular (the default PDF reader for the KDE desktop) only allow me to modify the highlight color by default, but I want to modify the border color of those annotations too.

How can I modify the border color of Okular annotations or simply remove the border?

Ben N
  • 42,308
gvd
  • 193

3 Answers3

5

The border color is hardcoded as Qt::black. Therefore, if you want to change the color, you'll need to get the source, modify it, and recompile Okular. Look in pagepainter.cpp starting on line 711 (comment mine):

if ( borderWidth != 0 )
{
    QPen pen( Qt::black, borderWidth ); // The first argument is the important part
    painter.setPen( pen );
    painter.drawRect( 0, 0, image.width() - 1, image.height() - 1 );
}

If you want to remove the border, you can just delete the above if statement and its contents. If you want a different color, you can replace Qt::black with another one of the twenty predefined colors. To get any color, replace that constant with a call to QColor::fromRgb. For example, QColor::fromRgb(239, 228, 176, 255) is a kind of dingy yellow.

Recompiling applications is a little out of scope here, and a full explanation would be a tome. Here are some reference documents from KDE TechBase, though they may be a little out of date:

I wish there was another way, and I would welcome a simpler answer.

Ben N
  • 42,308
1

There are two problems with inline note annotations in Okular :

  1. Annotations are not saved within the PDF, but written separately, which makes them awkward to communicate and unusable with any other reader.
  2. As noted by @BenN, border colors are hardwired in black.

One solution might be to use another PDF editor that is more customizable. Unfortunately, I cannot find such an editor in Linux, so one has to use a Windows editor, which is entirely possible on Linux by using Wine which adds a native Windows-on-Linux layer (with the logo of "Wine Is Not an Emulator").

The recommended editor is PDF-XChange Viewer. One can use the portable version, but the installer is also said to work under Wine. PDF-XChange Viewer is reported as fully functional under Wine.

PDF-XChange Viewer has several flavors of annotations, called by it comments & markup, which can be customized for border and background colors : Sticky Note, Typewriter, Text Box, Callout; and includes as well the ability to highlight text, cross out text and underline text. All are fully customizable, and the PDF file is updated to contain them as viewable by any other PDF viewer.

harrymc
  • 498,455
-1

Although it has been dated since the OP asked the question, this answer maybe helpful for others:

It is now possible to change the background color of inline notes of Okular by right-click on the inline notes after typing the notes and choose properties. (https://docs.kde.org/stable5/en/okular/okular/annotations.html)