File parsed returns unreadable text
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 2.7k
- Forks
- 579
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
Thank you for the awesome Pdfparser library, it really helps me a lot with my projects, and use it quite often recently..
But I found a difficulty with my last project which was my pdf file was converted into some unreadable format text instead of plain text..
My friend told me I should do something with the encoding, but I'm not really sure..
So, I would really glad if anybody can give me some hint or idea if I missing something or it was indeed a bug from the library..
I've tried to parse it as a whole and by each pages btw, it was still not working..

Here is my code,
$PdfParser = new \Smalot\PdfParser\Parser();
$pdf = $PdfParser->parseFile($file);
$text -> getText();
echo $text;
And this is what it returns,
JHGSA IUYSHJG st GUH st GUH HUYGAH st JHGSA st st ttt t ss1 ss2 t 21666 !" #ssst #tt #t #ss1 #ss2 $# $ t%&t '(#tt 2$# t $$sst 2$ 2$'(#t 2$$sst t%&t ' # ttts !"#$ tt $$ss 2$$ss )tst t"+t t$ )tttst ,"1st$'(#t #s%( tt )t $t tst tss1 , )$ %' # ' # t$st HUYGAH IUYSHJG #$#$ %#$# % "t-." s )t$# )t$'(#t $s(%$" t%&t ttt 1st$%$ss tt tt%&t tt%&t ss/%$sst )$$sst )$'(#t %%'0t+#1 2sst t1 )tst )t$$ss tt%&t ttts )$# ,"t%&t ! "#$"#%!& !"#"#%!& !"#"#%!& ! ' ' ( )Y ! Z,-. JHGSA IUYSHJG GUH HUYGAH #sst t ss%tt# )ttt )t, )t )t($ '3st t % # ts%'1 )t*#t /%t$ss ttt%&t & tt(% & t-tts tt )tt 2$%$ss )tss2 )t' # t$st 2$tt%$ss 1st$$ss"tt t )t$$ss"tt t$%$ss t$$sst s$t%t )t%&t )$$ss )$%$ss )$tt%$ss $ t' ss ss/%t ' ss IUYSHJG& ' ss$ %%t1 tss4t tss5st tss5 tss5t tss51 tss52 ' # tst t' # ttts )t' st t$%" tt+t%" st%&t s&tt sss st sst st ! //$01$1% ) 2 (2) 2 () 31!#%%#% !"#"#%!& !"#"#%!& &$4$04%%%% ' ' ! &$4$04%%%% !"#$"#%!& !"#"#%!& !"#"#%!& ! ' ' ( )Y # Z,-.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the report with the supplied PHP snippet, the affected PDF, and the parseFile/getText flow. Inspect how this PDF's encoded text is handled and determine whether the output can be returned as readable plain text; the issue is done when the behavior is corrected or the limitation is clearly established.
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
- 25/100