We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Add Image Stamp to a PDF at particular location using C# Aspose.PDF for .NET

Hello
I have barcode images which I used Aspose Barcode to produce which I would like to add to the bottom of each pdf page. I used the following code to do it.

System.Drawing.Image image = System.Drawing.Image.FromStream(new System.IO.MemoryStream(imgStream.ToArray()));

pageLocation.URX = pageLocation.LLX + image.Width;
PDFPage.AddImage(imgStream, pageLocation)

where pageLocation is the {PDF rectangle object defined by LLX,LLY, URX, URY coordinates

I would like to adjust dynamically the width of the pdf rectangle to match the width of the image width dimension. and I am not able to do it.
An attached screen shot shows what resulted.
The image width dimension is 926x58 pixels.
so when I added 926 to the rectangle LLX coordinate to set the URX, I am over 1000, resulting in it just shoots right off the page.

Is the URX coordinate of the rectangle in pixel ?
How do I make adjustment so I can accomplish this ?
Thank you.

aspose1.jpg (73.1 KB)
TotalPage10.png (231 Bytes)

@nick1234

Thank you for contacting support.

Please note that the basic measuring unit in Aspose.PDF for .NET is point, where 1 inch = 72 points and 1 cm = 1/2.54 inch = 0.3937 inch = 28.3 points. Moreover, you may set the width of the page with page.PageInfo.Width property as per your requirements. For adding an image at specific location, you may Add Image Stamp which exposes different properties to control position and dimensions.

We hope this will be helpful. Please feel free to contact us if you need any further assistance.