افزودن خصوصیات دلخواه

افزودن خصوصیات دلخواه

Aspose.CAD برای API جاوا به شما این امکان را می‌دهد که خصوصیات دلخواهی را به فایل‌های DXF و DWG اضافه کنید. برای این کار، API متد CadImage.Header.CustomProperties.Add را فراهم می‌کند. کد زیر، افزودن خصوصیات دلخواه به فایل DXF را با استفاده از متد CadImage.Header.CustomProperties.Add نشان می‌دهد.

// For complete examples and data files, please go to https://github.com/aspose-cad/Aspose.CAD-for-Java
String dataDir = Utils.getDataDir(ExportDXFToWMF.class) + "DXFDrawings/";
String srcFile = dataDir + "conic_pyramid.dxf";
String outFile = dataDir + "AddCustomProperties_out.dxf";
CadImage cadImage = (CadImage)Image.load(srcFile);
cadImage.getHeader().getCustomProperties().put("CUSTOM_PROPERTY_1", "Custom property test 1");
cadImage.getHeader().getCustomProperties().put("CUSTOM_PROPERTY_2", "Custom property test 2");
cadImage.getHeader().getCustomProperties().put("CUSTOM_PROPERTY_3", "Custom property test 3");
cadImage.save(outFile);