Thomas Hoevel wrote:
Hi!
Maybe the code in this question can help you get started:
http://stackoverflow.com/q/42630276/162529Gagan DS Sohal wrote:
Here i want to rotate the text and images by 90 degree which is not working.
You don't show what you tried.
Maybe there is just a small oversight.
string text = "this is dummy text to be printed";
string pathToFile = @"e:\temp\done.pdf";
using (PdfDocument Pdf = PdfReader.Open(@"e:\temp\1617.pdf"))
{
PdfPage page = Pdf.Pages[0];
double Height = page.Height;
double Width = page.Width;
float RectX = (float)(20 + 25 + 20 + 10);
float RectY = (float)(Height - (20 + 10 + 25));
float RectL = (float)(Width - ((20 * 2) + 25 + 10 + 25 + 10));
float RectH = 35;
XImage image = XImage.FromFile(@"e:\temp\Logo.png");
XGraphics gfx = XGraphics.FromPdfPage(page);
XPoint objXpoint = new XPoint(50, 50);
gfx.DrawImage(image, (int)RectX-35,(int)RectY, 25, 25);
XFont font = new XFont("Times New Roman", 10, XFontStyle.Bold);
XTextFormatter tf = new XTextFormatter(gfx);
RectangleF objrect = new RectangleF(RectX, RectY, RectL, RectH);
XRect rect = new XRect(objrect);
gfx.DrawRectangle(XBrushes.SeaShell, rect);
tf.DrawString(text, font, XBrushes.Black, rect, XStringFormats.TopLeft);
gfx.RotateTransform(90);
Pdf.Save(pathToFile);
}
Process.Start(pathToFile);
}
above code is working fine but i am able to print image and string at right down at page.
Now i want that image and text should be added at left side of pdf rotated by -90. by using same co - ordinate