Hi Stefano,
Thanks for the update and sample. We can do a little bit more tweaking and get the expected result. Please check out the following responses for your query,
1) Layers are used for text rotation
We can avoid layer for text rotation and we can use the following to rotate two strings. We use PdfGraphics and PdfGraphicState to rotate string or any element. Why we are using single graphics state for whole page, to avoid creating more graphics object for to reduce the memory and maintain single state for whole page.
//Save the initial state
PdfGraphicsState state1 = g.Save();
g.TranslateTransform(100.0f, 100.0f);
g.RotateTransform(90);
g.DrawString("Text Direction at 90 degre", font, brush, PointF.Empty);
//Restore old state
g.Restore(state1);
g.TranslateTransform(100, 200);
g.RotateTransform(45);
g.DrawString("Text Direction at 45 degree", font, brush, PointF.Empty);
2) Similarly to clip the text, we can make use of SetClip method of PdfGraphics.
Rectangle rect = new Rectangle(50, 50, 120, 35);
PdfRectangle pdfRect = new PdfRectangle(rect);
g.SetClip(rect);
//Clip simple string
// g.DrawString("Stefano Clipping sample", new PdfStandardFont(PdfFontFamily.Helvetica, 12), PdfBrushes.Black, rect);
pdfRect.Draw(page,0,0);
//Clip large string
element.Draw(g,50,50);
This will allow to clip the data without any wrapping the text.
Also, setting the below statement will avoid text wrapping and clipping. However, it will clip based on the words. and not with character.
format.WordWrap = PdfWordWrapType.None;
element.StringFormat = format;
element.Draw(page, rect2);
Please download the modified sample from the below link
http://websamples.syncfusion.com/samples/PDF.Windows/F68072_3/main.htmPlease let me know if you want any more details.
Regards,
Fahad