We are using the pdfexporter and implementing the following code
PdfExporter exporter = new PdfExporter();
pdfExporter.Export(diagram, fileName);
to export PDF's. When we call this code to export a diagram containing a ShapeNode using a Shape drawn by code written by us, we get an exception from within the Mindfusion code base.
The Shape code we use is:
Shape shape = new Shape(
new ElementTemplate[]
{ new LineTemplate(50, 0, 100, 30),
new LineTemplate(100, 30, 100, 70),
new LineTemplate(100, 70, 50, 100),
new LineTemplate(50, 100, 0, 70),
new LineTemplate(0, 70, 0, 30),
new LineTemplate(0, 30, 50, 0)
},
new ElementTemplate[]
{
},
null, System.Drawing.Drawing2D.FillMode.Winding, "Gateway");
ShapeNode node = diagram.Factory.CreateShapeNode(xPos, yPos, 75, 15, shape);
node.Brush = new MindFusion.Drawing.SolidBrush(nodeColor);
node.Font = new System.Drawing.Font("Verdana", 2.4F, GraphicsUnit.World);
node.CustomDraw = CustomDraw.Additional;
node.Pen.Brush = new MindFusion.Drawing.SolidBrush(Color.Black);
node.Pen.Width = 0;
node.ShadowColor = Color.Black;
node.ShadowOffsetX = .8f;
node.ShadowOffsetY = .8f;
The exception is occurring with us using AcrobatReader Version 8, and either PdfExport.dll versions 5.0.3.20105 or version 5.0.2.29231.
Is there a workaround to avoid getting this error during a pdf export? Or are we doing something wrong in the drawing of the Shape? Your assistance is greatly appreciated.
Below is the stack trace:
APPLICATION ERROR AT 22/04/2008 8:53:55 AM: Unhandled Exception:
Parameter is not valid.
System.ArgumentException
Stack Trace
at System.Drawing.Drawing2D.GraphicsPath.get_PathPoints()
at MindFusion.Pdf.PdfGraphics.DrawPath(Pen pen, GraphicsPath path)
at MindFusion.Diagramming.ShapeNode.xc79d59e9288101bd(IGraphics x41347a961b838962, RectangleF xa6236fc5cd405c4e, Boolean x2f9dabff87b2168b, Brush xb45de92d01a0ec1f, Pen x9c79b5ad7b769b12, RenderOptions xdfde339da46db651)
at MindFusion.Diagramming.ShapeNode.Draw(IGraphics graphics, RenderOptions options)
at MindFusion.Diagramming.Diagram.x679ae26de3befa07(IGraphics x41347a961b838962, RectangleF xd0772cd9ac472b96, Boolean x979174172ae18db3)
at MindFusion.Diagramming.Diagram.Draw(IGraphics graphics, RenderOptions options, RectangleF clipRect, Boolean noModifiedItems)
at MindFusion.Diagramming.Export.PdfExporter.Export(Diagram diagram, String filePath)
at NMS.View.NmsApplication.ExportToPdf() in C:\SVNClient\NMS\Source\Framework\NMSApplication.cs:line 207
at NMS.View.NmsApplicationMdi.ExportToPdfClick(Object sender, EventArgs e) in C:\SVNClient\NMS\Source\View\NmsApplicationMDI.cs:line 251
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)