Options for PDF highlight shape
-
- Posts: 29
- Joined: Mon Apr 10, 2023 12:41 pm
Options for PDF highlight shape
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
The PDF features in Bookends for iOS is powered by a third-party engine called PSPDFKit.
Please read this forum post.
Please read this forum post.
-
- Posts: 29
- Joined: Mon Apr 10, 2023 12:41 pm
Re: Options for PDF highlight shape
Thanks! I've reached out to them. We'll see how it goes.
-
- Posts: 29
- Joined: Mon Apr 10, 2023 12:41 pm
Re: Options for PDF highlight shape
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.
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
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.
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.
-
- Posts: 29
- Joined: Mon Apr 10, 2023 12:41 pm
Re: Options for PDF highlight shape
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.
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.
-
- Posts: 29
- Joined: Mon Apr 10, 2023 12:41 pm
Re: Options for PDF highlight shape
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.
I guess we'll see if this makes it into future versions of PSPDFKit as well.
Re: Options for PDF highlight shape
That's great! Hopefully, we'll see it included in the next major release of PSPDFKit soon.