Excel Conversion

Hi Team,

I need to convert pdf file into a spreadsheet javascript platform. I attached both pdf and excel files. Give a sample for this scenario.

Or

any other way achieve this in spreradsheet?

escalated

Thanks,
Saravanan

Attachment: sample_file_e68e338e.7z

13 Replies 1 reply marked as answer

JE Jeeva May 6, 2021 01:50 AM UTC

any update on this?


SP Sangeetha Priya Murugan Syncfusion Team May 6, 2021 02:44 PM UTC

Hi Jeeva, 
 
Thank you for contacting Syncfusion support. 
 
We have checked your reported requirement and we would like to let you know that, currently we don’t have inbuilt support to convert PDF to Excel document in our PDF and XLSIO library. Meanwhile, we have done the Open/ Save (server side) functionality in ASP.NET only for Spreadsheet control. So, we need to check the feasibility of this requirement and we will update you the further details on May 10th, 2021. We appreciate your patience until then. 
 
Regards, 
Sangeetha M 



JE Jeeva May 6, 2021 06:16 PM UTC

Thanks for your reply….

1.       1. Is it possible to convert the pdf to json?

          Eg:   https://help.syncfusion.com/js/webapi/pdfviewer


2.       2. After is it correct to assign that converted json to spreadsheet datasource?

spreadsheet.openFromJson({ file: jsonData });

 

3.       3. We saw your syncfusion kb documentation, in this way can you implement our scenario in spreadsheet?

     Eg:      https://www.syncfusion.com/kb/8889/how-to-convert-the-pdf-document-into-excel

                 https://www.syncfusion.com/kb/9851/how-to-convert-tables-in-pdf-document-to-excel-file

                 https://www.syncfusion.com/kb/9642/how-to-extract-form-field-data-from-pdf-and-save-it-in-the-database


4.     4. If ours requirement can't achieve by ej2 spreadsheet please give solution in ej1 spreadsheet?

          I really hope you give a workaround for asked requirement.



SP Sangeetha Priya Murugan Syncfusion Team May 7, 2021 06:58 AM UTC

Hi Jeeva, 
 
Thank you for your update. 
 
We have checked your reported requirement and we would let you know that, we have done the Open/ Save (server side) functionality in ASP.NET only for Spreadsheet control. Meanwhile, we don’t have inbuilt support to convert PDF to Excel in PDF and XLSIO library. And we are using the XLSIO library to load the excel in spreadsheet. So, we have provided you a workaround solution, that converts the PDF to image and image file to excel file. And load the converted excel file in spreadsheet through openFromJson method in created event as like as below. 
 
created: (): void => { 
    fetch('http://localhost:51635/Home/CreateDocument') 
      .then(response => response.json()) 
      .then(data => { 
        console.log(data); 
        spreadsheet.openFromJson({ file: data }); 
      }); 
  } 
 
 
 
 
public IActionResult CreateDocument() 
        { 
            using (ExcelEngine excelEngine = new ExcelEngine()) 
            { 
                //Uses the Syncfusion.EJ2.PdfViewer assembly 
                PdfRenderer pdfExportImage = new PdfRenderer(); 
                //Loads the PDF document 
                pdfExportImage.Load("pdf.pdf"); 
                //Exports the PDF document pages into images 
                Bitmap bitmapimage = pdfExportImage.ExportAsImage(0); 
                //Save the exported image in disk 
                bitmapimage.Save("Image" + ".png"); // convert the PDF file to image file 
                IApplication application = excelEngine.Excel; 
                application.DefaultVersion = ExcelVersion.Excel2013; 
                IWorkbook workbook = application.Workbooks.Create(1); 
                IWorksheet worksheet = workbook.Worksheets[0]; 
                // Adding Text to A1 cell 
                worksheet.Range["A1"].Text = "PDF TO Excel"; 
                //Adding a picture 
                FileStream imageStream = new FileStream("Image.png", FileMode.Open, FileAccess.Read); 
                IPictureShape shape = worksheet.Pictures.AddPicture(1, 1, imageStream); 
 
                FileStream filePath = new FileStream("Sample.xlsx", FileMode.Create); // saved the converted image file to excel 
                workbook.SaveAs(filePath); 
                imageStream.Dispose(); 
                filePath.Close(); 
                workbook.Close(); 
 
                OpenRequest open = new OpenRequest(); 
                FileStream inputStream1 = new FileStream("Sample.xlsx", FileMode.Open); 
                IFormFile formFile = new FormFile(inputStream1, 0, inputStream1.Length, "", "Sample" + ".xlsx"); // converting MemoryStream to IFormFile  
                open.File = formFile; 
                var content = Workbook.Open(open); // load the created excel in spreadsheet 
                inputStream1.Dispose(); 
                return Content(content); 
 
 
            } 
        } 
 
 
 
