Encoding Problem

The PDF Creator enables you to create secure PDF documents and to view, print and process existing PDF documents.
If you have any questions about the installation and usage of the PDF Creator please post them here.
Post Reply
khan007
Posts: 6
Joined: Wed Sep 10 2008

Encoding Problem

Post by khan007 »

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
Post Reply