Free Support Forum - aspose.com

Issues while converting a Document to PDf

Hi,

I am using Aspose.Word version 5.0.0.0 for my 64 bit windows 2003 / vs 2005 . After document to pdf using Aspose.Pdf version 3.6.2.0 when I open I get the following error

" Acrobat could not open because it is either not a supported file type or because the file has been damaged wasn't correctly decoded "

Code

Document doc = new document (stream1)

//Save the document in Aspose.Pdf.Xml format into a memory stream.
MemoryStream stream = new MemoryStream();
doc.Save(stream, SaveFormat.AsposePdf);
stream.Seek(0, SeekOrigin.Begin);

//Load the document into an XmlDocument
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(stream);

//Load the XML document into Aspose.Pdf
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindXML(xmlDoc, null);

//Set Font Map for better performance
pdf.IsTruetypeFontMapCached = true;
pdf.TruetypeFontMapPath = System.IO.Path.GetTempPath();

//Now produce the PDF file.
pdf.Save(new stream) ;
}

Cheers

Cheers

Sriram

Hello!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for you interest in Aspose products.

This sounds very strange. Please attach here the document reproducing this issue. I’ll experiment on my side and provide more information.

Regards,

Hi Klepus

Please find the document atttached.

Cheers

Sriram

Hi Klepus

Please find the converted pdf document also attached.

Cheers

Sriram

Hello!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I am unable to open your PDF too. But when I tried converting on my side everything was okay. My PDF came much smaller in size: 3.5K instead of 26K. When I opened your file in binary editor I figured out that it doesn’t look like PDF at all. Maybe this is some other file just renamed to have a “.pdf” extension.

Anyway try converting the source document again. If this doesn’t help post the full code snippet you are using for conversion to this thread. From the code that you provided I see something looking as pseudocode:

//Now produce the PDF file.
pdf.Save(new stream) ;

Regards,