For your convenience we have prepared the video demonstration of this. Please find the link below. 
 
 
Note: launch the service first and then open the stack blitz sample for import action.  
 
Could you please check the above details and get back to us, if you need any further assistance on this. 
 
Regards, 
Sangeetha M 




JE Jeeva May 7, 2021 08:11 AM UTC

We appreciate your effort. We saw the video you sent. But this is not our requirement. In it you send the PDF file directly to the spreadsheet. But our requirement is to change the pdf values through an editable spreadsheet like adobe reader(pdf values editable in spreadsheet cells like before given excel). Please give a solution/workaround based on that ej1 or ej2. We look forward to your quick Solution.

escalated..


SP Sangeetha Priya Murugan Syncfusion Team May 7, 2021 12:36 PM UTC

Hi Jeeva, 
 
Thank you for your update. 
 
As we have stated earlier, we do not have direct support for “Converting PDF to Excel document”. However, as a workaround we can be able to achieve your requirement by using the tabula extractor and Syncfusion library. We have modified the existing Net Core sample for converting the PDF document into Excel by using tabula extractor.   
 
 
 
  
Your provided PDF file(pdf.pdf) contains an image. So, it is loaded with image in spreadsheet and it can’t be editable. In the above sample we have demonstrated with sample PDF file, that extract PDF to excel table and load to spreadsheet in editable format. 
 
Note: launch the service first and then open the stack blitz sample for import action. Above workaround tabula extractor will work only for table contents in pdf document 
 
Please refer to the below KB documentation for more details  
  
Please find the below notes for running this sample,  
 
1.The latest version of Java should be installed in your machine to execute the previous sample and refer to the installation path while creating the ProcessStartInfo. 
2. Place the input PDF file and tabula executable jar file in “Resource\target” folder in the previous sample. 
  
Could you please check the above links and get back to us, if you need any further assistance on this. 
 
Regards, 
Sangeetha M 



JE Jeeva May 8, 2021 02:16 AM UTC

We will check your sample and update you further.


SP Sangeetha Priya Murugan Syncfusion Team May 10, 2021 10:58 AM UTC

 
Hi Jeeva, 
 
Thank you for your update, we will wait to hear from you. 
 
Regards, 
Sangeetha M 




JE Jeeva May 11, 2021 07:29 AM UTC

Hi Team,

We create a sample with a combination of syncfusion Spreadsheet and PDF viewer. In this pdf as converted as json while button click. But it's not working while assigning to spreadsheet open or openFromJson method. How to do this? Please help us and we expect a solution sample on EOD.

Our sample link:
https://stackblitz.com/edit/w2trpa-f6mebw?file=index.ts

Our Requirement:
Open the pdf file in pdf viewer
While clicking convert pdf to spreadsheet button, opened pdf inner values reflect in spreadsheet(editable).

We are waiting for your reply...

Regards,
Jeeva


JE Jeeva May 11, 2021 08:00 AM UTC

Please consider this higher priority..


JE Jeeva May 11, 2021 01:27 PM UTC

Hi Team,

Any update on this?


JE Jeeva May 12, 2021 09:22 AM UTC

Hi Team,

We are waiting for your solution.


SP Sangeetha Priya Murugan Syncfusion Team May 12, 2021 09:42 AM UTC

Hi Jeeva, 
 
Thank you for your update. 
 
We have checked your reported requirement and as we have stated in our previous update, we don’t have inbuilt support to load the PDF file directly in spreadsheet. However, we have already provided the workaround solution to load the PDF file in spreadsheet by using PDF, XLSIO and tabula extraction in our previous updates.  
 
Meanwhile, in your provided sample you have saved the JSON from the PDF viewer control and they construct the JSON based on the PDF viewer control structure. And it is not compatible with our Spreadsheet JSON file. The spreadsheet loads the JSON data using openFromJson only which is saved using saveAsJson method. In this we have constructed the whole workbook data based on our control architecture. For more details, please refer the below link. 
 
 
Could you please check the above details and get back to us, if you need any further assistance on this. 
 
Regards, 
Sangeetha M 


Marked as answer
Loader.
Up arrow icon