您好,我在使用Aspose.CAD 在将dwg导出pdf时,使用的方式是设置导出窗口,在导出时,原多段线是不闭合的,导出后多段线自动闭合了。
我使用的版本是 24.3.0
代码
CadImage cadImage;//导入的dwg图纸
PdfOptions pdfOptions = new PdfOptions();
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.ExportAllLayoutContent = false;
rasterizationOptions.NoScaling = true;
CadVportTableObject newView = new CadVportTableObject();
newView.Name = "*Active";
newView.CenterPoint.X = 3385009.8899606355;
newView.CenterPoint.Y = -2235405;
newView.ViewHeight = 297000;
newView.UseAspectRatio = true;
newView.ViewAspectRatio = 1.4158241748190941;
for (int i = 0; i < cadImage.ViewPorts.Count; i++)
{
CadVportTableObject currentView = (CadVportTableObject)(cadImage.ViewPorts[i]);
if ((currentView.Name == null && cadImage.ViewPorts.Count == 1) ||
string.Equals(currentView.Name.ToLowerInvariant(), "*active"))
{
cadImage.ViewPorts[i] = newView;
break;
}
}
rasterizationOptions.PageWidth = 1188;
rasterizationOptions.PageHeight = 840;
rasterizationOptions.DrawType = CadDrawTypeMode.UseObjectColor;
rasterizationOptions.VisibilityMode = VisibilityMode.AsPrint;
rasterizationOptions.Zoom = 1f;
rasterizationOptions.Layouts = new string[] { “Model” };
pdfOptions.VectorRasterizationOptions = rasterizationOptions;
cadImage.Save(outputFilePath, pdfOptions);
dwg文件
DD21185-DWG-0202WS10-001_0(A1) 场区消防管道平面图.zip (259.1 KB)
image.png (66.6 KB)