Error at generating PDF

Hi,
I am using Aspose.pdf.
I got one error while opening the pdf after generating.
Error is “There was error opening this document.The file is damaged and could not be reapired”.
could you tell me how to rectify this error

Hi,

Are you converting Word document to pdf? If so, please attach the documents, both original and converted. If you are just generating pdf document using Aspose.Pdf, please repeat the question in the appropriate forum.

Hi,
I am generating Document using Aspose.pdf.
I am sending the code

OleDbConnection conn = null;

conn = new OleDbConnection(strConn);

conn.Open();

OleDbCommand cmd = new OleDbCommand(“SELECT TOP 5 * FROM Categories”,conn);

OleDbDataAdapter da = new OleDbDataAdapter(cmd);

DataTable tableCat = new DataTable();

da.Fill(tableCat);

conn.Close();

for (int i = 0; i < tableCat.Rows.Count; i++)

{

Document categoryDoc = doc1.Clone();

DataRow categoryRow = tableCat.RowsIdea;

categoryDoc.MailMerge.Execute(categoryRow);

string StrSql=string.Format(“SELECT * FROM Products WHERE CategoryID = {0}”, categoryRow[“CategoryID”]);

conn.Open();

cmd = new OleDbCommand(StrSql,conn);

da = new OleDbDataAdapter(cmd);

DataTable tableProd = new DataTable();

da.Fill(tableProd);

conn.Close();

tableProd.TableName=“Products”;

categoryDoc.MailMerge.ExecuteWithRegions(tableProd);

while (categoryDoc.Sections.Count > 0)

{

Section section = categoryDoc.Sections[0];

categoryDoc.Sections.RemoveAt(0);

dstDoc.Sections.Add(section);

}

}

MemoryStream stream=new MemoryStream();

dstDoc.Save(stream,SaveFormat.FormatAsposePdf);

stream.Seek(0,SeekOrigin.Begin);

XmlDocument XmlDoc=new XmlDocument();

XmlDoc.Load(stream);

Aspose.Pdf.Pdf pdf1=new Aspose.Pdf.Pdf();

pdf1.IsImagesInXmlDeleteNeeded=true;

pdf1.BindXML(XmlDoc,null);

pdf1.Save(“letters.pdf”,Aspose.Pdf.SaveType.OpenInAcrobat,this.Response);


If this code is excuted then pdf give the error as mentioned i earlier.
If any other code is there in this page to generate pdf then also can’t open the pdf.

We can help quickly if you save the document as DOC instead of saving it as PDF and attach to this forum. We will try to convert it to PDF and reproduce the problem.

Hi Romank,
Thank you for replay.
I am first generating the Doc and then convert it into PDF.
already i have given the code to you.This example is just like product catalog example of aspose.word demos. There it generate the PDF but here it does not generate the PDF.Could you tell me the mistakes.

Thanking you

Please save the document as DOC and send to us or attach to the post. This will help us solve the problem quickly.

Sure we see your code but it is quite hard to generate a doc from it because we need the data etc.

Hi,
I am attaching the Doc file from the which is generate from the previous code.
find the attachment and give the replay.

It seems like em dash (long dash) located in the footer inside the centered text (xxxxxxxxx xxxxxxx – xxxx xxxxxxx) is not converted properly. So please replace it with a regular dash ("-") in each footer. It should help.

Is this being fixed in an upcoming version?

Sorry, I don’t understand. The document attached by vvramananet is converted properly using current versions of Aspose.Words and Apsoe.Pdf. Fix for what problem you are referring to?