Commit Graph

1552 Commits

Author SHA1 Message Date
Mohamed Baig
6d8adb31ad Added the data-page-number dom attribute to the page rendered in the browser
Added data-page-id attribute to page container divs

Updated the attribute with a better label
2015-03-27 18:23:39 -04:00
Rob Wu
d34e6ddd60 Set page size via @page + size
In Blink-based browsers, there is a mismatch between document size and
paper size. Even if exactly the same values and unit are used, it is
possible that the printed results takes more pages than expected.

To solve the issue, the page size is set via @page size, and the canvas
and ancestor nodes are assigned a width+height of 100% (=relative to the
page). This change resolves bugs such as blank pages and split pages.
2015-03-23 11:19:48 +01:00
Jonas Jenwald
94cc731616 Add custom |outlineloaded| and |attachmentsloaded| events to the viewer (bug 1112947) 2015-03-21 17:49:34 +01:00
Tim van der Meij
2d11266a52 Merge pull request #5866 from Snuffleupagus/scalechange-evt-pageActualOption
Add |pageActualOption| to the list of predefined zoom options in the |scalechange| event handler in viewer.js
2015-03-20 22:26:07 +01:00
Jonas Jenwald
36400ae48d Add |pageActualOption| to the list of predefined zoom options in the |scalechange| event handler in viewer.js
This patch also rearrange the order of the references to the DOM elements of the predefined zoom values, in viewer.js, to correspond with the element order in the current viewer UI. (The previous ordering is a leftover from the previous viewer UI.)
2015-03-20 22:09:34 +01:00
Jonas Jenwald
4a3b0d9c64 Add a |PDFViewer| option to remove the border shadow around pages (issue 5559) 2015-03-16 12:28:28 +01:00
Jonas Jenwald
65a5543efe Disable PresentationMode for certain problematic configurations
Instead of trying to hack around various browser defects, let's just disable PresentationMode in the affected browsers. This patch:

- Disables PresentationMode in IE11+ when the viewer is embedded; fixes 4711.
2015-03-13 22:09:36 +01:00
Tim van der Meij
230d8c40e4 Make presentation mode work again in Safari 2015-03-13 21:41:14 +01:00
Tim van der Meij
ac5d1fbb2d Merge pull request #5785 from Snuffleupagus/bug-1138993
Revert PR 5510, except in WebKit browsers, for breaking print preview in Firefox
2015-03-12 21:16:29 +01:00
Rob Wu
6eb9e6a6a4 Fix flaw in mozCurrentTransform polyfill
Set transformation matrix in (polyfilled) mozPrintCallback when a scale
is applied. Removed _scaleX and _scaleY in favor of _transformMatrix to
emphasize that the caller MUST ensure that the state of the matrix is
correct before `addContextCurrentTransform` is called.
2015-03-11 20:55:26 +01:00
Yury Delendik
da258f8972 Merge pull request #5692 from Rob--W/webl10n-fix
[l10n] Treat language as case-insensitive
2015-03-09 23:24:57 -05:00
Yury Delendik
c2dc665332 Merge pull request #5582 from Snuffleupagus/setHash-Fit-values
Fix handling of "Fit" zoom values in setHash (issue 5581)
2015-03-09 23:20:23 -05:00
Yury Delendik
f4dbd69e06 Merge pull request #5595 from fkaelberer/useBinarySearchToFindVisibleElements
Use binary search in getVisibleElements()
2015-03-09 23:11:50 -05:00
Jonas Jenwald
f0d538d7cf Revert PR 5510, except in WebKit browsers, for breaking print preview in Firefox
See https://bugzilla.mozilla.org/show_bug.cgi?id=1138993.
2015-03-07 00:16:55 +01:00
speedplane
80d85b5fe7 Embedded PDF viewers should not be changing their parent page's title. 2015-03-05 22:36:08 -05:00
Jonas Jenwald
43e6de7e38 Merge pull request #5680 from Rob--W/forget-showPreviousViewOnLoad
Reset state upon load if showPreviousViewOnLoad
2015-03-02 21:49:34 +01:00
Rob Wu
6a16d7dd44 Reset state upon load if showPreviousViewOnLoad
And moved showPreviousViewOnLoad up to PDFViewerApplication.initialize
2015-03-02 21:35:44 +01:00
fkaelberer
a78bb6b946 Use binary search in getVisibleElements() 2015-03-01 17:41:20 +01:00
Tim van der Meij
a033b4bf3d Merge pull request #5769 from dumyan/findcontroller-nbsp
nbsp normalization
2015-02-28 14:50:25 +01:00
Jonas Jenwald
00ee6bd6b6 Merge pull request #5693 from collinanderson/whitespace
cleaned whitespace
2015-02-28 10:09:21 +01:00
Damjan Velickovski
29290f3277 added nbsp normalization 2015-02-28 02:57:08 +01:00
Yury Delendik
ce122591b9 Merge pull request #5586 from fkaelberer/updateThumbnailClassesOnlyWhenVisible
Update thumbnails only when they are visible (to improve scrolling through large documents)
2015-02-27 06:56:32 -06:00
Yury Delendik
6ead5c4731 Merge pull request #5711 from Snuffleupagus/deprecate-el-property
Remove the |el| property in PDFPageView and PDFThumbnailView
2015-02-27 06:39:00 -06:00
Yury Delendik
a0a94344d7 Merge pull request #5721 from Snuffleupagus/move-findController-resolveFirstPage
Move the call to |PDFFindController.resolveFirstPage| into PDFViewer
2015-02-27 06:33:15 -06:00
Jonas Jenwald
eed67ea8bb Remove the |el| property in PDFPageView and PDFThumbnailView 2015-02-27 00:26:02 +01:00
Jonas Jenwald
a495ab0d13 Fix regression that prevents resetting the zoom level to "Automatic" when using the |Ctrl + 0| keys 2015-02-19 17:37:02 +01:00
Collin Anderson
54e984c763 cleaned whitespace 2015-02-17 11:07:37 -05:00
Jonas Jenwald
8131440f9e Move the call to |PDFFindController.resolveFirstPage| into PDFViewer
From reading IRC scrollback, it became clear that having to manually call `PDFFindController.resolveFirstPage` in order for the find functionality to work isn't particulary good. Hence this PR, which moves that code into `PDFViewer.setDocument` to make life easier for third-party implementations.
2015-02-11 14:22:24 +01:00
Rob Wu
ac5a8bcdda [l10n] Treat language as case-insensitive
See "Case-insensitive language comparisons per RFC 4646"
https://github.com/fabi1cazenave/webL10n/pull/51

