The font size is incorrect after converting dwg to PDF

The font size is incorrect after converting dwg to PDF.
PDF:1699413026759.png (70.2 KB)

DWG:1699413084990.png (31.1 KB)
A3图框(新) (24.4 KB)

could you please provide the initial dwg file as well so we can analyze it.

I have uploaded the dwg file. @oleksii.gorokhovatskyi

this text uses SHX font, you can try to apply proper setting along with LoadOptions, e.g.:

LoadOptions loadOptions = new LoadOptions();
loadOptions.SpecifiedEncoding = CodePages.SimpChinese;
using (CadImage cadImage = (CadImage)Aspose.CAD.Image.Load(GetPath(fileName), loadOptions))
    CadRasterizationOptions cadRasterizationOptions = new CadRasterizationOptions();
    cadRasterizationOptions.PageSize = new SizeF(1500, 1500);
    cadRasterizationOptions.Layouts = new string[] { "Model" };

    cadRasterizationOptions.ShxFonts = new string[] 

    PdfOptions pdfOptions = new PdfOptions();
    pdfOptions.VectorRasterizationOptions = cadRasterizationOptions;

    cadImage.Save(outPath, pdfOptions);

We don’t have other romans-h.shx font used in this file, you can try to apply it too.

ctbFileStream = new FileStream(ctbPath, FileMode.Open);
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.PageWidth = windowWidth;
rasterizationOptions.PageHeight = windowHeight;
rasterizationOptions.DrawType = CadDrawTypeMode.UseObjectColor;
rasterizationOptions.VisibilityMode = VisibilityMode.AsPrint;
rasterizationOptions.Zoom = 1f;
rasterizationOptions.NoScaling = false;
rasterizationOptions.ScaleMethod = ScaleType.ShrinkToFit;
rasterizationOptions.RenderMode3D = RenderMode3D.Wireframe;
IDictionary<string, Stream> keyValuePairs = new Dictionary<string, Stream>();
keyValuePairs.Add(“test”, ctbFileStream);
rasterizationOptions.CtbSources = keyValuePairs;

rasterizationOptions.Quality.Text = RasterizationQualityValue.High;
rasterizationOptions.ShxFonts = new string[] { { “D:\Work\CAD\Fonts\ROMANS-H.SHX” };
rasterizationOptions.AutomaticLayoutsScaling = true;
pdfOptions.VectorRasterizationOptions = rasterizationOptions;
cadImage.Save(outputFilePath, pdfOptions);
1699583186270.png (41.7 KB)

1699583216781.png (19.4 KB)

1699583243922.png (4.8 KB)
Font: (7.2 KB)

There are two more questions:

  1. The font is still garbled after setting.

  2. After exporting the vertical text to PDF, it becomes horizontal.

please attach the initial dwg file too.

DWG: (23.7 KB)

I can see the issue, I guess we don’t have support for the vertical SHX text.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CADNET-9482

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Is there a solution to the problem of converting PDF text to garbled code?@oleksii.gorokhovatskyi

could you please show the text you are talking about.