Hi Team,
I am using ASPOSE PDF stamp function to stamp the pages in the PDF document with a PNG image.
It is working fine if the stamp position is same for all the pages. Since in our case PDF is having pages of different size hence the position is also different. So we are looping through each page to calculate the page size and the stamp position.
If we call AddStamp function for each page then the output is very large with respect to original file.
The Input file detail:
Size: 96MB
Pages: 1922
Output File Detail:
Size: 450 MB
Pages: 1922
If AddStamp is called once for all pages the file size remains same with KB more in size.
Kindly let us know why the file size is increased so much as the stamp image size is 21KB only.
Also Please suggest the best way to stamp pages with different stamp position depending on the page dimension.
Would you please share narrowed down code snippets along with respective files via Google Drive, Dropbox etc. so that we may try to reproduce and investigate it in our environment to help you out.
Following is the Code Snippets we are currently using in our application:
int x = Convert.ToInt32(ConfigurationManager.AppSettings[“CourtStampPositionX”]);
int y = Convert.ToInt32(ConfigurationManager.AppSettings[“CourtStampPositionY”]);
Document pdfDocument = new Document(mergedPdf);
PdfFileStamp fileStamp = new PdfFileStamp(pdfDocument);
FileStream imageStream = new FileStream(imgPath, FileMode.Open);
Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp();
stamp.BindImage(imageStream);
stamp.SetImageSize(50.0f, 50.0f);
stamp.IsBackground = false;
PdfFileInfo pdfFileInfo = new PdfFileInfo(pdfDocument);
int noofpage = pdfFileInfo.NumberOfPages;
for (int i = 1; i <= noofpage; i++) {
var pageWidth = pdfFileInfo.GetPageWidth(i) - x;
var pageHeight = pdfFileInfo.GetPageHeight(i) - y;
stamp.SetOrigin(pageWidth, pageHeight);
stamp.Pages = new int[] { i };
fileStamp.AddStamp(stamp);
}
imageStream.Close();
pdfDocument.Save(mergedPdf);
Would you please also share the code snippet where you are calling AddStamp method once for all the pages, so that we may proceed to investigate and help you out.
As I shared code snippet with you in for loop we are calling AddStamp method as per our requirement we need to stamp in every page at specific location according to page size.
What is the ETA for the closure of the issue? Is there any process to move this to critical or severity A issue as
this issue is impacting our business.
With paid support you may report your issues at Paid Support Helpdesk. In case you have already reported a problem which has been logged in our issue management system, then you can also request to raise priority of such issues over HelpDesk as per your requirements.