Removed the "patch" in compatibility.js and fixed the bug in webL10n,
because the logic belongs to webL10n instead of PDF.js.
The immediate motivation for this patch is that Chrome 40 converts
navigator.language to lower case: https://crbug.com/454331
2015-02-02 22:02:18 +01:00
Jonas Jenwald
d53fa1884b Simplify a couple of preprocessor tags in viewer.js 2015-01-31 22:45:20 +01:00
Jonas Jenwald
bb16475070 Use the |shadow| function from src/shared/util.js in viewer.js 2015-01-31 22:43:30 +01:00
Tim van der Meij
b72395d5ce Determine filename only once and reduce code for _bindLink 2015-01-28 20:53:03 +01:00
Tim van der Meij
818b7fc306 Add JSDoc comments to PDFAttachmentView 2015-01-28 20:53:02 +01:00
Tim van der Meij
4c6ca1c78f Remove DownloadManager dependency
We can pass it in using the options object. Note that that this also avoids creating a DownloadManager object for each separate link (instead, having only one is enough).
2015-01-28 20:53:01 +01:00
Tim van der Meij
733882ac25 Refactor PDFAttachmentView to be more class-like and to separate functionality into methods 2015-01-28 20:53:00 +01:00
Tim van der Meij
609e2a30e9 Rename DocumentAttachmentsView to PDFAttachmentView 2015-01-28 20:52:59 +01:00
Tim van der Meij
2c19d99a2e Rename document_attachments_view.js to pdf_attachment_view.js 2015-01-28 20:52:22 +01:00
Tim van der Meij
f4dbc99483 Add JSDoc comments to PDFOutlineView 2015-01-27 23:04:48 +01:00
Tim van der Meij
ea1d37eb0d Refactor PDFAttachmentView to be more class-like and to separate functionality into methods 2015-01-27 22:51:39 +01:00
Tim van der Meij
b17da309ed Rename DocumentOutlineView to PDFOutlineView 2015-01-27 22:40:12 +01:00
Tim van der Meij
3eeb571425 Rename document_outline_view.js to pdf_outline_view.js 2015-01-27 22:38:45 +01:00
fkaelberer
d3022e1e70 Update thumbnail images only when sidebar is visible 2015-01-27 21:13:34 +01:00
fkaelberer
047d61ed1f Update thumbnail style only when sidebar is visible 2015-01-27 21:08:36 +01:00
Tim van der Meij
a544aed2b0 Merge pull request #5673 from Snuffleupagus/thumbnail-refactor
Refactor the thumbnail code
2015-01-26 21:33:32 +01:00
Jonas Jenwald
777d69b52e Remove dead code from PDFThumbnailView 2015-01-26 20:52:46 +01:00
Jonas Jenwald
b7041f81f4 Enable cancelling of thumbnail drawing
This is useful if thumbnails are being rendered when the document is rotated, since it let us abort the current rendering.
2015-01-26 20:52:45 +01:00
Jonas Jenwald
878aa76c15 Refactor PDFThumbnailView to look more similar to PDFPageView
This includes an optimization to zero the height and width of existing thumbnail canvases, when they are removed and recreated during rotation of the document. (Credit goes to nnethercote, who initially found this in PR 4920.)
2015-01-26 20:52:45 +01:00
Jonas Jenwald
7f8f404536 Rename ThumbnailView to PDFThumbnailView and refactor it to be more class-like 2015-01-26 20:52:44 +01:00
Jonas Jenwald
4294fb18d8 Merge pull request #5675 from timvandermeij/cleanup-gitignore
Remove obselete file from .gitignore
2015-01-26 16:52:10 +01:00
Jonas Jenwald
9a8d1ce4fc Merge pull request #5672 from timvandermeij/remove-b2g-header
Remove unused viewer-snippet-b2g-activity-header.html
2015-01-26 16:47:58 +01:00
Tim van der Meij
2524c4dee7 Remove obselete file from .gitignore 2015-01-26 16:44:45 +01:00
Tim van der Meij
5db9ebea19 Merge pull request #5674 from Snuffleupagus/avoid-double-childNodes-in-PDFPageView_reset
Avoid getting |childNodes| twice in PDFPageView_reset, by using the variable instead
2015-01-26 16:39:31 +01:00
Jonas Jenwald
8471bb3206 Avoid getting |childNodes| twice in PDFPageView_reset, by using the variable instead 2015-01-26 12:22:09 +01:00
Tim van der Meij
c278d65dfd Remove unused viewer-snippet-b2g-activity-header.html 2015-01-25 20:55:20 +01:00
Tim van der Meij
f89d1ca2e7 Remove unused index.html.template 2015-01-25 20:44:21 +01:00
Jonas Jenwald
64ba38008f Rename the thumbnail_view.js file 2015-01-25 17:21:53 +01:00
Jonas Jenwald
dfa993d13d Fix function names in PDFThumbnailViewer
Also updates a couple of the JSDoc comments.
2015-01-25 17:21:29 +01:00
Jonas Jenwald
c55dcf19a0 Move PDFThumbnailViewer to its own file 2015-01-24 15:41:18 +01:00
Tim van der Meij
dd7fd0b665 Merge pull request #5588 from Snuffleupagus/remove-pageView-anchor
Remove unused anchor links placed before every page
2015-01-23 22:38:09 +01:00
Tim van der Meij
997c2b9d94 Merge pull request #5596 from fkaelberer/fixBordersAroundThumbnails
Fix border sizes around thumbnails
2015-01-23 21:29:49 +01:00
Tim van der Meij
6f36df79a1 Merge pull request #5610 from fkaelberer/betterThumbnailScaling
Better thumbnail image scaling
2015-01-23 20:45:37 +01:00
Jonas Jenwald
385b07c2ab Merge pull request #5660 from timvandermeij/thumbnails-setimage
Fill temporary canvases with a white background too
2015-01-22 20:20:27 +01:00
Tim van der Meij
879f3d2c5a Fill temporary canvases with a white background too 2015-01-19 22:01:55 +01:00
Jonas Jenwald
c149d4d75e Fix thumbnail rendering regression, when using |draw|, for PDF files with blend modes (issue 5637) 2015-01-19 21:55:59 +01:00
Jonas Jenwald
af6170ffd0 Attempt to display the File size quicker in the Document Properties dialog (PR 5554 followup) 2015-01-13 09:38:34 +01:00
Jonas Jenwald
c466a9e034 Fix thumbnail scaling regression for files with different page sizes (issue 5637) 2015-01-13 01:03:54 +01:00
Jonas Jenwald
8d0c442004 Merge pull request #5632 from yurydelendik/b2g-start
Fixes B2G file open sequence.
2015-01-09 18:00:39 +01:00
Yury Delendik
d52289d8fd Fixes B2G file open sequence. 2015-01-09 07:46:34 -06:00
Brendan Dahl
6ceb652abb Merge pull request #5554 from yurydelendik/apiref
Refactors getDocument and adds PDFDataRangeTransport.
2015-01-08 14:24:38 -08:00
Jonas Jenwald
95dd9ee185 Move the |pagerendered| event to pdf_page_view.js
Also deprecates the |pagerender| event, except for GENERIC builds.
2015-01-06 21:44:22 +01:00
Jonas Jenwald
3f061cef86 Add a |textlayerrendered| event 2015-01-06 17:57:32 +01:00
Yury Delendik
3a61edfcae Refactors getDocument and adds PDFDataRangeTransport. 2015-01-05 21:45:01 -06:00
Jonas Jenwald
42a00394b0 Remove unused anchor links placed before every page
In old versions of the viewer, anchor links were used to be able to scroll a page into view. Since we for quite some time have had a `scrollIntoView` function which handles this, the anchor links are no longer necessary and I believe that they can be removed. Doing so will reduce the total number of DOM elements in the viewer.

