using Emergency_Equipment;
public class PDFConverter
public static string ConvertAndExtract(Tabula.PageArea tabulaArea)
throw new ArgumentNullException(nameof(tabulaArea), "The input Tabula PageArea cannot be null.");
int width = tabulaArea.Right - tabulaArea.Left;
int height = tabulaArea.Bottom - tabulaArea.Top;
throw new ArgumentException("The calculated width is negative. Invalid Tabula PageArea dimensions.");
throw new ArgumentException("The calculated height is negative. Invalid Tabula PageArea dimensions.");
var emergencyArea = new Emergency_Equipment.PageArea
var extractor = new Emergency_Equipment.PDFExtractor();
return extractor.ExtractText(emergencyArea);
public static void Main(string[] args)
var tabulaArea = new Tabula.PageArea
string extractedText = PDFConverter.ConvertAndExtract(tabulaArea);
Console.WriteLine($"Extracted Text: {extractedText}");
catch (ArgumentNullException ex)
Console.WriteLine($"Error: {ex.Message}");
catch (ArgumentException ex)
Console.WriteLine($"Error: {ex.Message}");
Console.WriteLine($"An unexpected error occurred: {ex.Message}");
namespace Emergency_Equipment
public int X { get; set; }
public int Y { get; set; }
public int Width { get; set; }
public int Height { get; set; }
public class PDFExtractor
public string ExtractText(PageArea area)
public int Left { get; set; }
public int Top { get; set; }
public int Right { get; set; }
public int Bottom { get; set; }