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

Free Support Forum - aspose.com

Convert PDF to Excel not working

Hi

I am trying to convert PDF file to Excel. However, I tried multiple PDFs but they all seem to only export a 2K file that is missing all or most of the content except first header.

See code I am using below, anything look incorrect?

try<o:p></o:p>

{

//var license = new Aspose.Cells.License();

//license.SetLicense("Aspose.Total.lic");

SPWeb web = properties.Web;

Aspose.Pdf.Document doc =

new Aspose.Pdf.Document(properties.ListItem.File.OpenBinaryStream());

using (var memoryStream = new MemoryStream())

{

using (var stream = properties.ListItem.File.OpenBinaryStream())

stream.CopyTo(memoryStream);

Aspose.Pdf.Document pdfDoc = new Aspose.Pdf.Document(memoryStream);

memoryStream.Seek(0, SeekOrigin.Begin);

//Even exporting using text file Absorber, it shows only header line, I tried multiple pdf files

//Aspose.Pdf.Text.TextAbsorber absorber = new Aspose.Pdf.Text.TextAbsorber();

//absorber.TextSearchOptions.LimitToPageBounds = true;

//pdfDoc.Pages.Accept(absorber);

//File.WriteAllText(@"E:\Shared\temp_modified123.txt", absorber.Text);

pdfDoc.Save(memoryStream, Aspose.Pdf.SaveFormat.Excel);

Aspose.Cells.Workbook workBook = new Workbook(memoryStream);

workBook.Save(@"E:\Shared\temp_modified123.xlsx");

}

}

catch (Exception er)

{ }

finally

{

base.ItemAdded(properties);

}


Thank you!

Chris

Hi Chritopher,

Thanks for your inquriy. It seems you are getting issue because you are evaluating Aspose.Pdf without a valid license file. Please make a request for 30 days temporary license and apply it in your code to evaluate our product without any limitation. It will resolve the issue.

However if the issue persist then please share your sample PDF document here, we will look into it and will guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,

Great will try that, thank you!