# Issue With Saved Custom Stamps With White Text

**URL:** <https://pdfjs.community/t/issue-with-saved-custom-stamps-with-white-text/3650>\
**Category:** Technical Support\
**Created:** [March 24, 2025, 5:52pm UTC](https://pdfjs.community/t/issue-with-saved-custom-stamps-with-white-text/3650 "2025-03-24T17:52:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomc](https://avatars.discourse-cdn.com/v4/letter/t/8dc957/32.png) [@tomc](https://pdfjs.community/u/tomc)\
**Post date:** [March 24, 2025, 5:52pm UTC](https://pdfjs.community/t/issue-with-saved-custom-stamps-with-white-text/3650/1 "2025-03-24T17:52:29Z")

</div>

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

**PDF.js Express Version**  
UI Version = 8.7.0  
Core version = 8.7.5

**Detailed description of issue**  
I am trying to store custom rubber stamps on a database as a string to use them again at a later time. When I use the string to populate the custom stamp drop down, entries that were saved with white text are missing the text. This doesn’t appear to be the case with the stamps with black text.

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/d/d148d77e9e95c1f7b394e608913d81a2bc139bff.png)

**Expected behaviour**  
I expect to see the white text on the stamp.

**Does your issue happen with every document, or just one?**  
Every document

**Link to document**  
N/A

**Code snippet**

```js
const stampTool = instance.Core.documentViewer.getTool('AnnotationCreateRubberStamp');

function saveStamps() {
    const customStamps = stampTool.getCustomStamps();
    const deepClonedSignatures = JSON.parse(JSON.stringify(customStamps));
    const valToSend = JSON.stringify(deepClonedSignatures);
    saveStampsToDatabase(valToSend);
}

function setCustomStamps() {
    const parsedString = JSON.parse(getStampsFromDatabase());
    stampTool.setCustomStamps(parsedString);
}

```

---

<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:** [March 24, 2025, 8:02pm UTC](https://pdfjs.community/t/issue-with-saved-custom-stamps-with-white-text/3650/3 "2025-03-24T20:02:37Z")

</div>

Hi there,

Could you verify the parsedString before using the setCustomStamps API? I can use the 255, 255, 255 white text for custom stamps:

```javascript
const stampTool = instance.Core.documentViewer.getTool('AnnotationCreateRubberStamp');
const parsedString = [{ "title": "Sample Text", "subtitle": "DD-MM-YYYY", "color": Core.Annotations.Color(255,255,255) }]
stampTool.setCustomStamps(parsedString);

```

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/8/8ba8c26b5b9b391da9114d30afa214894d6e3d67.png)

best regards,  
kevin

---

<div class="post-metadata">

**Author:** ![tomc](https://avatars.discourse-cdn.com/v4/letter/t/8dc957/32.png) [@tomc](https://pdfjs.community/u/tomc)\
**Post date:** [March 25, 2025, 11:19am UTC](https://pdfjs.community/t/issue-with-saved-custom-stamps-with-white-text/3650/4 "2025-03-25T11:19:01Z")

</div>

Could this be an issue with `stampTool.getCustomStamps()`?

When I checked the array that was being returned it had a different structure. I received a textColor object that contains RGBA values. When I tried the demo app using this I saw the same problem.

```js
[{"title":"Draft","subtitle":"[$currentUser] DD/MM/YYYY h:mm A","id":"","font":"Helvetica","bold":true,"italic":false,"underline":false,"strikeout":false,"textColor":{"R":255,"G":255,"B":255,"A":1}},{"title":"Draft","subtitle":"[$currentUser] DD/MM/YYYY h:mm A","color":"#D65656","id":"","font":"Helvetica","bold":true,"italic":false,"underline":false,"strikeout":false,"textColor":{"R":255,"G":255,"B":255,"A":1}},{"title":"Draft","subtitle":"[$currentUser] DD/MM/YYYY h:mm A","id":"","font":"Helvetica","bold":true,"italic":false,"underline":false,"strikeout":false,"textColor":"#000000"}]

```

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/4/43a9162f1feed20549aae86296fd613823c37901.png)

When I changed the textColor item to a hexadecimal string then it worked.

```js
[{"title":"Draft","subtitle":"[$currentUser] DD/MM/YYYY h:mm A","id":"b0bda7b8-cd6a-2d06-55d5-ffec68eaf55a","font":"Helvetica","bold":true,"italic":false,"underline":false,"strikeout":false,"textColor":"#FFFFFF"},{"title":"Draft","subtitle":"[$currentUser] DD/MM/YYYY h:mm A","color":"#D65656","id":"5a547608-b2eb-20e3-b780-8ed2ff114646","font":"Helvetica","bold":true,"italic":false,"underline":false,"strikeout":false,"textColor":"#FFFFFF"},{"title":"Draft","subtitle":"[$currentUser] DD/MM/YYYY h:mm A","id":"84df5c10-f215-4a51-541e-90800789307e","font":"Helvetica","bold":true,"italic":false,"underline":false,"strikeout":false,"textColor":"#000000"}]

```

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/7/7528a81c5b8c7803d88dc620a133ea2f7e2cf8ea.png)

Is there a setting that I can change to receive hexadecimal values for colours from `stampTool.getCustomStamps()`? Is there a different way I should approach this?

---

<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:** [March 25, 2025, 3:29pm UTC](https://pdfjs.community/t/issue-with-saved-custom-stamps-with-white-text/3650/5 "2025-03-25T15:29:02Z")

</div>

Hi there,

If I create a custom stamp with white text, save it with getCustomStamps and then delete it from the UI, I can use setCustomStamps API and see the stamp added back with the white text so there shouldn’t be an issue there.

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/8/89a5522688cdb81a083dfa2ab045545976e363b9.png)  
The textColor property for the stamp has #FFFFFF

The color can also be derived from our Color class via Core.Annotations.Color:

> **[PDFJS Express WebViewer Class: Color](https://pdfjs.express/api/Core.Annotations.Color.html)**

You can use the toHexString() API in that class to convert to a hex string as an alternative.

best regards,  
Kevin
