I have tested this with Aspose.Pdf.Kit 2.6.0.0 and have not been able to reproduce the error. Can you please post your complete code along with the output files that you obtained so that we can more accurately determine the cause of the problem.
Thank you. Following is an excerpt of the code I am using to stamp, two functions.
Function one:
// Stamps a given PDF file. private void StampPdf( string inputPdfFilePath, double stampPositionX, double stampPositionY ) { // Generate the stamp, see other function below. using ( MemoryStream pdfStream = new MemoryStream( GeneratePdfStamp() ) ) { pdfStream.Seek( 0, SeekOrigin.Begin );
// Here, try to position the PDF-stamp on the destination page. // This method currently has no effect. stamp.SetOrigin( (float)stampPositionX, (float)stampPositionY );
Aspose.Pdf.Kit.PdfFileStamp stamper = new Aspose.Pdf.Kit.PdfFileStamp( inputPdfFilePath, outputPdfFilePath );
stamper.AddStamp( stamp ); stamper.Close(); } }
And function two:
// Function to “inline”-generate the PDF document to later stamp // the PDF file with. private byte[] GeneratePdfStamp() { Aspose.Words.Document wordDoc = new Aspose.Words.Document(); Aspose.Words.DocumentBuilder wordDocBuilder = new Aspose.Words.DocumentBuilder( wordDoc ); wordDocBuilder.PageSetup.PaperSize = Aspose.Words.PaperSize.A4;
// Do fill the Word document by using the document builder. // This is a rather lengthy function, omitted here. CreateContent( wordDocBuilder );
// To Word, then to PDF. using ( MemoryStream wordStream = new MemoryStream() ) { wordDoc.Save( wordStream, Aspose.Words.SaveFormat.AsposePdf );
Aspose.Pdf.Pdf pdfDoc = new Aspose.Pdf.Pdf(); pdfDoc.BindXML( wordStream, null );
using ( MemoryStream pdfStream = new MemoryStream() ) { pdfDoc.Save( pdfStream ); pdfStream.Seek( 0, SeekOrigin.Begin );
return pdfStream.GetBuffer(); } } }
I highlighted the function in question that currently has no effect on the position of the stamp PDF on the destination PDF.
Any ideas what I do wrong here? Maybe the size of the stamp PDF being also A4, as the destination PDF?
Again, a versioning issue. After Aspose.Words, Aspose.Pdf and Aspose.Pdf.Kit to the latest versions, everthing works as expected.
I really do wonder why your libraries (as good as they are!) are so regression-prone. Approx. 50% of all issues are due to a feature that does not work (anymore, if ever) in one version.
I am glad that your problem has been resolved. Thank you for telling me the regression-prone problem. We will improve the QA greatly in the future versions.