[mapguide-users] ePlot DWF and .NET

Zac Spitzer zac.spitzer at gmail.com
Fri Mar 13 04:45:32 EDT 2009


does the project folder or the target file exist?

On Fri, Mar 13, 2009 at 7:03 AM, José Israel Campero Domínguez
<israel.campero at sgmexico.com.mx> wrote:
> 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.
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>
>



-- 
Zac Spitzer -
http://zacster.blogspot.com
+61 405 847 168


More information about the mapguide-users mailing list