Hello,
I load/read i DWG file and then read the custom properties, alter one of the properties and set the custom properties map back on the CadImage object.
When I then convert it to PDF, the custom properties fields that should be displayed in the converted pdf are not updated, instead, it still displays the old values. The reason I save it as a
PDF is that I can not find a way to just update the DWG file (save it again as a DWG).
Could not upload DWG so I took a print screen of it.
DWGPrintScreen.png (46.0 KB)
ResultingPDF.png (15.6 KB)
My test code:
public void testDWG() throws FileNotFoundException {
//Native lang not supported expetion thrown if not set to English.
java.util.Locale.setDefault(java.util.Locale.ENGLISH);
CadImage objImage = (CadImage) CadImage.load(TEST_RESOURCE_PATH.concat("testDwg.dwg"));
HashMap<String, String> customProperties = objImage.getHeader().getCustomProperties();
//old value is set to TOLI
customProperties.put("ORIGINAL_PREPARED_BY_INITIALS", "JT");
// Prints JT
System.out.println("updatedPropVal = " + objImage.getHeader().getCustomProperties().get("ORIGINAL_PREPARED_BY_INITIALS"));
// Export the DWG to PDF
//Result a pdf, but the custom property value is printed as TOLI.
objImage.save(TEST_RESOURCE_PATH.concat("testDWGtoPDF.pdf"), new PdfOptions());
objImage.save(); // Failes with NPE
objImage.save(new FileOutputStream(TEST_RESOURCE_PATH.concat("testDWGtoDWG.dwg"))); // Failes with NPE.
}