smalot / smalot/pdfparser

Parsed output from PDF Identity-h/CID-Fonts is not readable

Open
#534 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
2.7k
Forks
579
Avg merge
2m
Merged PRs (30d)
1

Description

  • PHP Version: 7.3
  • PDFParser Version: 2.1.2
Description:

I have two PDFs from my bank account, one is using ANSI fonts and since 2 months they are using identify-h CID Fonts.
The PDF Parser doesn't return readable text anymore. Is there any config/option to parse with this font.

PDF input

Sorry not possible as business bank statement

Expected output & actual output

The first two lines with the expected output from older PDFs look like this:
Postbank
Card Service Hamburg

Now it looks like this:
3�R�V�W�E�D�Q�N
�&�D�U�G��6�H�U�Y�L�F�H��+�D�P�E�X�U�J

Code

$parser = new \Smalot\PdfParser\Parser();
$pdf = $parser->parseFile($pdf_file);

$text = $pdf->getText();

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported PHP 7.3 and PDFParser 2.1.2 code path using Parser::parseFile() and getText(), then investigate how the parser handles identity-h/CID fonts. The reported bank PDFs are unavailable, so completion would require a reproducible input and readable text matching the expected Postbank and Card Service Hamburg output.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.