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

Link not recognised in PDF #6

Closed
GoogleCodeExporter opened this issue Mar 20, 2015 · 10 comments
Closed

Link not recognised in PDF #6

GoogleCodeExporter opened this issue Mar 20, 2015 · 10 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Open the attached PDF in Chrome/Chromium.
2. Click the text "Click to view Manual"

What is the expected output? What do you see instead?
The link should be followed (to 
http://support.feralinteractive.com/docs/en/hitmanabsolution/latest/steam/manual
/). This works with Adobe Reader and in Apple Preview / Safari.

What version of the product are you using? On what operating system?
This behaviour has been observed on Mac OS 10.7 and 10.9 using both:
Google Chrome 35.0.1916.114
Chromium 37.0.2018.0 (273185)

Please provide any additional information below.


Original issue reported on code.google.com by jem...@feralinteractive.com on 28 May 2014 at 11:49

Attachments:

@GoogleCodeExporter
Copy link
Author

Original comment by jam@chromium.org on 28 May 2014 at 6:02

@GoogleCodeExporter
Copy link
Author

Original comment by bo...@foxitsoftware.com on 2 Jun 2014 at 11:05

  • Changed state: Started

@GoogleCodeExporter
Copy link
Author

Original comment by bo...@foxitsoftware.com on 2 Jun 2014 at 11:06

@GoogleCodeExporter
Copy link
Author

This is caused by trailing '\0' in url and affecting other pdf with text link. 
Should change pdfium_page.cc, line 410 to

     for (size_t j = 0; j < link.url.length()-1; ++j)

John, please confirm and commit this, thanks!

Original comment by bo...@foxitsoftware.com on 3 Jun 2014 at 7:29

@GoogleCodeExporter
Copy link
Author

ah, this is a regression. sample files that I have used to work, but not 
anymore. It looks like we're adding the null terminator when we create a string 
from the result of FPDFLink_GetURL, which per documentation it doesn't include. 
Not sure how this worked before.

Original comment by jam@chromium.org on 5 Jun 2014 at 6:06

@GoogleCodeExporter
Copy link
Author

Bo: I looked into this more, and I believe the problem is in fpdftext.cpp.
FPDFLink_GetURL says it returns the number of chracters excluding the 
terminator. However the implementation converts from a CFX_WideString (with 
length not including terminating null) to a CFX_ByteString. That conversion 
adds a null terminator to the length, since CFX_WideString::UTF16LE_Encode has 
a default parameter of bTerminate=true.

Original comment by jam@chromium.org on 6 Jun 2014 at 1:39

@GoogleCodeExporter
Copy link
Author

John, the comments for FPDFLink_GetURL says "If buffer is NULL or buflen is 
zero, return number of characters (not bytes and an additional terminator is 
also counted) needed", so in pdfium_page.cc:390, 394, the url_length should 
already include the terminator.

Going down, pdfium_page.cc:410 link.url.length() also includes the terminator. 
In this regard, fpdftext.cpp should be ok.

Original comment by bo...@foxitsoftware.com on 6 Jun 2014 at 2:19

@GoogleCodeExporter
Copy link
Author

Hi Bo, I was going by 
http://tickets.foxitsoftware.com/support/usermanuals/DLL311/group___f_p_d_f_t_e_
x_t.html#ga250c31057dcc3277e9f56e870e690c58. I guess that's outdated since it 
doesn't mention that? I now see that the header in pdfium's repo says 
otherwise, so I'll go with that instead.

Original comment by jam@chromium.org on 6 Jun 2014 at 3:01

@GoogleCodeExporter
Copy link
Author

That document is indeed outdated, thanks for pointing out.

Original comment by bo...@foxitsoftware.com on 6 Jun 2014 at 4:22

@GoogleCodeExporter
Copy link
Author

Original comment by jam@chromium.org on 6 Jun 2014 at 2:42

  • Changed state: Fixed

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

1 participant