Wrong DWG tolerance in the converted PDF

teszt.zip (10,6 kB)

I uploded a very simple DWG file in the zip file. When I would like to convert it to PDF with Aspose.cad I do not get the same reuslt.
image.png (2,8 kB)

You can see on the uploded image png, the selected tolerance display wrong in the PDF file. I suggestions?

@novakjanos,
Hello.
Could you please attach your PDF? Is this PDF correct?
teszt.dwg.pdf (22.3 KB)

Thanks a lot, this looks good! How did you that?

@novakjanos,
That’s nothing special:

 using (CadImage cadImage = (CadImage)Aspose.CAD.Image.Load(fileName))
 {
     CadRasterizationOptions cadRasterizationOptions = new CadRasterizationOptions();
     cadRasterizationOptions.PageHeight = 2000;
     cadRasterizationOptions.PageWidth = 2000;

     PdfOptions pdfOptions = new PdfOptions();
     pdfOptions.VectorRasterizationOptions = cadRasterizationOptions;
     cadImage.Save(outPath, pdfOptions);
 }

But PDF from your computer is useful to identify possible issues with export.

I uploded teh zip file contains the dwg and pdf. You can see the difference.
teszt.zip (24,6 kB)

Hi!%
I have tried the same code on my computer, but with different result than you. Still wrong on my computer.

@novakjanos,
tolerance symbols as well as some other symbols are stored in file with the reference to GDT font, that is supplied with AutoCAD. So “c” symbol corresponds to parallelogramm symbol in GDT. You may consider this example as an idea to replace such symbols directly or search for GDT font and install it:

using (CadImage cadImage = (CadImage)Aspose.CAD.Image.Load(fileName))
{
      CadRasterizationOptions cadRasterizationOptions = new CadRasterizationOptions();
      cadRasterizationOptions.PageHeight = 2000;
      cadRasterizationOptions.PageWidth = 2000;

      foreach (CadEntityBase entity in cadImage.Entities)
      {
          if (entity.TypeName == CadEntityTypeName.TOLERANCE)
          { 
              CadTolerance tolerance = (CadTolerance)entity;
              tolerance.ToleranceString = tolerance.ToleranceString.Replace("{\\Fgdt;c}", "\u25B1");
          }
      }

      PdfOptions pdfOptions = new PdfOptions();

      pdfOptions.VectorRasterizationOptions = cadRasterizationOptions;

      cadImage.Save(outPath, pdfOptions);
}

Thanks! Great! It works now.
Regards

1 Like

@novakjanos,
we were happy to help :slight_smile: