Stamp.SetOrigin has no effect

In my project, I am using the Stamp.SetOrigin() function (binding to a PDF document) as described here:

[www.aspose.com/Products/Aspose.Pdf.Kit/Api/Aspose.Pdf.Kit.PdfFileStamp.AddStamp.html ](http://www.aspose.com/Products/Aspose.Pdf.Kit/Api/Aspose.Pdf.Kit.PdfFileStamp.AddStamp.html)

What I discovered is that the function does not soever has any effect on the origin of the stamp on the PDF document.

No matter whether I e.g. call Stamp.SetOrigin(1,1) or Stamp.SetOrigin(200,400) , the stamp is always put at the top of the page.

Question: Is this like a fault of myself, or is this possibly a bug with stamping one PDF with another PDF?

Thanks
Uwe

Hi,

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.

Thanks.

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 );

Aspose.Pdf.Kit.Stamp stamp = new Aspose.Pdf.Kit.Stamp();
stamp.BindPdf( pdfStream, 1 );
stamp.IsBackground = false;

stamp.Rotation = 0;

// Here, try to position the PDF-stamp on the destination page.
// This method currently has no effect.
stamp.SetOrigin(
(float)stampPositionX,
(float)stampPositionY );


// –

string outputPdfFilePath =
Path.Combine(
Path.GetTempPath(),
Guid.NewGuid() + @".pdf" );

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?

Thanks
Uwe

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.

Hi,

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.