[mapguide-users] ePlot DWF and .NET
José Israel Campero Domínguez
israel.campero at sgmexico.com.mx
Thu Mar 12 16:03:18 EDT 2009
Hello, everyone...
I'm having problems with the following code:
MgDwfVersion dwfVersion = new MgDwfVersion("6.01", "1.2");
MgPlotSpecification plotSpec = new MgPlotSpecification(8.5f,
11, MgPageUnitsType.Inches, 0f, 0f, 0f, 0f);
plotSpec.SetMargins(0.5f, 0.5f, 0.5f, 0.5f);
mappingService =
siteConnection.CreateService(MgServiceType.MappingService) as
MgMappingService;
MgLayout layout = null;
if ((useLayout != "FALSE" && useLayout == "TRUE"))
{
MgResourceIdentifier layoutRes = new
MgResourceIdentifier("Library://Project/Maps/Project.PrintLayout");
layout = new MgLayout(layoutRes, "Project",
MgPageUnitsType.Inches);
}
double scale = map.GetViewScale();
MgByteReader byteReader = null;
if (scale <= 0)
{
byteReader = mappingService.GeneratePlot(map, plotSpec,
layout, dwfVersion);
}
else
{
MgCoordinate mapCenter =
map.GetViewCenter().GetCoordinate();
byteReader = mappingService.GeneratePlot(map, mapCenter,
scale, plotSpec, layout, dwfVersion);
}
// Now output the resulting DWF.
utilityfunctions.OutputReaderContent(Response, byteReader);
When I call the function, a new window is displayed, but there's nothing
in it. Also, if I change the last code for this:
MgByteSink bytesink = new MgByteSink(byteReader);
bytesink.ToFile("c:\\project\\test" +
DateTime.Today.ToString("ddMMyy") + ".dwf");
The following error appears:
A file IO exception occurred: c:\project\test120309.dwf
Exception occurred in method MgByteSink.ToFile at line 220 in file
...\service\data\ByteSink.cpp
I need to create the dwf. I checked the php code and the .net examples
and the code I'm using is the same that the one in the examples.
Is there an error I'm not seeing? What can I do to solve this?
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20090312/a5234fc7/attachment.html
More information about the mapguide-users
mailing list