For most documents this patch will probably not make much of a difference performance wise, but for very long (1000+ pages) documents this could help performance especially on lower powered hardware.
2015-01-05 20:42:56 +01:00
Brendan Dahl
e93cf5ca97 Merge pull request #5552 from yurydelendik/pdfpageview
Creates/refactors PDFPageView class
2015-01-05 11:26:36 -08:00
fkaelberer
32c32c18e3 Better thumbnail image scaling 2015-01-02 15:40:30 +01:00
fkaelberer
1d31018c7d Make thumbnail CSS size independent of data-loaded tag 2014-12-30 15:07:20 +01:00
fkaelberer
2bb981a835 Ensure constant 7px thumbnail border width 2014-12-30 15:07:20 +01:00
Jonas Jenwald
86edb8687d Fix the placement of arrows in the zoom box
Now that [bug 649849](https://bugzilla.mozilla.org/show_bug.cgi?id=649849) has been fixed, adding support for `-moz-appearance: none`, the arrow is now too close to the text in the zoom box. This is currently only an issue in Nightly, but assuming the patch doesn't get backed out, this will soon affect all versions of Firefox.

The only simple solution I could find seems to be removing `*-appearance: none` rules from the CSS. I haven't been able to find any easier solutions that still looks the same with/without bug 649849.
2014-12-30 11:37:21 +01:00
Jonas Jenwald
5aad040735 Fix handling of "Fit" zoom values in setHash (issue 5581) 2014-12-27 12:54:29 +01:00
Tim van der Meij
c67ad28673 Remove unused annotation highlight div
This is now done using CSS. For annotation-heavy documents this change makes the DOM much lighter.
2014-12-21 17:38:22 +01:00
Yury Delendik
513a3d8c91 Replaces text selection example 2014-12-20 23:41:34 -06:00
Yury Delendik
2565e627a3 Refactors draw method in PDFPageView; makes optional some PDFPageViewOptions options 2014-12-20 23:41:34 -06:00
Yury Delendik
2ac7ac4678 Removes lastScrollSource and isViewerInPresentationMode from TextLayerBuilderOptions 2014-12-20 11:14:13 -06:00
Yury Delendik
b930228788 Refactors Cache into PDFPageViewBuffer 2014-12-19 16:54:32 -06:00
Yury Delendik
22c62685b0 Removes Stats dependency from PDFPageView. 2014-12-19 13:07:28 -06:00
Yury Delendik
9f384bbb41 Creates AnnotationsLayerBuilder. 2014-12-19 13:07:28 -06:00
Yury Delendik
fe4ac86781 Removes PDFPageSource 2014-12-19 09:55:11 -06:00
Yury Delendik
7663942ee5 Creates IPDFTextLayerFactory interface 2014-12-17 15:21:54 -06:00
Yury Delendik
f68678086d Simple restructuring PageView into PDFPageView 2014-12-17 15:21:54 -06:00
Yury Delendik
863d583ae1 Renames page_view.js file. 2014-12-17 10:32:07 -06:00
dustyrockpyle
7a0e764ffd Added page break hints in viewer css. 2014-11-26 11:56:00 -05:00
Tim van der Meij
dc5961d969 Merge pull request #5465 from Snuffleupagus/findbar-notFound-color
[GENERIC viewer] Fix the background color of the findInput when the search term is not found
2014-11-18 20:07:31 +01:00
Jonas Jenwald
6078901962 Prevent a "TypeError: pdfViewer is null" when the viewer loads (PR 5413 followup)
Currently if you manage to e.g. open the console (with <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>K</kbd>) before the viewer is initialized, the following will be printed in the console: `TypeError: pdfViewer is null`.
This doesn't cause any actual errors, but nevertheless it seems like something we should avoid.

Followup to PR 5413.
2014-11-15 12:17:10 +01:00
Yury Delendik
bb91aa5e38 Merge pull request #5478 from Snuffleupagus/bug-1018882
Prevent text selection in Presentation Mode (bug 1018882)
2014-11-11 09:15:50 -06:00
Yury Delendik
e294c8883a Merge pull request #5203 from Snuffleupagus/disableAutoFetch-loadingBar
Fix loadingBar hiding when disableAutoFetch is enabled (issue 3590)
2014-11-11 09:05:16 -06:00
Yury Delendik
3b9a78d3d8 Merge pull request #5416 from Snuffleupagus/percent-sign-l10n
Allow localization of the placement of percent signs in the zoom box
2014-11-11 08:30:07 -06:00
Jonas Jenwald
ce62b9387d Remove any active text selection when entering Presentation Mode 2014-11-07 12:53:21 +01:00
Jonas Jenwald
86309faf3c Prevent text selection in Presentation Mode (bug 1018882) 2014-11-07 12:02:48 +01:00
Jonas Jenwald
fbca0e1ab0 [GENERIC viewer] Fix the background color of the findInput when the search term is not found
When a search term isn't found, the background color of the findInput is supposed to change (to red). This is currently not working as intended, because the CSS rule is not being applied correctly. (It seems that this broke in PR 2208.)

This patch also changes the background color to match the one used in the native Firefox findbar, since the old color seemed a bit too pink.
2014-11-01 20:26:44 +01:00
Jonas Jenwald
4ed3074011 Fix regression that prevents downloading of font files in the debugger
This is a regression from PR 5366.
2014-10-28 19:56:55 +01:00