# Convert string as image

**URL:** <https://forum.uipath.com/t/convert-string-as-image/4952284>\
**Category:** Studio\
**Tags:** vbnet, image, question, studio\
**Created:** [August 25, 2025, 12:55pm UTC](https://forum.uipath.com/t/convert-string-as-image/4952284 "2025-08-25T12:55:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![suraj\_singh3](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/suraj_singh3/32/512839_2.png) [@suraj\_singh3](https://forum.uipath.com/u/suraj_singh3)\
**Post date:** [August 25, 2025, 12:55pm UTC](https://forum.uipath.com/t/convert-string-as-image/4952284/1 "2025-08-25T12:55:53Z")

</div>

Hi Team,

Had requirement where i had dynamic string need to convert to image and paste it to PDF at specific position?  
How can we achieve?

Thanks & regards  
Suraj

---

<div class="post-metadata">

**Author:** ![Mir.Jasimuddin](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/mir.jasimuddin/32/563617_2.png) [@Mir.Jasimuddin](https://forum.uipath.com/u/Mir.Jasimuddin)\
**Post date:** [August 25, 2025, 12:57pm UTC](https://forum.uipath.com/t/convert-string-as-image/4952284/2 "2025-08-25T12:57:14Z")

</div>

Hey @suraj_singh3,

Convert the string to an image using `System.Drawing.Bitmap` and `Graphics.DrawString`.  
Save the image as PNG and load the PDF using `PdfReader` and `PdfStamper`.  
Insert the image at specific position with `SetAbsolutePosition` and `AddImage`, then save the PDF.

---

<div class="post-metadata">

**Author:** ![suraj\_singh3](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/suraj_singh3/32/512839_2.png) [@suraj\_singh3](https://forum.uipath.com/u/suraj_singh3)\
**Post date:** [August 25, 2025, 12:58pm UTC](https://forum.uipath.com/t/convert-string-as-image/4952284/3 "2025-08-25T12:58:09Z")

</div>

HI @Mir.Jasimuddin,

can you provide me sample xaml.

thanks for the response.

---

<div class="post-metadata">

**Author:** ![manasrlenka25](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/manasrlenka25/32/542311_2.png) [@manasrlenka25](https://forum.uipath.com/u/manasrlenka25)\
**Post date:** [August 25, 2025, 4:08pm UTC](https://forum.uipath.com/t/convert-string-as-image/4952284/4 "2025-08-25T16:08:54Z")

</div>

@suraj_singh3  
UiPath doesn’t provide built-in activities to add images to PDFs, and the Marketplace packages only support **Legacy Projects**. To work around this, you can use **Invoke Code** with .NET to insert an image into a PDF.

Here’s how to do it:

1. Add the **iTextSharp**.NET package to your project.  

2. Import these namespaces:

- `iTextSharp.text`
- `iTextSharp.text.pdf`
- `System.IO`  
 ![image](https://global.discourse-cdn.com/uipath/original/4X/4/c/a/4caa3276263093b22d9cabff8ec0647723a08f62.png)

1. Use an **Invoke Code** activity to run the .NET code.

I’m sharing a sample .xaml file and Input files. You can adjust the image placement and size in the .NET code according to your requirements.

 ![image](https://global.discourse-cdn.com/uipath/original/4X/4/1/3/4132941b77e399133a8c0b76486ed6d711f032f7.png)

[image.pdf](https://forum.uipath.com/uploads/short-url/8439AKYuin8yYpMdO8ea58N9vic.pdf) (4.8 KB)  
[performance\_table\_like\_image.pdf](https://forum.uipath.com/uploads/short-url/k103WqrqXUR4p2KYj97XXsNgcd7.pdf) (3.3 KB)  
[StringToImage.xaml](https://forum.uipath.com/uploads/short-url/c51sLrqeE2Q7Mb1sD2W5ooCHtyS.xaml) (13.9 KB)

 ![TestImage](https://global.discourse-cdn.com/uipath/original/4X/e/7/1/e71f3a6a2c07dc8d4aec445372e06c86721ecedb.png)
