Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Error exporting to PDF and Visio (Read 5080 times)
John Preston
YaBB Newbies
*
Offline


Lost Developer

Posts: 18
Joined: Mar 9th, 2011
Error exporting to PDF and Visio
Mar 24th, 2011 at 5:06pm
Print Post  
When I try to export... PNG works, XML works, but Visio and PDF fail. In all cases I am using a Windows SaveFileDialog, and the same diagram, but it isn't a single diagram that fails, it seems like all of them.

The PDF Export gives this:
Code
Select All
System.TypeInitializationException: The type initializer for 'MindFusion.Pdf.Globals' threw an exception. ---> System.ArgumentException: The path is not of a legal form.
   at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck)
   at System.IO.Path.NormalizePath(String path, Boolean fullCheck)
   at System.IO.Path.GetDirectoryName(String path)
   at MindFusion.Pdf.Globals..cctor()
   --- End of inner exception stack trace ---
   at MindFusion.Pdf.PdfGraphics..ctor(Image img, String FilePath, GraphicsUnit gu, RectangleF layoutRect)
   at MindFusion.Pdf.PdfGraphics..ctor(RectangleF rect, String FilePath, GraphicsUnit gu)
   at MindFusion.Diagramming.Wpf.Export.PdfExporter.x12cb12b5d2cad53d(String xc15ea0179eb95a0e, Rect x26545669838eb36e)
   at MindFusion.Diagramming.Wpf.Export.PdfExporter.Export(Diagram diagram, String filePath) 



I'm using a windows SaveFileDialog to get the path... so I know the path is valid. Even if I try to save directly to "C:\new.pdf", it fails claiming the path is not of a legal form.

The Visio Export gives this error:
Code
Select All
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at MindFusion.Diagramming.Wpf.Export.VisioExporter.Export(Diagram diagram, String vdxPathName) 



I have no idea what index it claims is outside the bounds.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Error exporting to PDF and Visio
Reply #1 - Mar 24th, 2011 at 6:23pm
Print Post  
What value are you getting if you call Assembly.GetExecutingAssembly().Location from your app before exporting?
  
Back to top
 
IP Logged
 
John Preston
YaBB Newbies
*
Offline


Lost Developer

Posts: 18
Joined: Mar 9th, 2011
Re: Error exporting to PDF and Visio
Reply #2 - Mar 24th, 2011 at 7:12pm
Print Post  
Empty String.

Our components are all loaded on the fly via byte array... we aren't going to have an Assembly location.

We also won't ever have an Application, since we don't use the Application framework.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Error exporting to PDF and Visio
Reply #3 - Mar 24th, 2011 at 8:18pm
Print Post  
Well, both exporters look for some files at Assembly.Location. VisioExporter should work if you set its TemplatePath property, but there's nothing you can do about PdfExporter at this time if Location is empty.
  
Back to top
 
IP Logged
 
John Preston
YaBB Newbies
*
Offline


Lost Developer

Posts: 18
Joined: Mar 9th, 2011
Re: Error exporting to PDF and Visio
Reply #4 - Mar 24th, 2011 at 9:00pm
Print Post  
The PDF Viewer just builds a font cache relative to my assembly location. That doesn't really seem necessary. Can't this be changed to let me pass in a shared font cache folder or use Isolated Storage or something instead?

That said... I hacked our code to load your components from file instead of byte array and it fixed the PDF Viewer. I might be able to get a workaround, but it'd be highly undesirable.

The Visio Export apparently requires a template... I'll have to figure out how to distribute that I guess... But at least I can point at a location for it.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Error exporting to PDF and Visio
Reply #5 - Mar 25th, 2011 at 8:48am
Print Post  
It can be changed - font caching is used only in the ASP.NET version of the control anyway. We'll change how this value is initialized for the next release.
  
Back to top
 
IP Logged
 
John Preston
YaBB Newbies
*
Offline


Lost Developer

Posts: 18
Joined: Mar 9th, 2011
Re: Error exporting to PDF and Visio
Reply #6 - Mar 25th, 2011 at 2:44pm
Print Post  
Thank you. I'll look forward to that. Smiley

Two side notes about the exports... Is there a way to export only the parts of the diagram that are... populated? It appears a large chunk of our diagrams are unused, using like the 10% in the top left corner. This makes the export mostly blank, so we in the case of PNG, and PDF we get a hugely blank image/document with a teeny tiny diagram in the top left.

The Visio export also holds the font settings from the diagram. Since ours is millimeter sized, the font size is like 2.4, which in Visio is illegibly small.

The Visio export looks fine (minus the above issues) in full Visio. But the free Visio Viewer from Microsoft loads the diagram and it the nodes overlap, the links don't connect correctly... Is that a known issue?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Error exporting to PDF and Visio
Reply #7 - Mar 25th, 2011 at 4:51pm
Print Post  
Try calling ResizeToFitItems before exporting, and restoring diagram.Bounds after that.

Visio Viewer does not contain shape stencil definitions and can display shapes only if they specify low-level graphics inside a <geom> section under each shape element. However VisioExporter only specifies the shape's stencil name and does not generate a <geom> section, so the viewer cannot render the shapes correctly. You can still use the full Visio as a viewer - once its 30 trial uses expire it starts to work in "reduced" read-only mode while still displaying the shapes as expected.
  
Back to top
 
IP Logged
 
John Preston
YaBB Newbies
*
Offline


Lost Developer

Posts: 18
Joined: Mar 9th, 2011
Re: Error exporting to PDF and Visio
Reply #8 - Mar 25th, 2011 at 5:33pm
Print Post  
ResizeToFit works brilliantly. Thanks.

Okay, at least I have a response for Visio Viewer questions, should they arise, thank you.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint