Skip to content

Instantly share code, notes, and snippets.

@Polaringu
Created October 22, 2018 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Polaringu/642a859eaaa1ee05b42ec02cd5a09aa7 to your computer and use it in GitHub Desktop.
Save Polaringu/642a859eaaa1ee05b42ec02cd5a09aa7 to your computer and use it in GitHub Desktop.
private void DrawingSamples()
{
IPXC_Document doc = m_Inst.NewDocument();
PXC_Rect rc = new PXC_Rect();
rc.right = 600;
rc.top = 800;
IPXC_UndoRedoData urd;
doc.Pages.AddEmptyPages(0, 1, rc, null, out urd);
IPXC_Page page = doc.Pages[0];
//Creating IPXC_ContentCreator
IPXC_ContentCreator CC = doc.CreateContentCreator();
//Setting fill/stroke colors and line width
CC.SetFillAlpha(0.1);
CC.SetFillColorRGB(0x00FF00);
CC.SetStrokeColorRGB(0xFF00FF);
CC.SetLineWidth(2.0);
//Drawing Lines
CC.MoveTo(100, 100);
CC.LineTo(200, 200);
CC.LineTo(100, 300);
CC.LineTo(100, 100);
//Drawing rectangles
CC.Rect(300, 200, 500, 400);
//Drawing ellipses
CC.Ellipse(100, 100, 500, 300);
//Tells the CC to draw all that you have given it
CC.FillPath(true, true, PXC_FillRule.FillRule_Winding);
page.PlaceContent(CC.Detach(), (uint)PXC_PlaceContentFlags.PlaceContent_After);
string sRes = "D:\\CoreApi.pdf";
doc.WriteToFile(sRes);
GC.Collect();
GC.WaitForPendingFinalizers();
doc.Close();
System.Diagnostics.Process.Start(sRes);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment