public void DrawRectangle() { var doc = new PortableDocument(); doc.AddPage(200, 100); doc.SetColor(OxyColors.Navy); doc.SetFillColor(OxyColors.Gainsboro); doc.DrawRectangle(5, 5, 100, 70, true); doc.DrawRectangle(185, 85, 10, 10); doc.Save(Folder + "DrawRectangle.pdf"); }
public void RotateAt() { var doc = new PortableDocument(); doc.AddPage(200, 200); doc.SaveState(); doc.SetColor(1, 0, 0); doc.RotateAt(50, 20, 30); doc.DrawRectangle(50, 20, 100, 15); doc.RestoreState(); doc.DrawRectangle(50, 20, 100, 15); doc.Save(Folder + "RotateAt.pdf"); }
public void Translate() { var doc = new PortableDocument(); doc.AddPage(200, 200); doc.SaveState(); doc.SetColor(1, 0, 0); doc.Translate(20, 10); doc.DrawRectangle(10, 10, 100, 70); doc.RestoreState(); doc.DrawRectangle(10, 10, 100, 70); doc.Save(Folder + "Translate.pdf"); }
public void MeasureText() { var doc = new PortableDocument(); doc.AddPage(PageSize.A4); doc.SetFont("Arial", 96); var text = "qjQJKæ"; double width, height; doc.MeasureText(text, out width, out height); double y = doc.PageHeight - 400 - height; doc.SetColor(0, 0, 1); doc.DrawRectangle(50, y, width, height); doc.SetFillColor(0, 0, 0); doc.DrawText(50, y, text); doc.Save(Folder + "MeasureText.pdf"); }