Q: I'm trying to convert a PDF to XPS as shown below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using pdftron;
using pdftron.Common;
using pdftron.Filters;
using pdftron.SDF;
using pdftron.PDF;
using System.Diagnostics;
namespace pdf2xps {
class Program {
static void Main(string[] args) {
try {
pdftron.PDF.Convert.ToXps("c:\\license.pdf", "c:\\license.xps");
}
catch (PDFNetException e) {
Console.WriteLine(e.Message);
}
}
}
}
but I am getting the following error:
System.AccessViolationException was unhandled
Message="Attempted to read or write protected memory. This is often
an indication that other memory is corrupt."
Source="PDFNet"
StackTrace:
at trn.UString.__ctor(UString* )
at pdftron.PDF.Convert.ToXps(String in_inputFilename, String
in_outputFilename)
Any idea what I am doing wrong?
-----------------
A: The problem is that you didn't initialize PDFNet using
PDFNet.Initialize(). For a working sample project please take a look
at Convert sample project: http://www.pdftron.com/pdfnet/samplecode.html#Convert
System.AccessViolationException was unhandled
Message="Attempted to read or write protected memory. This is often
an indication that other memory is corrupt."
Source="PDFNet"
StackTrace:
at trn.UString.__ctor(UString* )
at pdftron.PDF.Convert.ToXps(String in_inputFilename, String
in_outputFilename)
--
You received this message because you are subscribed to the "PDFTron PDFNet SDK" group. To post to this group, send email to support@pdftron.com
To unsubscribe from this group, send email to pdfnet-sdk-unsubscribe@googlegroups.com. For more information, please visit us at http://www.pdftron.com