DWG to PDF conversion error

Product: CAD2PDF

Product Version: 9.5.0-1bc49d6a54

Please give a brief summary of your issue:
Converting DWG to PDF results in error

Please describe your issue and provide steps to reproduce it:
Exception:
Message: Error converting CAD content using CAD2PDF module Add-On. PDFTron Converter Error: No filename
Conditional expression: false
Version : 9.5.0-1bc49d6a54
Platform : Windows
Architecture : AMD64
Filename : Convert.cpp
Function : trn::PDF::Convert::FromCAD
Linenumber : 1579

Please provide a link to a minimal sample where the issue is reproducible:

Hi Alan,

I downloaded the .dwg file you sent and converted it by changing the CAD2PDF sample:

The error no filename usually means that you are passing the file into the function incorrectly. Could you reproduce the error by changing the CAD2PDF sample? If so, please send your code snippet so we can further investigate.

Hi, I can replicate this error in the web demo at JS CAD Viewer Demo | Apryse WebViewer.

Request: https://demo.pdftron.com/blackbox/GetPDF?uri=cid://C301%20Stage%201%20Roading%20Plan_YTdLysO_5HOMi5xlVtsYFP.dwg&ext=dwg&bcid=showcase

HTTP Status 500 – Internal Server Error


Type Status Report

Message unable to complete fetch of cid://C301 Stage 1 Roading Plan_YTdLysO_5HOMi5xlVtsYFP.dwg Convert task exception: com.pdftron.server.JobErrorException: error:86698e5f-4d0f-4ff5-85ad-bd19dfe8a17e : error - Exception: Message: Error converting CAD content using CAD2PDF module Add-On. PDFTron Converter Error: No filename Conditional expression: false Version : 9.5.0-065d880888 Platform : Linux Architecture : AMD64 Filename : Convert.cpp Function : FromCAD Linenumber : 1579

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Hi Alan,

I tried with the same demo WebViewer and was able to open the file:

I noticed in the error message you received the name of the file was slightly different from the one provided. Are you sure they are the same file?

Could you also try on a different system and let me know if you are still having the error?

Hi,

Your attempt at the demo WebViewer errored. The drawing you see there is just the default one. If you look at the request using the browser’s developer tools, you’ll see the same error that I posted previously.

I have also tried this using a simple console app and as expected saw the same error.

pdftron.Common.PDFNetException
HResult=0x80131500
Message=Exception:
Message: Error converting CAD content using CAD2PDF module Add-On. PDFTron Converter Error: No filename
Conditional expression: false
Version : 9.5.0-1bc49d6a54
Platform : Windows
Architecture : AMD64
Filename : Convert.cpp
Function : trn::PDF::Convert::FromCAD
Linenumber : 1579

Source=PDFTronDotNet
StackTrace:
at pdftron.Common.PDFNetException.REX(IntPtr result)
at pdftron.PDF.Convert.FromCAD(PDFDoc in_pdfdoc, String in_filename, CADConvertOptions options)
at Program.$(String[] args) in C:\Users\alans\source\repos\PDFTron.CADtoPDF\Program.cs:line 18

Code below:

// See https://aka.ms/new-console-template for more information
using pdftron.PDF;
using pdftron;
using pdftron.SDF;

var pdfTronPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\Lib\\Windows\\");
PDFNet.Initialize("Replace with Licence Key");
PDFNet.AddResourceSearchPath(pdfTronPath);
if (!CADModule.IsModuleAvailable())
{
    Console.WriteLine("Apryse SDK CAD module not available.");
}

using (PDFDoc doc = new PDFDoc())
{
    var inputFilePath = "C:\\Users\\alans\\Downloads\\C301 Stage 1 Roading Plan.dwg";
    var outputFilePath = "C:\\Users\\alans\\Downloads\\C301 Stage 1 Roading Plan.pdf";
    pdftron.PDF.Convert.FromCAD(doc, inputFilePath, null);
    doc.Save(outputFilePath, SDFDoc.SaveOptions.e_remove_unused);
}

Hi Alan,

I was able to reproduce the error by switching to an older CAD module. After investigation, it appears this was an issue we discovered and fixed a while ago, but you will need to update to the latest CAD module:
https://nightly-pdftron-uploads.s3.us-west-1.amazonaws.com/stable/2023-03-29/9.5/CADModuleWindows_2023-03-29_stable.zip

Let me know how this works for you and if you have any questions.