diff --git a/src/api/pdfrenderer.cpp b/src/api/pdfrenderer.cpp index 774558aed7..4373b5b49d 100644 --- a/src/api/pdfrenderer.cpp +++ b/src/api/pdfrenderer.cpp @@ -354,6 +354,10 @@ char *TessPDFRenderer::GetPDFTextObjects(TessBaseAPI *api, double width, double const std::unique_ptr res_it(api->GetIterator()); while (!res_it->Empty(RIL_BLOCK)) { if (res_it->IsAtBeginningOf(RIL_BLOCK)) { + auto block_type = res_it->BlockType(); + if (!res_it->PTIsTextType(block_type)) { + continue; // ignore non-text blocks + } pdf_str << "BT\n3 Tr"; // Begin text object, use invisible ink old_fontsize = 0; // Every block will declare its fontsize new_block = true; // Every block will declare its affine matrix