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?

3 Answers 3


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.

  • 1
    Thanks, looks very useful! I tried to assemble the instructions to compile an Okular build that work to a similar question needing an Okular tweaking (feel free to update!): superuser.com/questions/673917/… . Okular developers have pretty comperehensive guidelines here, that may provide a relatively quick route: okular.kde.org/download.php. Step-by-step, compiling may be ok difficulty also for newbies. Consider posting the code as a git branch of Okular for increased accessiblity.
    – puslet88
    Feb 9, 2016 at 14:21
  • Sorry for late response... I download okular source code, comment the if stament and it content and then build okular following the the kde guide, but this not work. I still have border color when I add Inline Note...
    – gvd
    Feb 16, 2016 at 5:57
  • @user2547450 Sorry for my delayed response, heh. Are you sure you're running the version you built rather than the stock one that came with your system? If you change the Qt::black to another of the predefined colors, does anything happen?
    – Ben N
    Feb 22, 2016 at 2:00
  • Yes I'm sure. I have install okular 0.20.2 and I build 0.24.60. I used borderWidth = 0 but doesn't work and I also used Qt::white and still show black border.
    – gvd
    Mar 4, 2016 at 2:30
  • @user2547450 Does the change affect the appearance of any other annotation? What happens if you insert continue; before line 694? Inline notes should then not be rendered at all.
    – Ben N
    Mar 5, 2016 at 0:18

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.


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)

  • The question is about border, not about background color.
    – Étienne
    Sep 25, 2022 at 13:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .