Hello,
Thank you for your previous correspondence.
Based on the information you provided, I am uncertain about which specific rectangular box you are referring to in terms of determining whether it is blank or not. In light of the screenshot you shared, I have prepared the following code snippet for your reference. The example code is designed to extract text from tables within a PDF file.
- Code: Select all
# Set the path to the Spire.Pdf.dll file
$converterpath = 'F:\demo\'
# Load the Spire.Pdf.dll assembly
Add-Type -Path "$($converterpath)\Spire.Pdf.dll"
# Create a new Spire.Pdf.PdfDocument object
$pdf = New-Object Spire.Pdf.PdfDocument
# Load a PDF file from the specified path
$pdf.LoadFromFile("F:\demo\Input.pdf")
# Create a PdfTableExtractor object
$extractor = New-Object Spire.Pdf.Utilities.PdfTableExtractor($pdf)
# Iterate through each page of the PDF
for ($i = 0; $i -lt $pdf.Pages.Count; $i++) {
$pdfTables = $extractor.ExtractTable($i)
# Check if tables are extracted
if ($pdfTables -ne $null -and $pdfTables.Length -gt 0) {
# Iterate through each table
for ($tableNum = 0; $tableNum -lt $pdfTables.Length; $tableNum++) {
# Iterate through each row of the table
for ($rowNum = 0; $rowNum -lt $pdfTables[$tableNum].GetRowCount(); $rowNum++) {
# Iterate through each column of the table
for ($colNum = 0; $colNum -lt $pdfTables[$tableNum].GetColumnCount(); $colNum++) {
$text = $pdfTables[$tableNum].GetText($rowNum, $colNum)
# Check if the cell is not empty
if ($text -ne $null -and $text -ne " ") {
Write-Host $text
} else {
Write-Host "The cell is a blank cell"
}
}
}
}
}
}
Please review the code and let me know if it aligns with your requirements. If you have any further details or specific instructions regarding the analysis of the rectangular box, please do not hesitate to provide them so that I can assist you more effectively.
Sincerely,
Annika
E-iceblue support team