Extract Data from PDF and Add to Worksheet

后端 未结 8 2056
情深已故
情深已故 2020-12-01 01:35

I am trying to extract the data from a PDF document into a worksheet. The PDFs show and text can be manually copied and pasted into the Excel document.

I am currentl

8条回答
  •  眼角桃花
    2020-12-01 02:22

    Using Bytescout PDF Extractor SDK is a good option. It is cheap and gives plenty of PDF related functionality. One of the answers above points to the dead page Bytescout on GitHub. I am providing a relevant working sample to extract table from PDF. You may use it to export in any format.

    Set extractor = CreateObject("Bytescout.PDFExtractor.StructuredExtractor")
    
    extractor.RegistrationName = "demo"
    extractor.RegistrationKey = "demo"
    
    ' Load sample PDF document
    extractor.LoadDocumentFromFile "../../sample3.pdf"
    
    For ipage = 0 To extractor.GetPageCount() - 1 
    
        ' starting extraction from page #"
        extractor.PrepareStructure ipage
    
        rowCount = extractor.GetRowCount(ipage)
    
        For row = 0 To rowCount - 1 
            columnCount = extractor.GetColumnCount(ipage, row)
    
            For col = 0 To columnCount-1
                WScript.Echo "Cell at page #" +CStr(ipage) + ", row=" & CStr(row) & ", column=" & _
                    CStr(col) & vbCRLF & extractor.GetCellValue(ipage, row, col)
            Next
        Next
    Next
    

    Many more samples available here: https://github.com/bytescout/pdf-extractor-sdk-samples

提交回复
热议问题