|
PDFsharp - moved to http://forum.pdfsharp.net/ Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
|
View previous topic :: View next topic |
Author |
Message |
jpavez
Joined: 17 Dec 2007 Posts: 4 Location: Chile
|
Posted: Fri Dec 21, 2007 9:03 pm Post subject: Vertical Text |
|
|
I need posisioning vertical text exactly in a XPoint.
I try using a rectangle, from "top + height" to "top".
Still can't do it...
Code: |
XGraphicsState gs = gfx.Save();
XGraphicsPath path = new XGraphicsPath();
gfx.TranslateTransform(45.0 , 10.0 + rect.Height / 3.0);
gfx.RotateTransform(-90);
gfx.TranslateTransform(-45.0 , -10.0 - rect.Height / 3.0);
rect.Width = rect.Height;
rect.Height = 20;
XTextFormatter tf = new XTextFormatter(gfx);
tf.Alignment = XParagraphAlignment.Center;
gfx.DrawPath(new XPen(pen.Color, 0.5), brush, path);
XRect rectVerticalText = new XRect(-rect.Top,rect.Left, rect.Width, rect.Height);
gfx.DrawRectangle(brushBlack,rectVerticalText);
tf.DrawString(ndName, font, brushFont, rectVerticalText, XStringFormat.TopLeft);
gfx.Restore(gs);
|
Regards, José.[/code] _________________ Salu2, JPavez |
|
Back to top |
|
|
tranquillo
Joined: 20 Sep 2007 Posts: 15
|
Posted: Mon Jan 21, 2008 9:24 am Post subject: |
|
|
not sure what you're trying to do but this is the code I use to write vertical text to a specific rectangle (point, size);
XRect spineTitleBox = new XRect(rectangleY, document.width - rectangleX, TitleSize.Width, TitleSize.Height);
// Since you "turn the paper" you're writing to, the Y pos when you hold the paper upright becomes the X pos, and the new Y pos, is the total width of the document - the original X pos.
// set a new xy=0 pos
xgf.TranslateTransform(page.Width/2, page.Height/2);
// turn the paper from the ny xy=0
xgf.RotateTransform(90);
// reset the xy=0 to the upper left corner.
xgf.TranslateTransform(-page.Height/2, -page.Width/2);
// write your stuff
if(!string.IsNullOrEmpty(book.Title))
{
XBrush brush;
brush = Brushes.Black;
xgf.DrawString(book.Title, spineTitleFont, brush, spineTitleBox, XStringFormat.Center);
}
// set a new yx=0 pos
xgf.TranslateTransform(page.Height/2, page.Width/2);
// turn the paper back
xgf.RotateTransform(-90);
// reset the xy=0 to the upper left corner
xgf.TranslateTransform(-page.Width/2, -page.Height/2); |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|