New issue
Advanced search Search tips
Starred by 8 users

Issue metadata

Status: Available
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

#Links to a ‘Dest’ within a PDF ignore /View

Reported by jdawise...@gmail.com, Sep 25 2015

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36

Example URL:
http://www.jdawiseman.com/2015/20151125_1985s.pdf#Circle_00_01_02

Steps to reproduce the problem:
As is well known, a #tag can be used to link to an ID in an HTML page. The same is true of a PDF: a PDF can contain named ‘DEST’inations, which can be used for internal linking (from the table of contents, say) and for linking from outside.

In Chrome, open 
http://www.jdawiseman.com/2015/20150909_Elizabeth2_Victoria.pdf#VoteRecorder_0 
Quite correctly, Chrome jumps to page 79. Hurray!

Next, open 
http://www.jdawiseman.com/2015/20151125_1985s.pdf#Circle_00_01_02
The ‘#Circle_00_01_02’ is a named ‘Dest’ within the PDF. There should be a zoom-in on a circle on the second page. Only part of this is achieved: Chrome correctly jumps to page 2, but incorrectly shows the whole page rather than zooming on the one-circle ‘View’. 

Please could the within-page /View be heeded? 

Some technical info. These PDFs are made by distilling hand-coded PostScript. The command that adds the relevant Dest is of the form 
mark /Dest /Circle_00_01_02  /View [/FitR  x r sub  y r sub  x r add  y r add]  /DEST  pdfmark 
in which x, y and r are the position and radius of the circle. The PDF might echo the format of the PostScript. 

Now return to the first example. The command to make that Dest was 
mark /Dest /VoteRecorder_0  /View [/FitH PageHeight]   /DEST  pdfmark
/FitH instructs a zoom such that the full width of the page is as wide as the window, without regard as to whether the height of the page will or won’t fit, positioning the top of the page at the top of the window. Chrome doesn’t quite do that either—it just fits the whole page, therefore showing it insufficiently zoomed. Please could the /View be heeded? 

Chrome Version 45.0.2454.101 (64-bit) (which is the most recent) running under Mac OS X 10.10.5. 

What is the expected behavior?
Should zoom in to appropriate /View on page. 

What went wrong?
Does not zoom in to appropriate /View on page. 

Does it occur on multiple sites: Yes

Is it a problem with a plugin? Yes PDF

Did this work before? N/A 

Does this work in other browsers? N/A 

Chrome version: 45.0.2454.101  Channel: stable
OS Version: OS X 10.10.5
Flash Version: Shockwave Flash 19.0 r0
 
20150909_Elizabeth2_Victoria.pdf
458 KB Download
20151125_1985s.pdf
370 KB Download
Also see the similar bug in Apple Preview:
https://discussions.apple.com/thread/7234631 
And for the various types of DEST and their meanings see the table on page 48 of the pdfmark Reference v9.0, June 2008.
http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdfmarkReference_v9.pdf 

Comment 3 by tkent@chromium.org, Sep 28 2015

Labels: -Cr-Blink Cr-Internals-Plugins-PDF
Labels: -OS-Mac OS-All
Status: Available
See also  bug 428678 
A request about this. 

The request is to zoom to a FitR x y x y box. One direction will be the binding direction, and no more than the FitR range will be visible (or little more). In the other direction there will be room in the window to show more. 

• If more can be shown in the vertical direction, have the top of the FitR box at the top of the window; unless that has the bottom of the PDF above the bottom of the window, in which case position by that; unless that has the top of the PDF below the top of the window, in which case centre vertically. 

• If more can be shown in the horizontal direction, have the centre of the FitR box in the centre of the window; unless that leaves one edge of the window beyond the edge of the PDF, in which case align that side.

So vertically align top to top; horizontally align centre to centre.
Bug still present in 46.0.2490.86 (64-bit) under OS X 10.11.1.

Comment 7 Deleted

Previous comment, just deleted, had been entered in the wrong bug. Sorry.
Bug still present in Version 53.0.2785.89 (64-bit) under OS X 10.11.6.
Thanks for the reminder, but I'm afraid nothing has changed yet. We need more functionality in PDFium to extract this information out of PDF, and then the Chrome PDF Viewer needs to act on the /View data and display the right viewport.  Bug 367524  is related - there we do not yet know where on a page a dest points to.
I understand that software has components, and incomplete functionality in one piece can affect others. But an occasional re-test, and reporting of that, doesn’t hurt. It might encourage a programmer who happens to be working on a piece to consider whether it would be much additional effort to address a known bug.

I’ll re-test in a year or so.
No it doesn't. Let's cross our fingers and hope there won't be any more re-testing.
 Issue 428678  has been merged into this issue.
Bug still present in Version 61.0.3163.91 (Official Build) (64-bit). 
Cc: hnakashima@chromium.org
Bug still present as of 26 Nov 2017, in Version 62.0.3202.94 (Official Build) (64-bit). 
Owner: hnakashima@chromium.org
This is related to bug 55776, but I don't think either contains the other fully.
Project Member

Comment 19 by bugdroid1@chromium.org, Jan 11

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/97f071cf3276dcac200033a933fe8fee7a709d20

commit 97f071cf3276dcac200033a933fe8fee7a709d20
Author: Henrique Nakashima <hnakashima@chromium.org>
Date: Thu Jan 11 19:56:02 2018

PDF bookmarks targets transformed on demand rather than on load.

This decreases load time, especially for PDFs with lots of bookmarks
such as books.

Also, this message is necessary for subsequent changes implementing
nameddests with XYZ positioning.

