java dwg转svg

Posted james-roger

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java dwg转svg相关的知识,希望对你有一定的参考价值。

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的主要内容,如果未能解决你的问题,请参考以下文章

怎么才能DWG转PDF格式转换器

MxCAD云图DWG转PDF

MxCAD云图DWG转PDF

DWG转换成PDF这样转,DWG转为PDF的步骤

如何进行dwg转pdf 多页转换

arcgis 将cad的dwg格式转shp