Free Support Forum - aspose.com

Exception when trying to convert Adobe Illustrator EPS to PNG


#1

The following exception error occurs when attempting to convert

%%[Error: TypeCheck; Offending Command: //setglobal]%%

Operand Stack (bottom…top)
[ true true /ct_Clone? ]

Execution Stack (bottom…top)
[ --file (pipe) – --*packedarray (0…1, 1) – //setglobal //TypeCheck ]

Dictionary Stack (bottom…top)
[ --dictionary (350)-- --dictionary (1)-- --dictionary (8)-- --dictionary (57)-- --dictionary (9)-- ]

Based on the following sample code
ofdEPS.ShowDialog()
sfdPNG.ShowDialog()

    Dim license As Aspose.EPS.License = New Aspose.EPS.License()
    Dim P As String = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase)
    P = New Uri(P).LocalPath
    license.SetLicense(P & "\Aspose.EPS.lic")

    Dim psStream As FileStream = New FileStream(ofdEPS.FileName, FileMode.Open, FileAccess.Read)
    Dim suppressErrors As Boolean = True
    Dim options As Ps2ApsConverterOptions = New Ps2ApsConverterOptions(psStream, suppressErrors)
    options.PageSize = New System.Drawing.Size(595, 842)

    Dim Converter As Ps2ApsConverter = New Ps2ApsConverter()

    Try
        Dim imagesBytes As Byte()() = converter.ConvertToImages(options)
        Dim i As Integer = 0

        For Each imageBytes As Byte() In imagesBytes
            Using fs As FileStream = New FileStream(sfdPNG.FileName, FileMode.Create, FileAccess.Write)
                fs.Write(imageBytes, 0, imageBytes.Length)
            End Using

            i += 1
        Next

    Finally
        psStream.Close()
    End Try

    If suppressErrors Then

        For Each ex As PsConverterException In options.Exceptions
            Console.WriteLine(ex.Message)
        Next
    End If

#2

@plapic

Thanks for contacting support.

Could you please share sample EPS file with us. We will test the scenario in our environment and address it accordingly.