ASPOSE.Net Converting .docx to PDF documents(PDF triggeres such formatting issues)

Documents.zip (90.6 KB)
I have tried converting a word document(.Docx) to PDF format using ASPOSE.PDF, using following is the code.

string File = “D:\Test-Word.Docx”;
Aspose.Words.Document doc = new Aspose.Words.Document(File);
System.IO.MemoryStream pdfOoutStream = new System.IO.MemoryStream();
doc.Save(pdfOoutStream, Aspose.Words.SaveFormat.Pdf);

Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(pdfOoutStream);
byte[] docBytes = null;
pdfOoutStream = new System.IO.MemoryStream();
pdfDocument.Save(pdfOoutStream);
docBytes = pdfOoutStream.ToArray();
FileStream output = new FileStream(“D:\Test-PDF.pdf”, FileMode.Create,
FileAccess.Write);
// Write byte array contents in the output file stream
output.Write(docBytes, 0, docBytes.Length);
// Close output file
output.Close();

and i found it converted PDF document is triggeres such formatting issues. I have attached the word document(.Docx) and converted document in PDFformat.

Please give me a solution asap.

Thanks in advance.

@ksmani82

Thanks for your patience.

Please note that you only need Aspose.Words for .NET API to perform DOCX to PDF conversion and later, you can use Aspose.Pdf for .NET to manipulate resultant PDF as per your requirement. We have tested the scenario with following code snippet while using Aspose.Words for .NET 17.7 and were unable to notice any formatting issue in the resultant PDF.

For your reference, an output document has also been attached.

Aspose.Words.Document doc = new Words.Document(dataDir + "Test-Word.docx");
doc.Save(dataDir + "Test-Word.pdf", Words.SaveFormat.Pdf);

Test-Word.pdf (37.1 KB)

Furthermore, we have also tried to perform conversion through the code snippet which you have shared with us, while using Aspose.Pdf for .NET 17.7 and resultant PDF (Test-PDF2.pdf (37.2 KB)) was fine and there were no formatting issue in that.

Would you please try the scenario at your end, with latest versions of the APIs and in case if you still face any issue, please share some details regarding your working environment i.e OS Version, Application Type, Target Framework, etc. This would help us in testing the scenario accordingly and observe the issue in our environment, if there is any.