PDF with multiple pages portrait and landscape

Hi

I try to add a stamp to each page But I cannot see the stamp in all pages with a PDF that contains both portrait and landscape format. I can see the stamp only on the first page. It seems that the origin is according to the first page only !

This is my code. Thanks a lot for your help !

private bool StampFile(string inFile, string outFile)

{

PdfFileInfo fileInfo = new PdfFileInfo (inFile);

int count = fileInfo.NumberofPages;

PdfFileStamp fileStamp = new PdfFileStamp (inFile, outFile);

for (int i = 1; i <= count; i++)

{

FormattedText ft = new FormattedText ("hello world !")

Stamp logoStamp = new Stamp ();

logoStamp.BindLogo (ft);

logoStamp.Rotation = 0;

logoStamp.Opacity = 1f;

logoStamp.Pages = new int[] { i };

logoStamp.SetOrigin ((fileInfo.GetPageWidth (i) - ft.TextWidth) / 2, fileInfo.GetPageHeight(i) - 50);

fileStamp.AddStamp (logoStamp);

}

fileStamp.Close ();

return true;

}


This message was posted using Page2Forum from Adding watermarks on different sized pages in a PDF - Aspose.Pdf.Kit for .NET and Java

Hello Daniel,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.

I have tested the issue and I’m able to reproduce the same problem. I have logged it in our issue tracking system as PDFKITNET-9149. We will investigate this issue in detail and will keep you updated on the status of a correction. We apologize for your inconvenience.

Hi,

Sorry for the inconvenience.

In fact, our kit supports to add stamps to each page though the size of each page is different. You can use the below code to test. We will modified our document to express it clearly.

PdfFileStamp fileStamp = new PdfFileStamp (inFile, outFile);

for (int i = 1; i <= count; i++)

{


FormattedText ft = new FormattedText("hello world !");

Stamp logoStamp = new Stamp ();

logoStamp.BindLogo (ft);

logoStamp.Rotation = 0;

logoStamp.Opacity = 1f;

//logoStamp.Pages = new int[] { i };
logoStamp.PageNumber = i;

logoStamp.SetOrigin ((fileInfo.GetPageWidth (i) - ft.TextWidth) / 2, fileInfo.GetPageHeight(i) - 50);


fileStamp.AddStamp (logoStamp);



}

fileStamp.Close ();

If you hava any other questions, please feel free to inform me.

Hi

Sorry But there is not a such property PageNumber in class Stamp

I cannot do: logoStamp.PageNumber = i;

Hello Daniel,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Can you please share the version of Aspose.Pdf.Kit you are using? As during my test with version v3.4.0.0 I am able to see the property. Please try using this version and in case you still face any problem, please feel free to contact.

Hi Daniel,

I have tested the issue with the latest version of Aspose.Pdf.Kit for .NET using the code snippet shared above and it worked fine. Please note that you can find the PageNumber property in Stamp class. Please download the latest version and try with the above code.

If you still find any issues or have some more questions, please do let us know.
Regards,