您好,我在使用Aspose.CAD For JAVA 22.7中,遇到了导出后的文件较源文件缺失了部分线条问题,以下是我的示例代码
import com.aspose.cad.*;
import com.aspose.cad.fileformats.cad.CadDrawTypeMode;
import com.aspose.cad.imageoptions.CadRasterizationOptions;
import com.aspose.cad.imageoptions.PdfOptions;
import com.aspose.cad.imageoptions.RasterizationQuality;
import com.aspose.cad.imageoptions.UnitType;
public class TestDwg2Pdf {
public static void main(String[] args) throws Exception {
String sourcePath = "E:\\dwg-pdf-svg-jpeg-png-master\\dwg-pdf-svg-jpeg-png-master\\src\\main\\resources\\QM0645-F.dwg";
String targetPath = "E:\\dwg-pdf-svg-jpeg-png-master\\dwg-pdf-svg-jpeg-png-master\\src\\main\\resources\\17.pdf";
LoadOptions loadOptions = new LoadOptions();
loadOptions.setSpecifiedEncoding(CodePages.SimpChineseOtherGb2312);
Image image = Image.load(sourcePath,loadOptions);
// Create an instance of PdfOptions
PdfOptions pdfOptions = new PdfOptions();
CadRasterizationOptions cadRasterizationOptions = new CadRasterizationOptions();
cadRasterizationOptions.setPageHeight(1080);
cadRasterizationOptions.setPageWidth(1920);
cadRasterizationOptions.setDrawType(CadDrawTypeMode.UseObjectColor);
cadRasterizationOptions.setUnitType(UnitType.Unitless);
cadRasterizationOptions.getGraphicsOptions().setSmoothingMode(SmoothingMode.HighQuality);
cadRasterizationOptions.getGraphicsOptions().setTextRenderingHint(TextRenderingHint.AntiAliasGridFit);
cadRasterizationOptions.getGraphicsOptions().setInterpolationMode(InterpolationMode.HighQualityBicubic);
RasterizationQuality quality = new RasterizationQuality();
quality.setTextThicknessNormalization(true);
cadRasterizationOptions.setQuality(quality);
pdfOptions.setVectorRasterizationOptions(cadRasterizationOptions);
image.save(targetPath, pdfOptions);
}
}
c622bf3f-d5af-4616-a56e-dbcb30528e6a.png (6.8 KB)这是原dwg图纸应有的样子,
image.png (77.3 KB)这是导出后的样子,缺少了部分线条
QM0645-F.zip (118.5 KB)这是我使用的dwg源文件
是我在代码中有什么错误吗,期待回复