码迷,mamicode.com
首页 > 编程语言 > 详细

java dwg转svg

时间:2019-09-16 09:53:29      阅读:672      评论:0      收藏:0      [点我收藏+]

标签:graph   admin   get   ati   stat   osc   static   The   mod   

package com.example.demo.dxf2svg;

import com.aspose.cad.InterpolationMode;
import com.aspose.cad.SmoothingMode;
import com.aspose.cad.TextRenderingHint;
import com.aspose.cad.imageoptions.CadRasterizationOptions;
import com.aspose.cad.imageoptions.SvgOptions;

/**
 * Created by Administrator on 2019/9/10.
 */
public class Test {

    public static void main(String[] args) {
        //加载PDF
//        String absParsingFile = "D:/dfx/暖气位置建议图.dwg";
        String absParsingFile = "C:/file/dfx/暖气位置建议图.dwg";
        com.aspose.cad.Image cadImage = com.aspose.cad.Image.load(absParsingFile);
        CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
        rasterizationOptions.setPageWidth(1600);
        rasterizationOptions.setPageHeight(1600);
        rasterizationOptions.setAutomaticLayoutsScaling(true);
        rasterizationOptions.setNoScaling (false);
        rasterizationOptions.setContentAsBitmap(true);
        rasterizationOptions.setLayouts(new String[] {"Model"});
        rasterizationOptions.setDrawType(1);

        SvgOptions svgOptions = new SvgOptions();
        svgOptions.setVectorRasterizationOptions(rasterizationOptions);

        // Set Graphics options
        rasterizationOptions.getGraphicsOptions().setSmoothingMode(SmoothingMode.HighQuality);
        rasterizationOptions.getGraphicsOptions().setTextRenderingHint(TextRenderingHint.AntiAliasGridFit);
        rasterizationOptions.getGraphicsOptions().setInterpolationMode(InterpolationMode.HighQualityBicubic);

        // Export to PDF by calling the Save method
        cadImage.save("C:/file/dfx/暖气位置建议图.svg", svgOptions);
    }

}

  

java dwg转svg

标签:graph   admin   get   ati   stat   osc   static   The   mod   

原文地址:https://www.cnblogs.com/james-roger/p/11525501.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!