DWG to PDF Conversion Page Size Issue

I have some code and some sample DWG files that were downloaded from AutoDesk website. The code I am using looks at the PlotPaperSize.Width and PlotPaperSize.Height specified in the default layout (“Model”) and sets the PDF PageWidth and PageHeight using these values to convert from millimeters to inches.

AutoCad1.dwg produces a PDF with page size 199.? x 129.? inches. This should be 17 x 11 inches. This was unexpected.

AutoCad2.dwg produces a PDF with page size 11 x 8.5 inches as expected.

I have several other DWG examples that produce the correct page size using this code if you need them, but this one file (AutoCad1.dwg) seems to produce a PDF with a huge page size.

I have included a .Net solution file using Aspose.CAD 17.12 and Aspose.PDF 18.1. If you run the example it will produce in bin/Debug the two PDF files pdf1.pdf and pdf2.pdf that correspond to the DWG example files that I have supplied.

What can I do to resolve this issue?


Also, the upload of the example project that I have seems to have failed. Please advise.


I have observed your comments. Can you please share source files and sample project via dropbox so that we may further investigate to help out.

Hopefully this link from Google Drive will suffice…



I have worked with file shared by you using Aspose.CAD for .NET 17.12 and have been able to observe the issue. A ticket with ID CADNET-537 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with issue so that you may be automatically notified once issue will be fixed.

Thanks for kicking off a ticket for this.

I found another CAD file that demonstrates page sizing issues. Here is a link to the sample project and examples…


AutoCad1.dwg in this examples converts to bin/Debug/pdf1.pdf which is .43 x .33 inches instead of 11 x 8.5 as expected.

I think this is likely related to CADNET-537, but I wanted to make you aware of it since it is the opposite problem of the previous sample I sent (that one was too large and this one is too small).

Please let me know if I can do anything to help.


I have observed your comments. I have shared sample code in a text file with you. This will help you to get expected result. Please check attachment and share feedback with us if there is still an issue.sample code (2).zip (1.0 KB)

@Adnan.Ahmad Is that code publicly available anywhere? I’m running into the same issue and would like to see it, but thread attachments are private by default.


I have observed your comments. I have shared dropbox link with you. You can download sample code from this link. Please share feedback with us if there is still an issue.

Is it possible to refactor the sample code?

Here is more relevant example.


As you stated, I follow the example code below, is the result the same?

    string sourceFilePath = @"C:\Users\uacar\Desktop\Klasörler\Proje ve Excel'ler\Karabağlar Belediyesi\Özgür Bey DWG Projeler\3058 ADA 13 PARSEL_recover.dwg";
        string outPath = @"C:\Users\uacar\Desktop\Test\10.pdf";

        using (CadImage cadImage = (CadImage)Image.Load(sourceFilePath))
            CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
            //rasterizationOptions.PageWidth = 1000;
            //rasterizationOptions.PageHeight = 1000;

            //custom sizes for several layouts
            rasterizationOptions.LayoutPageSizes.Add("ANSI C Plot", new SizeF(cadImage.Width,cadImage.Height));
            rasterizationOptions.LayoutPageSizes.Add("8.5 x 11 Plot", new SizeF(cadImage.Width,cadImage.Height));

            PdfOptions pdfOptions = new PdfOptions() { VectorRasterizationOptions = rasterizationOptions };

            cadImage.Save(outPath, pdfOptions);


I’m afraid we need more information about your goal and the initial file. Please, describe it in more details, so we can help you. Thanks.

I want to convert the dwg file I left in the link into a 1:50 scale pdf or tiff file.

I propose to continue this conversation in the other thread we have already started to keep all things in one place :slight_smile: