# Can I somehow change the height of a text selection

**URL:** <https://pdfjs.community/t/can-i-somehow-change-the-height-of-a-text-selection/1804>\
**Category:** Technical Support\
**Tags:** pdfjs-express\
**Created:** [June 22, 2022, 1:58pm UTC](https://pdfjs.community/t/can-i-somehow-change-the-height-of-a-text-selection/1804 "2022-06-22T13:58:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbezdushniak](https://avatars.discourse-cdn.com/v4/letter/d/b77776/32.png) [@dbezdushniak](https://pdfjs.community/u/dbezdushniak)\
**Post date:** [June 22, 2022, 1:58pm UTC](https://pdfjs.community/t/can-i-somehow-change-the-height-of-a-text-selection/1804/1 "2022-06-22T13:58:18Z")

</div>

**Which product are you using?**  
PDF.js Express Viewer

**PDF.js Express Version**  
8.2.0

**Detailed description of issue**  
We have two types of annotations on the project.  
The first one generated by service by analyzing the pdf, and the second one is created on UI (we use quads from textSelected event for new annotation creating). Annotations that created on UI have different sizes than those that created by the service. We want to normalize them. We want to use the same algorithm on service and UI for annotation creation to generate as similar annotation sizes as possible.

And the question:  
Can I somehow change the size of text selection?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/ffbcd25c7d423db8d5acd5db201c272f4db306dd.png) [@system](https://pdfjs.community/u/system)\
**Post date:** [June 22, 2022, 1:58pm UTC](https://pdfjs.community/t/can-i-somehow-change-the-height-of-a-text-selection/1804/3 "2022-06-22T13:58:25Z")

</div>

**Hello, I’m Ron, an automated tech support bot 🤖**

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:
- [Real-time collaboration client](https://pdfjs.express/documentation/collaboration/realtime-collaboration-client.8)
- [PDF.js Express annotations](https://pdfjs.express/documentation/annotation/overview)
- [PDF.js Express Documentation - Annotation](https://pdfjs.express/documentation#annotation-<span-class='plus'></span>)

APIs:
- [Core.Annotations.TextStrikeoutAnnotation - new TextStrikeoutAnnotation( [initializer])](https://pdfjs.express/api/Core.Annotations.TextStrikeoutAnnotation.html#TextStrikeoutAnnotation__anchor)
- [Core.Annotations.CustomAnnotation - new CustomAnnotation(type [, initializer])](https://pdfjs.express/api/Core.Annotations.CustomAnnotation.html#CustomAnnotation__anchor)
- [Core.Tools.Tool - new Tool(docViewer)](https://pdfjs.express/api/Core.Tools.Tool.html#Tool__anchor)

Forums:
- [Old data to be extract from XFDF file and to store in firebase | Real Time Collaboration](https://pdfjs.community/t/old-data-to-be-extract-from-xfdf-file-and-to-store-in-firebase-real-time-collaboration/1184/1)
- [Is it possible to manipulate the annotation coordinates of a drawn annotations while modifying it?](https://pdfjs.community/t/is-it-possible-to-manipulate-the-annotation-coordinates-of-a-drawn-annotations-while-modifying-it/259/1)
- [PDF is displayed without previous annotations](https://pdfjs.community/t/pdf-is-displayed-without-previous-annotations/1738/1)

---

<div class="post-metadata">

**Author:** ![kkim](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kkim](https://pdfjs.community/u/kkim)\
**Post date:** [June 22, 2022, 9:48pm UTC](https://pdfjs.community/t/can-i-somehow-change-the-height-of-a-text-selection/1804/4 "2022-06-22T21:48:32Z")

</div>

Hello dbezdushniak,

For the UI, you can create your own custom text Selection tool following this guide: [Core Engine for JavaScript PDF Viewer | PDF.js Express SDK](https://pdfjs.express/documentation/ui-customization/core#creating-your-own-ui-using-webviewer-core)

This file may be of relevance in setting the quads:

> <https://github.com/PDFTron/webviewer-ui/blob/8.6/src/helpers/createTextAnnotationAndSelect.js>

For text selection outline, you can use the TextSelectionModel class to modify:  
[https://pdfjs.express/api/Core.Annotations.TextSelectionModel.html](https://pdfjs.express/api/Core.Annotations.TextSelectionModel.html)  
and getDimensions method may also be relevant:  
[https://www.pdftron.com/api/web/Core.Annotations.TextSelectionModel.html#TextSelectionModel](https://www.pdftron.com/api/web/Core.Annotations.TextSelectionModel.html#TextSelectionModel)

Best Regards,  
Kevin Kim  
Web Development Support Engineer  
PDFTron Systems, Inc.  
[www.pdftron.com](http://www.pdftron.com/)

---

<div class="post-metadata">

**Author:** ![dbezdushniak](https://avatars.discourse-cdn.com/v4/letter/d/b77776/32.png) [@dbezdushniak](https://pdfjs.community/u/dbezdushniak)\
**Post date:** [June 27, 2022, 10:00am UTC](https://pdfjs.community/t/can-i-somehow-change-the-height-of-a-text-selection/1804/5 "2022-06-27T10:00:11Z")

</div>

Kevin, thanks for the direction in solving that. It helped me
