Hai,
I am trying to convert a pdf document to docx format which includes table.
But when I try convrsion, I am getting values merged in tables, and it is not having an exact look as pdf file.
code I am using:
private static byte[] convertPdfToDoc(string filePath)
{
byte[] pdfData = System.IO.File.ReadAllBytes(filePath);
byte[] wordData = null;
if (filePath != string.Empty)
{
DocSaveOptions saveOption = new DocSaveOptions();
saveOption.Mode = DocSaveOptions.RecognitionMode.Textbox;
saveOption.Format = DocSaveOptions.DocFormat.DocX;
//saveOption.re = 2.5f;
saveOption.AddReturnToLineEnd = true;
saveOption.RecognizeBullets = false;
using (MemoryStream memoryStream = new MemoryStream(pdfData))
{
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(memoryStream);
using (MemoryStream outputStrteam = new MemoryStream())
{
pdfDocument.Save(outputStrteam, saveOption);
pdfDocument.FreeMemory();
pdfDocument.Dispose();
wordData = outputStrteam.ToArray();
}
}
}
System.IO.File.WriteAllBytes(Path.Combine(path, "sampleFile.docx"), wordData);
return wordData;
}
and the document is demo.pdf (253.3 KB)
Using a Licensed and Latest version of Aspose
out.PNG (12.9 KB)