예제 #1
0
        public void Convert(IMapGraphic mapGraphic, string outputFilename)
        {
            var xmlDocument = mapGraphic.GetSvgXmlDocument();
            var svgDocument = SvgDocument.Open(xmlDocument);
            var image       = new System.Drawing.Bitmap((int)(svgDocument.Width.Value * Scale), (int)(svgDocument.Height.Value * Scale));

            svgDocument.Draw(image);
            image.Save(outputFilename);
        }
        public void Convert(IMapGraphic mapGraphic, string outputFilename)
        {
            var inkscapeExe = GetInkscapePath();

            if (inkscapeExe == null)
            {
                throw new ApplicationException("Inkscape is required to convert.");
            }
            using (var tfh = new TemporalFileHelper())
            {
                var xmlDocument = mapGraphic.GetSvgXmlDocument();
                xmlDocument.Save(tfh.TemporalFileName);

                var     arguments = string.Format("--file {0} {1} {2}", tfh.TemporalFileName, ConvertOption, outputFilename);
                Process p         = Process.Start(inkscapeExe, arguments);
                p.WaitForExit();
            }
        }
예제 #3
0
 public void Convert(IMapGraphic mapGraphic, string outputFilename)
 {
     using (var tfh = new TemporalFileHelper())
     {
         var xmlDocument = mapGraphic.GetSvgXmlDocument();
         xmlDocument.Save(tfh.TemporalFileName);
         using (WebClient client = new WebClient())
         {
             client.Headers["Content-Type"] = "binary/octet-stream";
             StringBuilder sb     = new StringBuilder();
             var           result = client.UploadFile(
                 "https://api.cloudconvert.com/convert?" +
                 "apikey=" + _apikey +
                 "&input=upload" +
                 "&inputformat=svg" +
                 "&outputformat=" + OutputFormat,
                 tfh.TemporalFileName);
             File.WriteAllBytes(outputFilename, result);
         }
     }
 }
예제 #4
0
        public void Convert(IMapGraphic mapGraphic, string outputFilename)
        {
            var xmlDocument = mapGraphic.GetSvgXmlDocument();

            xmlDocument.Save(outputFilename);
        }