Hi,
I am trying to convert XPS file to PDF using acPDFCreatorLib API. I can able to convert XPS to PDF but encoding is not proper in converted PDF file. PDF file is showing some special characters only not actual XPS document contents.
Code Snippet :
acPDFCreatorLib.Initialize();
IacDocument document = new IacDocument();
XpsDocument xpsPackage = new XpsDocument("InputXPS.xps", FileAccess.Read, CompressionOption.NotCompressed);
FixedDocumentSequence fixedDocumentSequence = xpsPackage.GetFixedDocumentSequence();
MemoryStream ms = new MemoryStream();
XpsSerializerFactory xpsSerializerFactory = new XpsSerializerFactory();
SerializerWriter serializerWriter = xpsSerializerFactory.CreateSerializerWriter(ms);
serializerWriter.Write(fixedDocumentSequence);
FileStream pdfFile = new System.IO.FileStream("PrintFromXPS.pdf", FileMode.Create, FileAccess.Write, FileShare.Read);
document.Open(ms, String.Empty);
document.Save(pdfFile, IacFileSaveOption.acFileSaveAll);
ms.Close();
pdfFile.Close();
acPDFCreatorLib.Terminate();
I have created XPS document from the web page http://www.irs.gov/pub/irs-pdf/f1040.pdf?portlet=3.
Thanks