We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert PDF to DOCX using C#.NET

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)

@pooja.jayan

An issue as PDFNET-51317 has been logged in our issue tracking system for the sake of correction. We will look into its details and keep you posted with the status of ticket resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.

Even if change the recognition mode to flow , still there is layout issues mainly wth tables

@pooja.jayan

We have recorded your concerns and will surely inform you as soon as the ticket is resolved. Please spare us some time.