Bug: 55776,535978,748852
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Id1d7b87fd8c16b2f748d11bf61b8f78aa80d0b94
Reviewed-on: https://chromium-review.googlesource.com/850924
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#528717}
[modify] https://crrev.com/97f071cf3276dcac200033a933fe8fee7a709d20/chrome/browser/resources/component_extension_resources.grd
[modify] https://crrev.com/97f071cf3276dcac200033a933fe8fee7a709d20/chrome/browser/resources/pdf/compiled_resources2.gyp
[add] https://crrev.com/97f071cf3276dcac200033a933fe8fee7a709d20/chrome/browser/resources/pdf/coords_transformer.js
[modify] https://crrev.com/97f071cf3276dcac200033a933fe8fee7a709d20/chrome/browser/resources/pdf/index.html
[modify] https://crrev.com/97f071cf3276dcac200033a933fe8fee7a709d20/chrome/browser/resources/pdf/pdf.js
[modify] https://crrev.com/97f071cf3276dcac200033a933fe8fee7a709d20/chrome/test/data/pdf/bookmarks_test.js
[modify] https://crrev.com/97f071cf3276dcac200033a933fe8fee7a709d20/pdf/out_of_process_instance.cc
[modify] https://crrev.com/97f071cf3276dcac200033a933fe8fee7a709d20/pdf/pdf_engine.h
[modify] https://crrev.com/97f071cf3276dcac200033a933fe8fee7a709d20/pdf/pdfium/pdfium_engine.cc
[modify] https://crrev.com/97f071cf3276dcac200033a933fe8fee7a709d20/pdf/pdfium/pdfium_engine.h
[modify] https://crrev.com/97f071cf3276dcac200033a933fe8fee7a709d20/pdf/pdfium/pdfium_page.cc
[modify] https://crrev.com/97f071cf3276dcac200033a933fe8fee7a709d20/pdf/pdfium/pdfium_page.h

Project Member

Comment 20 by bugdroid1@chromium.org, Feb 8

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9d1b2d650c92110085d153fdaaa5670720b08678

commit 9d1b2d650c92110085d153fdaaa5670720b08678
Author: Henrique Nakashima <hnakashima@chromium.org>
Date: Thu Feb 08 20:50:58 2018

Create PDFViewer.postMessage_().

Refactor usages of this.plugin_.postMessage() to use this method.

This makes it easier to pass a callback to other objects that sends
a message to the PPAPI plugin.

Bug: 55776,535978,748852
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I7ccd7df56f55d0ef099f590ba9e13c8bff9e3cfb
Reviewed-on: https://chromium-review.googlesource.com/907232
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#535503}
[modify] https://crrev.com/9d1b2d650c92110085d153fdaaa5670720b08678/chrome/browser/resources/pdf/open_pdf_params_parser.js
[modify] https://crrev.com/9d1b2d650c92110085d153fdaaa5670720b08678/chrome/browser/resources/pdf/pdf.js
[modify] https://crrev.com/9d1b2d650c92110085d153fdaaa5670720b08678/chrome/test/data/pdf/navigator_test.js
[modify] https://crrev.com/9d1b2d650c92110085d153fdaaa5670720b08678/chrome/test/data/pdf/params_parser_test.js

Project Member

Comment 21 by bugdroid1@chromium.org, Feb 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d13b1b5876e78bf52925cdeacfbd6e3438c7e4ad

commit d13b1b5876e78bf52925cdeacfbd6e3438c7e4ad
Author: Henrique Nakashima <hnakashima@chromium.org>
Date: Fri Feb 09 00:30:27 2018

Switch pdfium_engine.cc to use FPDFDest_GetDestPageIndex().

The previously used FPDFDest_GetPageIndex() is deprecated and is
incorrect. The return value for error is 0, which is also a valid
value. FPDFDest_GetDestPageIndex() uses -1 as error value.

Bug: 55776,535978,748852, pdfium:938 
Change-Id: I96fa379bd1679d987da81321e763d1bb6c3022fd
Reviewed-on: https://chromium-review.googlesource.com/909928
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#535591}
[modify] https://crrev.com/d13b1b5876e78bf52925cdeacfbd6e3438c7e4ad/pdf/pdfium/pdfium_engine.cc

Project Member

Comment 22 by bugdroid1@chromium.org, Feb 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/363e99ad2603c4336062115dab3a1b8f28200d27

commit 363e99ad2603c4336062115dab3a1b8f28200d27
Author: Henrique Nakashima <hnakashima@chromium.org>
Date: Fri Feb 09 23:24:05 2018

GetNamedDestination() returns more info about PDF destination.

Previously called GetNamedDestinationPage(), the new version returns
the view and view parameters in a PDFEngine::NamedDestination
struct.

Bug: 55776,535978,748852
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I5410ed66715e3c579e5daa89231cf89dbeaf83e9
Reviewed-on: https://chromium-review.googlesource.com/910208
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#535877}
[modify] https://crrev.com/363e99ad2603c4336062115dab3a1b8f28200d27/pdf/out_of_process_instance.cc
[modify] https://crrev.com/363e99ad2603c4336062115dab3a1b8f28200d27/pdf/pdf_engine.h
[modify] https://crrev.com/363e99ad2603c4336062115dab3a1b8f28200d27/pdf/pdfium/pdfium_engine.cc
[modify] https://crrev.com/363e99ad2603c4336062115dab3a1b8f28200d27/pdf/pdfium/pdfium_engine.h

Sign in to add a comment