Commit Graph

40 Commits

Author SHA1 Message Date
Tim van der Meij
6a33dfd13a Implement support for FileAttachment annotations 2016-02-23 22:49:53 +01:00
Yury Delendik
85e95d34ed Use RequireJS in the viewer, examples and tests. 2015-12-29 09:20:52 -06:00
Jonas Jenwald
3079dd937f Remove a superfluous "s" in AnnotationsLayerBuilder from files in web/
This patch makes the naming consistent with the `TextLayerBuilder`, and also the new `AnnotationLayer`, and should thus help reduce possible confusion when working with the code.
Please note that the files were renamed using `git mv`, in order to preserve blame.
2015-12-18 19:55:54 +01:00
Tim van der Meij
bce3214105 Move link creation logic to src/display/annotation_layer.js
Additionally simplify the div creation logic (it needs to happen only
once, so it should not be in the for-loop) and remove/rename variables
for shorter code.
2015-12-08 23:56:17 +01:00
Jonas Jenwald
6dfe53b976 [api-minor] Add a parameter to PDFPageProxy_getTextContent that enables replacing of all whitespace with standard spaces in the textLayer (issue 6612)
This patch goes a bit further than issue 6612 requires, and replaces all kinds of whitespace with standard spaces.

When testing this locally, it actually seemed to slightly improve two existing test-cases (`tracemonkey-text` and `taro-text`).

Fixes 6612.
2015-11-25 17:28:40 +01:00
Jonas Jenwald
b05652ca97 [api-minor] Let getAnnotations fetch all annotations by default, unless an intent is specified
Currently `getAnnotations` will *only* fetch annotations that are either `viewable` or `printable`. This is "hidden" inside the `core.js` file, meaning that API consumers might be confused as to why they are not recieving *all* the annotations present for a page.

I thus think that the API should, by default, return *all* available annotations unless specifically told otherwise. In e.g. the default viewer, we obviously only want to display annotations that are `viewable`, hence this patch adds an `intent` parameter to `getAnnotations` that makes it possible to decide if only `viewable` or `printable` annotations should be fetched.
2015-11-22 15:51:37 +01:00
Jonas Jenwald
93f4f7a649 Use DEFAULT_SCALE instead of 1.0 as the default value if the scale option isn't specified when initializing PDFPageView
A small piece of cleanup, in order to avoid unnecessarily hardcoding a default value.
2015-11-20 13:30:04 +01:00
Yury Delendik
2f34fd46cb Move CustomStyle. 2015-11-19 10:47:17 -06:00
Jonas Jenwald
f341d81ae8 Ensure that the hidden attribute is always removed from the canvas when rendering is complete (issue 6661)
Fixes 6661.
2015-11-19 12:31:49 +01:00
Yury Delendik
194994a289 Merge pull request #6551 from yurydelendik/subaa
[api-minor] Enables subpixel anti-aliasing for most of the content.
2015-11-17 19:45:32 -06:00
Yury Delendik
1d8800370a Allow subpixel anti-aliasing for most of the content. 2015-11-16 10:50:02 -06:00
Manas
a2ba1b8189 Uses editorconfig to maintain consistent coding styles
Removes the following as they unnecessary
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
2015-11-14 07:32:18 +05:30
Jonas Jenwald
2646f27434 Dispatch the pagerendered event when zooming is only done with CSS (issue 6463)
In my opinion, this event shouldn't be dispatched in `PDFPageView.cssTransform`, since that would cause *two* events to be fired when "normal" zooming is used (once in `PDFPageView.cssTransform`, and once in `PDFPageView.draw`).

Fixes 6463.
2015-11-12 16:46:50 +01:00
Jonas Jenwald
dbc611ac9d Ensure that the textLayer has the same dimensions as the canvasWrapper (issue 6596)
This is a quick fix to get `scrollIntoView` working again for search results, but we really ought to re-write that function since it seems way too brittle.

Fixes 6596.
2015-11-06 12:43:22 +01:00
Yury Delendik
7cb32759ed Better CSS scaling for deviceRixelRatio != 1. 2015-10-28 17:27:42 -05:00
Yury Delendik
5135aa9bec Adds deprecation warning for the API calls. 2015-10-23 09:06:32 -05:00
Yury Delendik
59c13b32aa Adds destroy method to the document loading task.
Also renames PDFPageProxy.destroy method to cleanup.
2015-10-23 08:57:14 -05:00
Tim van der Meij
e28ad20d15 Merge pull request #6475 from Snuffleupagus/PDFPageView-annotationLayer-div
Tweak `PDFPageView` to reflect that `this.annotationLayer` is an `AnnotationsLayerBuilder` instance, instead of a DOM element (PR 5552 follow-up)
2015-09-29 23:38:04 +02:00
Jonas Jenwald
5e7ce9d62d Fix incorrect indentation, and remove else after return, in PDFPageView_update 2015-09-26 15:41:02 +02:00
Jonas Jenwald
1ae9ba1d64 Don't clear the canvas until re-rendering is finished when the scale or rotation is changed (issue 6467)
*This regressed in PR 4920.*

The main motivation for PR 4920 was to quickly get rid of old canvases when pages are evicted from the `PDFPageViewBuffer` cache. However it inadvertently broke the use-case where the `canvas` is used as a preview, on scale or rotation changes, until the re-rendering is finished.

Fixes 6467.
2015-09-26 15:40:59 +02:00
Jonas Jenwald
c7fd7f898f Tweak PDFPageView to reflect that this.annotationLayer is an AnnotationsLayerBuilder instance, instead of a DOM element (PR 5552 follow-up)
In PR 5552, specifically commit 9f384bbb41, the meaning of `this.annotationLayer` changed in `PDFPageView`. Previously it referred directly to a DOM element, but now it's instead an instance of `AnnotationsLayerBuilder`.
This patch tweaks things so that we won't try to hide a non-existent `annotationLayer` div in `PDFPageView_reset`, and also so that we don't attempt to insert empty (`null`) DOM elements in `PDFPageView_draw`.
2015-09-24 12:24:47 +02:00
Tim van der Meij
d7aa95d6b1 Merge pull request #5857 from Rob--W/print-page-size
Set page size via @page + size
2015-05-14 16:52:40 +02:00
Tim van der Meij
6159da0598 Merge pull request #5828 from Rob--W/mozCurrentTransform-fix
Fix flaw in mozCurrentTransform polyfill
2015-04-29 19:27:02 +02:00
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
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
Jonas Jenwald
eed67ea8bb Remove the |el| property in PDFPageView and PDFThumbnailView 2015-02-27 00:26:02 +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
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
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
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
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