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

Free Support Forum - aspose.com

Stamp is landscape is not placed correctly

We have issues placing the stamp in PDF when the PDF was created as landscape orientation.

Below is code

var pdfDocument = new Aspose.Pdf.Document(inputFilePath);
var inputStream = File.OpenRead(inputStampPath);
var extension = Path.GetExtension(inputStampPath);
var stamp = new StampDetail();
stamp.XIndent= -46;
stamp.YIndent= 289;
stamp.Height= 600;
stamp.Width= 600;

		var reader = new StreamReader(inputStream);
		var text = reader.ReadToEnd();
		var template = DotLiquid.Template.Parse(text);
		var det = "[{\"Page\":\"1\",\"XIndent\":\"-46\",\"YIndent\":\"289\",\"Height\":\"600\",\"Width\":\"600\",\"Rotate\":\"270\"}]";
		var inputObject = new
		{
			Model = JsonConvert.DeserializeObject<ExpandoObject>(det)
		};
		var output = template.Render(DotLiquid.Hash.FromAnonymousObject(inputObject));
		var htmlFragment = new HtmlFragment(output);
		var floatingBox = new FloatingBox(stamp.Width, stamp.Height)
		{   
			Top = stamp.XIndent,
			Left = stamp.YIndent
		};
		floatingBox.Paragraphs.Insert(0, htmlFragment);
			pdfDocument.Pages[1].Paragraphs.Add(floatingBox);
	   
	pdfDocument.Save(path);

@appuelex

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input PDF and stamp files.
  • Please attach the output PDF file that shows the undesired behavior.
  • Please attach the expected output PDF file that shows the desired behavior.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Stamp-ConsoleApp (1).zip (5.0 MB)
Actual Result
For normal pdf the stamp is in the correct position but for the landscape pdf it in the wrong position.

Expected Result
want the stamp in the pages right corner for normal pdf as well as landscape pdf with a single absolute position

@appuelex

We have logged this problem in our issue tracking system as PDFNET-52605. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.