So, I’m trying to export a DWG to PDF and all looks good. Though, some special characters are not rendered accordly. Is there a way to set the char encoding on the result PDF output?
Here my code:
private ResponseEntity<byte[]> dwgToPdf(byte[] bytes) {
val stream = new MemoryStream(bytes);
val image = Image.load(stream.toInputStream());
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.setBackgroundColor(Color.getWhite());
rasterizationOptions.setPageWidth(1600);
rasterizationOptions.setPageHeight(1200);
// Create an instance of PdfOptions
PdfOptions pdfOptions = new PdfOptions();
// Set the VectorRasterizationOptions property
pdfOptions.setVectorRasterizationOptions(rasterizationOptions);
// Export the DWG to PDF
val os = new ByteArrayOutputStream();
image.save(os, pdfOptions);
return ResponseEntity.ok(os.toByteArray());
}