Hello Team,
One of our client complained about converted PDF file from DWG.
I am uploading the sample DWG file heDownloads.zip (697.2 KB)
re. Generated PDF quality is not good.
I have also uploaded generated PDF file.
Kindly help us to resolve quality issue.
We are using below code to convert DWG to PDF:
public File generatePdf(File pdfFile) {
try(Image cadImage = Image.load(file.getAbsolutePath())) {
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.setPageWidth(cadImage.getWidth());
rasterizationOptions.setPageHeight(cadImage.getHeight());
rasterizationOptions.setAutomaticLayoutsScaling(true);
rasterizationOptions.setDrawType(CadDrawTypeMode.UseObjectColor);
rasterizationOptions.setNoScaling(false);
// Set Graphics options
rasterizationOptions.getGraphicsOptions().setSmoothingMode(SmoothingMode.HighQuality);
rasterizationOptions.getGraphicsOptions().setTextRenderingHint(TextRenderingHint.AntiAliasGridFit);
rasterizationOptions.getGraphicsOptions().setInterpolationMode(InterpolationMode.HighQualityBicubic);
// Create an instance of PDF options class
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.setVectorRasterizationOptions(rasterizationOptions);
// Export to PDF by calling the Save method
cadImage.save(pdfFile.getAbsolutePath(), pdfOptions);
return pdfFile;
Regards,
Aniket