Цей приклад демонструє витягнення штрих-кодів з документа PDF з використанням нестандартних налаштувань.
Java
// Ініціалізуйте парсер з документом PDF
try (Parser parser = new Parser("input.pdf"))
{
// Переконайтеся, що документ підтримує читання штрих-кодів
if (!parser.getFeatures().isBarcodes())
{
return;
}
// Застосуйте фільтрацію з параметрами штрих-кодів
BarcodeOptions options = new BarcodeOptions(QualityMode.Low, QualityMode.Low, "QR");
// Витягніть штрих-коди за допомогою парсера
Iterable<PageBarcodeArea> barcodes = parser.getBarcodes(options);
// Обробляйте кожен результат штрих-коду
for (PageBarcodeArea barcode : barcodes)
{
System.out.println("Page: " + String.valueOf(barcode.getPage().getIndex()));
System.out.println("Value: " + barcode.getValue());
}
}