Page 1 of 1

Options for PDF highlight shape

Posted: Thu Jun 20, 2024 11:35 am
by somelinguist
Hi. Is there any way to change the shape of highlights created in PDFs with Bookends for iOS so that the start and end of the highlight are rectangular instead of rounded?

Re: Options for PDF highlight shape

Posted: Fri Jun 21, 2024 3:57 am
by Serge
The PDF features in Bookends for iOS is powered by a third-party engine called PSPDFKit.
Please read this forum post.

Re: Options for PDF highlight shape

Posted: Mon Jun 24, 2024 10:41 pm
by somelinguist
Thanks! I've reached out to them. We'll see how it goes.

Re: Options for PDF highlight shape

Posted: Mon Aug 26, 2024 11:55 am
by somelinguist
Hi again,

When I contacted PSPDFKit, it sounds like the default toolbar buttons are hard coded to calculate rounded rectangles for highlights for some reason. I checked, and highlights created programmatically apart from the default buttons are actually already rectangular. For whatever reason, they've decided that the default toolbar button should make rounds ones, even though the behavior makes it inconsistent with creating highlights from other parts of the app.

They recommended basically creating a new toolbar button in which you can specify your desired settings, which could also follow the other normal presets. That button could be used in place of the default one.

They provided links to the following articles:

https://pspdfkit.com/guides/ios/annotat ... e-behavior
https://pspdfkit.com/guides/ios/annotat ... notations/

And a link to example source code:
https://github.com/PSPDFKit/pspdfkit-io ... mple.swift

At one point they made it sound like you could override highlighting shape by listening for for the notification of creation of the annotations, then update the bounding box to tightly enclose the rects for highlights (https://pspdfkit.com/guides/ios/annotat ... e-changed/). But it wasn't clear if this would work using the default toolbar buttons.

Re: Options for PDF highlight shape

Posted: Thu Aug 29, 2024 5:39 am
by Serge
Thanks for the detailed follow-up.
PSPDFKit is a well-configured framework, but we're trying to stick to its default behavior. Since it's a big and complex tool, supporting too specific requests like this in our project could cause some problems that we want to avoid.

Re: Options for PDF highlight shape

Posted: Fri Aug 30, 2024 11:21 am
by somelinguist
Thanks! Yeah it seems a bit overly complex. I had been hoping that it could have been something they could have added to their configurable defaults.

I tried playing around with their code samples and was surprised that the rounded highlights are only added by their default buttons. If an app adds highlights in any custom way, they don't get rounded corners unless the app code goes out of the way to calculate them.

On the other hand, their default buttons respect several of their other configurable defaults which also get used by default when creating highlights with code. So it's strange and inconsistent :)

They seemed interested in the feedback, but it didn't necessarily sound like anything that might change soon. We'll see.

Re: Options for PDF highlight shape

Posted: Tue Sep 10, 2024 10:09 am
by somelinguist
Well pointing out the inconsistency when I contacted them might have been helpful after all. The latest TestFlight version of their own PDF Viewer (2024.11) has this note: " Removes the curved edges on text highlights". I checked and using their buttons no longer creates rounded/curved edges.

I guess we'll see if this makes it into future versions of PSPDFKit as well. :)

Re: Options for PDF highlight shape

Posted: Wed Sep 11, 2024 10:07 am
by Serge
That's great! Hopefully, we'll see it included in the next major release of PSPDFKit soon.