@acctecnologiaca
To stamp an image on a PDF using the Aspose.PDF Cloud API, you need to ensure that you are correctly specifying the parameters in your JSON body. Based on your provided code, it seems that you might be missing some key parameters that define the size and position of the stamp.
Here’s a sample JSON body that you can use to stamp an image on a PDF:
[
{
"Background": true,
"HorizontalAlignment": "Center",
"Opacity": 1.0,
"Rotate": "None",
"RotateAngle": 0,
"XIndent": 100,
"YIndent": 100,
"Zoom": 1,
"FileName": "/FacturaA4.jpeg",
"Width": 200,
"Height": 100,
"VerticalAlignment": "Center",
"BottomMargin": 0,
"LeftMargin": 0,
"TopMargin": 0,
"RightMargin": 0
}
]
Key Points:
- FileName: Ensure that the image file path is correct and that the image is uploaded to the server.
- Width and Height: Set these parameters to define the size of the stamp. If they are set to 0, the stamp may not appear as expected.
- XIndent and YIndent: These parameters determine the position of the stamp on the page. Adjust them according to where you want the stamp to appear.
- Zoom: This parameter can be used to scale the image stamp.
Example Code:
Here’s an example of how you might implement this in your application:
var imageStamp = new ImageStamp
{
Background = true,
FileName = "/FacturaA4.jpeg",
Width = 200,
Height = 100,
XIndent = 100,
YIndent = 100,
Opacity = 1.0,
Rotate = Rotation.None
};
var response = PdfApi.PostPageImageStamps("YourPdfFileName.pdf", pageNumber, new List<ImageStamp> { imageStamp }, folder: "YourFolderName");
Make sure to replace "YourPdfFileName.pdf"
and "YourFolderName"
with your actual PDF file name and folder name.
If you continue to experience issues, double-check the image file path and ensure that the image is correctly uploaded to the server before attempting to stamp it on the PDF.
Feel free to reach out if you have any further questions or need additional assistance!