Commit Graph

681 Commits

Author SHA1 Message Date
Brendan Dahl
53549411b4 Add verbosity as an api setting. 2013-12-18 13:39:03 -08:00
Jonas Jenwald
e4f799a09c Small cleanup in 'set page' 2013-12-18 03:08:50 +01:00
Rob Wu
8526d3c600 [CRX] Add a pageAction to omnibox showing PDF URL
In Chromium extensions, the viewer's URL looks like this:
chrome-extension://oemmndcbldboiebfnladdacbdfmadadm/http://example.com/file.pdf

Furthermore, the PDF Viewer itself can also add something to the reference fragment:
chrome-extension://oemmndcbldboiebfnladdacbdfmadadm/http://example.com/file.pdf#page=2

Consequently, it is difficult to copy a clean URL (e.g. for sharing over mail)
without having to tidy-up the URL manually.

This commit solves this issue by adding a button to the omnibox,
which shows the clean PDF URL on click.
2013-12-16 19:00:32 +01:00
Rob Wu
3914768085 Implement hand tool
The logic for the hand tool is implemented in a separate project,
maintained at https://github.com/Rob--W/grab-to-pan.js

Integration notes
- Added toggle as an entry under the Secondary toolbar
- Added shortcut "h" to toggle hand tool (to-do: document this in wiki
  after merge). This shortcut is also used in Adobe's Acrobat Reader.

To-do: localizations for:
hand_tool_enable.title=
hand_tool_enable_label=
hand_tool_disable.title=
hand_tool_disable_label=

To-do (wish): persistence of hand tool preference, preferably a global setting.

secondaryToolbarButton-handTool.png created by Stephen Horlander <shorlander@mozilla.com>
2013-12-03 15:51:41 +01:00
Brendan Dahl
d0312aa6ba Wait for one page to render before fetching all pages. 2013-11-26 13:55:50 -08:00
Brendan Dahl
c9f2390567 Fix printing regression from #3848. 2013-11-25 16:13:40 -08:00
Jonas Jenwald
7542d50167 Fix issues with /FitR destinations 2013-11-23 18:27:03 +01:00
Yury Delendik
78b61fedfc Merge branch 'maxsong1002/shortcutkeytonavigate' 2013-11-22 08:22:12 -06:00
maxsong1002
807e4fef34 Add shortcut for goto page 2013-11-22 08:20:05 -06:00
Yury Delendik
124eb30e8d Merge pull request #3936 from brendandahl/initial-data
Leave initial request open until the viewer is ready to switch to range requests.
2013-11-21 06:22:24 -08:00
Yury Delendik
bd7985a83b Fixes cleaning up of the rendered pages 2013-11-19 17:08:36 -06:00
Jonas Jenwald
60610cd625 Implement default preferences 2013-11-18 23:51:06 +01:00
Brendan Dahl
3132c9e7e9 Merge pull request #3911 from yurydelendik/mem-redux2
Cleaning up fonts when viewer is idle for some time
2013-11-18 13:01:23 -08:00
Brendan Dahl
0385131a9a Leave initial request open until the viewer is ready to switch to range requests. 2013-11-18 11:17:26 -08:00
Yury Delendik
e712c4136a Cleaning up fonts when viewer is idle for some time 2013-11-18 13:01:54 -06:00
Rob Wu
f013d44999 Ctrl + F opens find bar instead of toggling it 2013-11-14 23:56:11 +01:00
Brendan Dahl
c2d65fc4ab Don't traverse all pages to get a single page. 2013-11-13 15:27:46 -08:00
Yury Delendik
a6e7f2226a Merge pull request #3864 from Snuffleupagus/independent-zoom-parameter
Make 'zoom' independent from 'page' in the hash parameters
2013-11-12 11:07:15 -08:00
Yury Delendik
d4cdf5ce41 Increase default auto scale to 125% 2013-11-11 16:51:50 -06:00
Jonas Jenwald
1c259ce806 Fix type mismatch causing wrong scale value in the viewBookmark button 2013-11-02 21:54:54 +01:00
Jonas Jenwald
e41d98f9f0 Make 'zoom' independent from 'page' in the hash parameters 2013-10-30 20:39:44 +01:00
Jonas Jenwald
4ee2c96503 Round the scale value displayed by the viewBookmark button to two decimal places 2013-10-28 12:34:35 +01:00
Jonas Jenwald
6102b6197f Fix scroll keys in Firefox 2013-10-21 23:39:17 +02:00
Jonas Jenwald
f35e777d81 Apply the current zoom level value to each page in Presentation Mode 2013-10-19 18:33:36 +02:00
Jonas Jenwald
bee1b734c2 A few small tweaks of the SecondaryToolbar code 2013-10-18 23:03:28 +02:00
Jonas Jenwald
8405d16379 Fix bot breakage caused by Chromium extension PR 2013-10-17 22:55:25 +02:00
Rob Wu
83b780af81 [CRX] Show nicely formatted URL in omnibox
Before commit:
chrome-extension://EXTENSIONID/content/web/viewer.html?file=http%3A%2F%2Fexample.com%2Ffile.pdf

After commit:
chrome-extension://EXTENSIONID/http://example/file.pdf

Technical details:
- The extension's background page uses the webRequest API to intercept
  requests for <extension host>/<real path to pdf>, and redirect it to
  the viewer's URL.
- viewer.js uses history.replaceState to rewrite the URL, so that it's
  easier for users to recognize and copy-paste URLs.
- The fake paths /http:, /https:, /file:, etc. have been added to the
  web_accessible_resources section of the manifest file, in order to
  avoid seeing chrome-extension://invalid/ instead of the actual URL
  when using history back/forward to navigate from/to the PDF viewer.
