cage1016 / pdfium

Automatically exported from code.google.com/p/pdfium
0 stars 0 forks source link

Link not recognised in PDF #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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 commented 9 years ago

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

GoogleCodeExporter commented 9 years ago

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

GoogleCodeExporter commented 9 years ago

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

GoogleCodeExporter commented 9 years ago
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 commented 9 years ago
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 commented 9 years ago
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 commented 9 years ago
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 commented 9 years ago
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 commented 9 years ago
That document is indeed outdated, thanks for pointing out.

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

GoogleCodeExporter commented 9 years ago

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