Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Convert XPS to PDF - Exceptions garbled

$
0
0
Hi,

I've got the following problem: I'm trying to convert a xps file to pdf.
This works flawlessly. But if the xps-file is corrupted or the xps-file I want to convert does not exist, I get funny exceptions which I cannot catch (--> Attachment).

Can anyone help me please? Just catching the general exception like in the test code is not an option, since I need to know what went wrong for further processing.

Aspose.Pdf.dll version: 9.1.0
OS: Windows 7 Enterprise
.Net-Framework: .Net 4
Test Code:

using System;
using System.Threading;
using Aspose.Pdf;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            Aspose.Pdf.License lic = new License();
            lic.SetLicense("Aspose.Pdf.lic");
            Aspose.Pdf.LoadOptions loadOpt = new XpsLoadOptions();
            Aspose.Pdf.Document x = null;

            try
            {
                x = new Aspose.Pdf.Document(@"d:\tmp\asposetest.xps", loadOpt);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Thread.Sleep(60000);
            }

            x.Save(@"d:\tmp\asposetest.pdf");
        }
    }
}

Viewing all articles
Browse latest Browse all 3131

Trending Articles