- Since the relative path resolving doesn't work because relative URLs
  are inaccurate, a <base> tag has been added. This method has already
  been proven to work in the Firefox add-on.

Notes:
- This commit has been cherry-picked from crx-using-streams-api.
- Need to merge https://github.com/mozilla/pdf.js/pull/3582 to deal with
  a bug in Chrome <=30
- In Chrome, getting the contents of a FTP file is not possible, so
  there's no support for FTP files, even though the extension router
  recognizes the ftp: scheme.
2013-10-16 23:14:46 +02:00
Jonas Jenwald
1f4d85db37 Inline setScale in parseScale 2013-10-16 00:26:42 +02:00
Tim van der Meij
b1b661a274 Refactoring thumbnail scroll code to fix jumps 2013-10-09 20:40:21 +02:00
Brendan Dahl
6f61a9c83e Merge pull request #3727 from brendandahl/css-zoom2
Use css to initially scale on zoom.
2013-10-08 20:34:22 -07:00
Tim van der Meij
64757dd481 Merge pull request #3774 from Snuffleupagus/contextMenu-PresentationMode
Enabling clicking to close the context menu in Presentation Mode, without going to the next page
2013-10-08 11:31:02 -07:00
Jonas Jenwald
dfb8e62079 Enabling clicking to close the context menu in Presentation Mode, without going to the next page 2013-10-08 20:11:04 +02:00
Rob Wu
1731c0fb42 Add mozPrintCallback shim
This shim does the following:
1. Intercept window.print()
2. For a window.print() call (if allowed, ie. no previous print job):
   1. Dispatch the beforeprint event.
   2. Render a printg progress dialog.
   3. For each canvas, call mozPrintCallback if existent (one at a time, async).
   4. During each mozPrintCallback callback, update the progress dialog.
   5. When all <canvas>es have been rendered, invoke the real window.print().
   6. Dispatch the afterprint event.

The shim is not included in Firefox through the preprocessor.

Keyboard shortcuts (Ctrl/Cmd + P) are intercepted and default behavior
(i.e. printing) is prevented, and the steps for window.print() are run.
window.attachEvent is used, in order to cancel printing in IE10 and
earlier (courtesy of Stack Overflow - http://stackoverflow.com/a/15302847).
Unfortunately, this doesn't work in IE11 - if Ctrl + P is used, the
print dialog will be shown twice: Once because of Ctrl + P, and again
when all pages have finished rendering.

This logic of this polyfill is not specific to PDF.js, so it can also
be used in other projects.

There's one additional modification in PDF.js's viewer.js: The printed
<canvas> element is wrapped in a <div>. This is needed, because Chrome
would otherwise print one canvas on two pages.
2013-10-08 19:46:59 +02:00
Jonas Jenwald
d795c8ec14 Refactor Presentation Mode code 2013-10-06 20:10:26 +02:00
Tim van der Meij
a68375c48e Merge pull request #3739 from Snuffleupagus/bug-921162
Add the viewBookmark button to the Secondary Toolbar
2013-10-04 13:16:38 -07:00
Brendan Dahl
df249da923 Use css to initially scale on zoom. 2013-10-02 09:05:46 -07:00
Jonas Jenwald
d6ab0c61e8 Move Settings from viewer.js to its own file 2013-10-02 15:55:31 +02:00
Jonas Jenwald
bfc66626a0 Move Presentation Mode related code from viewer.js to its own file 2013-10-01 23:11:46 +02:00
Jonas Jenwald
b148c9cb51 Add the viewBookmark button to the secondary toolbar 2013-09-27 11:51:32 +02:00
Tim van der Meij
63233fa8c2 Improved password prompt 2013-09-24 17:46:54 +02:00
Jonas Jenwald
cebf3c60e2 Move PageView from viewer.js to its own file 2013-09-20 09:25:41 +02:00
Yury Delendik
a8320b2e18 Merge pull request #3695 from SSk123/transform
Adding transformation to the extract code
2013-09-19 18:45:59 -07:00
Srishti
3808d02a53 implementing transform matrix to getTextContent 2013-09-20 06:37:08 +05:30
Brendan Dahl
c270d7e056 Merge pull request #3641 from Snuffleupagus/properly-disable-presentationMode-when-embedded
Properly disable presentation mode when the viewer is embedded
2013-09-17 13:49:11 -07:00
Thor Larholm
0f07d8ad55 Squashed: Added basic support for presentationMode in IE11 2013-09-10 21:40:14 +02:00
Yury Delendik
69eff38d09 Merge pull request #3660 from maxidirienzo/master
viewer.js: Do not process keyboard shortcuts when focused element is a t...
2013-09-09 08:17:50 -07:00
maxidirienzo
ee5d8ca56d viewer.js: Do not process keyboard shortcuts when focused element is a textarea
If focused element is a textarea, viewer should not process keyboard shortcuts (as it does with input and select elements) because while writing on a textarea, if you press k,p,l, or n, the viewer scrolls next/prev page and the letter is not added to the textarea (eg. in my case I had a viewer displaying a product specs in PDF and a "request a quote" form at it's right, the form had a textarea field and users complains that they couldn't write in it, after checking it, I've realized it was this particular issue and fixd it with the change I'm commiting.
2013-09-09 11:50:49 -03:00
Jonas
b118ade9ae Fix searching in presentation mode in Firefox 2013-09-06 09:08:43 +02:00
Brendan Dahl
7cf8b8d70c Merge pull request #3607 from Snuffleupagus/issue-3604
Prevent searching during load from breaking the find functionality
2013-09-05 08:13:45 -07:00
Jonas
433397f877 Simplify getVisiblePages() in presentation mode 2013-09-05 00:42:36 +02:00