Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having error when trying to get details from pdf page generated with html emoji code inside pdf text #701

Open
luffyfr opened this issue Apr 10, 2024 · 1 comment

Comments

@luffyfr
Copy link

luffyfr commented Apr 10, 2024

  • PHP Version: 8.1
  • PDFParser Version: 2.9.0

Description:

When trying to call $currentpage->getDetails(); with a pdf contains an emoji html code, I have this error :
Object of class Smalot\PdfParser\Header could not be converted to string
it's happening in Font.php file, when function getName return "[Unknown]";

Code

I fix this error replacing the code by :
$details['Encoding'] = $this->getName() != "[Unknown]" ? ($this->has('Encoding') ? (string) $this->get('Encoding') : 'Ansi') : 'Ansi';

Is that possible to check this,
Best Regards.

file-test.pdf

@k00ni k00ni added the bug label Apr 10, 2024
@GreyWyvern
Copy link
Contributor

I don't get any error, but I also get a string of six invalid bytes rather than an emoji.

The document stream is printing character at code point 76 from font F6, but it's not being interpreted as an emoji.

BT
/P <</MCID 1 >>BDC
/F6 11.3299999 Tf
1 0 .25 -1 66.046875 647 Tm
<76> Tj
EMC
ET

Output:

Anonymous, ������ (here html emoji code), 2021
1

Probably some kind of font decoding issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants