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

Free Support Forum - aspose.com

Rotating watermark

hi,

I have used the below code for rotating the watermark text. But this is not behaving the same for all kinds of pdf.I have attached the two sample pdf documents for which the rotation property is behaving differently along with this thread.Can anybody help me to set a standard value which will work fine for all kinds of pdf?

Dim logoStamp As Stamp = New Stamp

logoStamp.Rotation = 55

Regards,

BlackCherry.

Hi,

Just a suggestion, hope that helps.

PdfPageEditor pageEditor = new PdfPageEditor();
pageEditor.BindPdf("thePdfFile");
float w = pageEditor.GetPageSize(1).Width(); // page width
float h = pageEditor.GetPageSize(1).Height(); // page height

float r = 45; // rotating angle for stamp
if (h>w) // 90 > rotation > 0. if height = width then rotation = 45.
{
r = r + (h - w)/h * r;
}
else
{
r = r + (h -w)/w * r;
}

Thanks,