Dwg to pdf convert ImageSaveException

hi im beginner level programmer

ASPOSE’s API is useful and good working.
my company wants buy this API but some PC makes this error.
what is the problem ?
this issue is too difficult to me… TT
plz help me… thanks

my question is not definite
hope for understanding and ask for more info to me

this is the message :
Aspose.CAD.CadExceptions.ImageSaveException: Image saving failed. —> Aspose.CAD.CadExceptions.ImageSaveException: Image export failed. —> System.ArgumentException: illegal characters in path

and this is my path when i debugging :
C:\Users\ParkTaegeom\Documents\Aspose.CAD-for-.NET-master\Aspose.CAD-for-.NET-master\Examples\Data\DWG-Drawings\Bottom_plate_out.pdf

this is my code :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Aspose.CAD;
namespace Aspose.CAD.Examples.CSharp.DWG_Drawings
{
public class ExportToPDF
{
public static void Run()
{
//ExStart:ExportToPDF
// The path to the documents directory.
string MyDir = RunExamples.GetDataDir_DWGDrawings();
string sourceFilePath = MyDir + “Bottom_plate.dwg”;
using (Aspose.CAD.Image image = Aspose.CAD.Image.Load(sourceFilePath))
{
// Create an instance of CadRasterizationOptions and set its various properties
Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
rasterizationOptions.BackgroundColor = Aspose.CAD.Color.White;
rasterizationOptions.PageWidth = 1600;
rasterizationOptions.PageHeight = 1600;

            // Create an instance of PdfOptions
            Aspose.CAD.ImageOptions.PdfOptions pdfOptions = new Aspose.CAD.ImageOptions.PdfOptions();
            // Set the VectorRasterizationOptions property
            pdfOptions.VectorRasterizationOptions = rasterizationOptions;

            MyDir = MyDir + "Bottom_plate_out.pdf";
            // Export the DWG to PDF
            image.Save(MyDir, pdfOptions);
        }
        //ExEnd:ExportToPDF            
        Console.WriteLine("\nThe DWG file exported successfully to PDF.\nFile saved at " + MyDir);

    }
}

}

@taegeom,

I have observed the issue shared by you and request you to please share the source DWG file reproducing the issue on your end. I also request you to please first try using Aspose.CAD for .NET 17.4 as well on your end before sharing further information with us.

Thank you for your affection :blush:
I tried attach a file but that file is too big…

When the code is executed
Find the name of the input .dwg file in the folder and convert it to .pdf file.

image.Save(MyDir, pdfOptions); // An error occurs in this line.
You can see it in the code above.

When the line is executed, .pdf file is created but there is an error and can not be opened…

@taegeom,

In that case, I request you to please upload the source file on some FTP server or Dropbox and sharing the download link with us. We will be able to investigate the issue further on our end on provision of requested information.

This is the code I used.
link =
https://www.dropbox.com/s/evtt7zvxlbzpp16/Aspose.CAD-for-.NET-master.zip?dl=0

There are many classes in it.
ExportToPDF.cs class is the requested class…

@taegeom,

Thank you for sharing the requested project. I have worked using Aspose.CAD for .NET 17.4 on my end and have successfully generated PDF without any issue. For your kind reference, I have attached the generated PDF as well. Can you please share if this is the same DWG file with which you are having exception on your end.

Bottom_plate_out.pdf (16.9 KB)

This issue only occurs on certain computers.
It’s probably not a problem with the file…

I tried various files, but on a computer that does not always work, it does not work if I import it as a setup file.

My path and my code seems to be error free.

this is my path :
C:\Users\ParkTaegeom\Documents\Aspose.CAD-for-.NET-master\Aspose.CAD-for-.NET-master\Examples\Data\DWG-Drawings\Bottom_plate_out.pdf

but it always makes ‘illegal characters in path’ message.

Thank you even though it is cumbersome.

@taegeom,

I have observed the further information shared by you and it seems to some configuration related issue. Can you please share the Operating System details along with Visual Studio and .NET Framework information of machine where things are not working. Please also check the locale settings of of machine and compare it with the machine locale settings where things are working. Please perform this investigation on your end and share the findings with us.

Fail case computer’s set
Windows version : Windows 10 Pro
Processor : Intel® Core™ i5-3570 CPU @ 3.40GHz
RAM : 8.00GB
System : 64bit

Visual Studio 2017
.NET Core SDK 1.0.4(x64)
.NET Framework 4.7 Advanced Services
Aspose.CAD for .NET 17.4.0.0


All settings are same, but only Windows version is different.
Success Windows version : Windows 10 Enterprise

Sorry, I’m late… so busy in my company

@taegeom,

Can you please share files once again. Our product team is unable to download files and looks like Dropbox link is not working.

I was just sorting out my Dropbox.

I have tested the windows version several times, but it does not seem to be a version issue.

I think .net error!

The error really only happens on some computers and I can not find anything in common yet.

Your help is so grateful to me.

https://www.dropbox.com/s/hay4m5pf2v7p8wi/Aspose.CAD-for-.NET-master.zip?dl=0

@taegeom,

I have observed that you are facing issue on computers where you are using .NET Core. I am afraid, at the moment we do not have support for .NET Core in our API.

Thank you for your efforts for a long time issue.