Free Support Forum - aspose.com

Exception when saving DXF, DWG,... files to PDF or TIFF (Aspose.Pdf 18.1.0.0 is needed)


#1

When trying to save CAD files to Pdf or Tiff formats, an exception occurs “image saving failed.” an inner exception indicates that Aspose.Pdf version=18.1.0.0 cannot be found.

The project also references Aspose.Pdf version 17.4.0.0.

when Aspose.Pdf is not referenced all is fine.

GR


#2

@giusepper,

I have observed your comments. Can you please share source files so that we can further investigate to help you out. Also please share environment details along with sample project to reproduce issue on our end.


#3

Hi,

Windows 8.1.
VS 2010 SP1, VS 2015 Update 2.

Attached is a VS solution:

ConsoleApplication.zip (337.0 KB)
(you need to reference CAD.dll 18.3.0.0 and Pdf.dll 17.4.0.0 to the project - were too big to upload)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
try
{
Aspose.CAD.Image CAD1 = null;
try { CAD1 = Aspose.CAD.Image.Load(“1343939490.dwg”); }
catch { }

            Aspose.CAD.ImageOptions.CadRasterizationOptions resterOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
            resterOptions.PageHeight = 1600;
            resterOptions.PageWidth = 1600;
            resterOptions.AutomaticLayoutsScaling = true;
            resterOptions.NoScaling = false;

            Aspose.CAD.ImageOptions.TiffOptions PO1 = new Aspose.CAD.ImageOptions.TiffOptions(Aspose.CAD.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
            PO1.VectorRasterizationOptions = resterOptions;

            CAD1.Save("1343939490.dwg" + ".tiff", PO1);
        }
        catch (Exception ex) 
        {
            try { Console.WriteLine(ex.Message.ToString()); }
            catch { }
            try { Console.WriteLine(ex.InnerException.InnerException.Message.ToString()); }
            catch { }
        }
        Console.ReadKey();
    }
}

}

output:
Image saving failed.
Could not load file or assembly ‘Aspose.Pdf, Version=18.1.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

(*) when only Aspose.CAD.dll 18.3.0.0 is referenced, all is fine.
(**) when Aspose.Pdf.dll 17.4.0.0 is referenced too (not even used), the problem starts.

GR


#4

@giusepper,

I have observed your comments. Can you please share source image so that we can further to investigate to help you out. As i can see you have not shared any source image in sample project. Please share requested file so that we can further investigate to help you out.


#5

Attached.

1343939490.zip (328.6 KB)


#6

@giusepper,

I have worked with your sample code and source file using Aspose.CAD for .NET 18.3 and unable to observe any issue. I have also shared my generated result with you for your kind reference. I also like to inform that you do not need Aspose.Pdf for conversion of DWG file to TIFF format. Also please try to use Aspose.Pdf version 18.1 in your project to overcome problem. 1343939490.dwg.zip (60.5 KB)


#7

OK.

i have created a new project that did not include the Aspose.Pdf.dll reference and had to place it in a different folder - it is working.

(*) even placing Aspose.Pdf.dll file in the same folder as the executable raises this exception.

a strange attraction between Aspose.CAD.dll and Aspose.Pdf.dll.

GR


#8

@giusepper,

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


#9

Aspose.CAD for .NET 18.12:

CADNET-663 Aspose.CAD conflict with Aspose.PDF Enhancement

typo?
should be CADNET-563?


#10

@giusepper,

The concerned issue has been marked as resolved in Aspose.CAD for .NET 18.12. If you still find issue then please provide a working sample project reproducing the issue on your end along with version information for Aspose.PDF as well.