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

Characters are translated correctly in Demo but not in Local #334

Closed
CharmaineLohSiYing opened this issue Sep 16, 2020 · 1 comment · Fixed by #342
Closed

Characters are translated correctly in Demo but not in Local #334

CharmaineLohSiYing opened this issue Sep 16, 2020 · 1 comment · Fixed by #342
Labels

Comments

@CharmaineLohSiYing
Copy link

CharmaineLohSiYing commented Sep 16, 2020

Hi,

I have used this file for testing both on the demo page and on my local server (using PHP version 7.4.9).
tested-file.pdf

This is the output on the demo page:

demo output

and this is the output on my local server:

local output

To view the decimal values of the unmatched characters, I replaced "return $use_default ? self::MISSING : $char;" with "return $use_default ? self::MISSING : $dec." ";" in the translatechar() function in Font.php:

local decimal

From this, I managed to match these (abnormally large) decimal values with the characters that they are 'supposed' to be matched with:

  • decimal 0 --> 'y'
  • decimal 18432 --> 'e'
  • decimal 768 --> ' ' (space)
  • decimal 22272 --> 't'
  • decimal 20992 --> 'o'
    ...etc.
  1. I noticed that these large decimal values usually appear when my pdf file is generated by converting from a webpage (using the print --> convert to pdf function). Could it be that files which are generated this way have different encoding rules?

  2. May I know what changes I can make to attain the same result as on the demo page?

Thank you!

@k00ni k00ni added the bug label Sep 16, 2020
@Connum
Copy link
Contributor

Connum commented Sep 21, 2020

Reading "works in the demo but not on my dev system" is ringing my alarm bells now! 😅 I was able to confirm yet again that this is the same regression introduced by 4f4fd10 as a fix for #260, as in #322 and #319! The more I see issues caused by that "fix" for alleged bug that remains yet to be reproduced, in some mysterious PDF file that was never provided... the more I tend to recommending to revert that fix.

Connum added a commit to Connum/pdfparser that referenced this issue Sep 22, 2020
Connum added a commit to Connum/pdfparser that referenced this issue Sep 22, 2020
k00ni pushed a commit that referenced this issue Sep 30, 2020
)

* Revert "Fix \f crush"

This reverts commit 4f4fd10.

* revert 4f4fd10 preserving fix for #260, fixing #319, #322 and #334

* reduced sample PDF and added more descriptive comment to the two new test cases
partulaj pushed a commit to partulaj/pdfparser that referenced this issue Dec 21, 2020
…ot#322 and smalot#334 (smalot#342)

* Revert "Fix \f crush"

This reverts commit 4f4fd10.

* revert 4f4fd10 preserving fix for smalot#260, fixing smalot#319, smalot#322 and smalot#334

* reduced sample PDF and added more descriptive comment to the two new test cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants