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
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
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.
@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:
Add the iTextSharp .NET package to your project.
Import these namespaces:
iTextSharp.textiTextSharp.text.pdfSystem.IOI’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.pdf (4.8 KB)
performance_table_like_image.pdf (3.3 KB)
StringToImage.xaml (13.9 KB)