I want to read the coordinates of a particular line in a particular page of the pdf using python. However, I am unable to find the suitable library to do so. Therefore, I'm using this code mentioned below in C#. Anyone who can help me to find a wrapper in python through which this code becomes operational in python.
Code:
using System;
using System.Drawing;
using Bytescout.PDFExtractor;
<span data-scayt_word="namespace" data-scaytid="18">namespace</span> <span data-scayt_word="FindText" data-scaytid="19">FindText</span>
{
class Program
{
static void Main(string[] <span data-scayt_word="args" data-scaytid="43">args</span>)
{
// Create Bytescout.PDFExtractor.TextExtractor instance
<span data-scayt_word="TextExtractor" data-scaytid="20">TextExtractor</span> extractor = new <span data-scayt_word="TextExtractor" data-scaytid="21">TextExtractor</span>();
extractor.RegistrationName = "demo";
extractor.RegistrationKey = "demo";
// Load sample PDF document
extractor.LoadDocumentFromFile("sample1.pdf");
<span data-scayt_word="int" data-scaytid="22">int</span> <span data-scayt_word="pageCount" data-scaytid="48">pageCount</span> = extractor.GetPageCount();
<span data-scayt_word="RectangleF" data-scaytid="50">RectangleF</span> location;
for (<span data-scayt_word="int" data-scaytid="23">int</span> i = 0; i < <span data-scayt_word="pageCount" data-scaytid="49">pageCount</span>; i++)
{
// Search each page for "<span data-scayt_word="ipsum" data-scaytid="24">ipsum</span>" string
if (extractor.Find(i, "<span data-scayt_word="ipsum" data-scaytid="25">ipsum</span>", false, out location))
{
do
{
Console.WriteLine("Found on page " + i + " at location " + location.ToString());
}
while (extractor.FindNext(out location));
}
}
Console.WriteLine();
Console.WriteLine("Press any key to continue...");
Console.ReadLine();
}
}
}