Hello,
Thank you for your inquiry.
Our Spire.PDF supports the issue of getting the location of the specified text, but not the cell where the specified text is located. Please refer to the following code to get the text position information:
- Code: Select all
from spire.pdf.common import *
from spire.pdf import *
inputFile = "input.pdf"
def AppendAllText(fname: str, text: List[str]):
fp = open(fname, "w",encoding = "utf-8")
for s in text:
fp.write(s + "\n")
fp.close()
pdf = PdfDocument()
pdf.LoadFromFile(inputFile)
result = None
builder = []
for i in range(pdf.Pages.Count):
page = pdf.Pages.get_Item(i)
result = page.FindText("certain text",TextFindParameter.none).Finds
for find in result:
builder.append(find.Position.ToString()+"\r\n")
fileName = "Extraction.txt"
AppendAllText(fileName, builder)
pdf.Close()
Also, currently our Spire.PDF for Python does not support extracting text from tables in PDF documents. But this feature is currently on our upgrade list. I will keep you informed once this feature is implemented.
Sincerely,
Annika
E-iceblue support team