Commit Graph

1698 Commits

Author SHA1 Message Date
Tim van der Meij
edb2eecdc8 Remove XHTML leftovers from the viewer HTML files 2016-02-14 13:23:34 +01:00
Rob Wu
0ec82d4a50 Allow local PDF files to be viewed in local frames
The Chrome extension enforces that local files cannot be embedded in
non-local web pages. The previous check was too strict (because the
origin of a file:-URL is "null"), and prevented local PDF from being
viewed in local files).

This patch fixes that problem, by querying the actual tab URL via the
background page.

Steps to verify:
1. Create a HTML file: `<iframe src=test.pdf width=100% height=100%>`
2. Build and load the extension.
3. Allow file access to the extension at `chrome://extensions`
4. Open the HTML file from a file:// URL.
5. VERIFY: The extension should attempt to load the PDF file.

6. Now open the following (replace ID with the extension ID, which you
   can find at `chrome://extensions`):
  `data:text/html,<iframe src="chrome-extension://ID/file:///test.pdf">`
7. VERIFY: The next error should be displayed:
   "Refused to load a local file in a non-local page for security reasons."
2016-02-10 14:52:54 +01:00
Yury Delendik
825a2225ab Merge pull request #6915 from yurydelendik/lookuptables
Refactor lookup hash tables/objects
2016-01-28 15:01:06 -06:00
Yury Delendik
2edf2792dc Replaces literal {} created lookup tables with Object.create 2016-01-28 12:18:38 -06:00
Brendan Dahl
059e826e20 Merge pull request #6916 from yurydelendik/hosted-viewer
Allow foriegn origin URLs only for hosted viewers.
2016-01-22 10:02:52 -08:00
Yury Delendik
7c89bdc8d6 Allow foriegn origin URLs only for hosted viewers. 2016-01-22 11:54:19 -06:00
Jonas Jenwald
4b94416277 Set type="password" for the PasswordPrompt input dynamically, to prevent unnecessary warnings in Firefox for http:// documents (issue 6898)
Fixes 6898.

Note that this doesn't prevent the warning for PDF files that *do* ask for a password, e.g. http://async5.org/moz/passwordOU.pdf, but it's not clear to me if/how we could avoid that.
2016-01-20 13:54:19 +01:00
Jonas Jenwald
0030a82dc3 [api-minor] Add support for URLs in the document outline
Re: issue 5089.
(Note that since there are other outline features that we currently don't support, e.g. bold/italic text and custom colours, I thus think we can keep the referenced issue open.)
2016-01-19 21:36:27 +01:00
Brendan Dahl
4a215f0892 Merge pull request #6825 from yurydelendik/pdfjsumd
Adds UMD header to pdf.js and pdf.worker.js files.
2016-01-07 15:07:58 -08:00
Jonas Jenwald
97c10e9c08 Strip null (\x00) characters from the URLs in LinkAnnotations (issue 6832)
Apparently some PDF files can have annotations with `URI` entries ending with `null` characters, thus breaking the links.
To handle this edge-case of bad PDFs, this patch moves the already existing utility function from `ui_utils.js` into `util.js`, in order to fix those URLs.

Fixes 6832.
2016-01-04 21:55:20 +01:00
Tim van der Meij
6ef7120a04 Implement support for Highlight annotations 2016-01-01 15:31:46 +01:00
Yury Delendik
f340dd5cd5 Adds pdfjs/main_loader module to better mirror pdfjs-dist/build/pdf. 2015-12-30 13:28:57 -06:00
Tim van der Meij
34918a6666 Implement support for Squiggly annotations 2015-12-30 19:37:04 +01:00
Jonas Jenwald
d956177482 Merge pull request #6819 from timvandermeij/strikeout-annotation
Implement support for StrikeOut annotations
2015-12-30 14:44:50 +01:00
Tim van der Meij
e8db825512 Merge pull request #6771 from yurydelendik/requirejs
Removes hardcoded module loading order
2015-12-30 00:37:32 +01:00
Yury Delendik
85e95d34ed Use RequireJS in the viewer, examples and tests. 2015-12-29 09:20:52 -06:00
Tim van der Meij
c5f4b9750e Implement support for StrikeOut annotations 2015-12-29 15:09:28 +01:00
Tim van der Meij
cd28dd34fe Implement support for Underline annotations 2015-12-28 00:33:41 +01:00
Tim van der Meij
26379ddae2 Rename and reorder link annotation CSS 2015-12-27 15:51:58 +01:00
Tim van der Meij
7d43971f54 Implement support for Popup annotations
Most code for Popup annotations is already present for Text annotations.
This patch extracts the popup creation logic from the Text annotation
code so it can be reused for Popup annotations.

Not only does this add support for Popup annotations, the Text
annotation code is also considerably easier. If a `Popup` entry is
available for a Text annotation, it will not be more than an image. The
popup will be handled by the Popup annotation. However, it is also
possible for Text annotations to not have a separate Popup annotation,
in which case the Text annotation handles the popup creation itself.
2015-12-25 13:17:21 +01:00
Tim van der Meij
5b66ad626d Refactor annotation display layer code to use classes 2015-12-19 19:31:37 +01:00
Tim van der Meij
9228e1ffcf Merge pull request #6772 from Snuffleupagus/remove-s-in-AnnotationsLayerBuilder
Remove a superfluous "s" in `AnnotationsLayerBuilder` from files in web/
2015-12-18 21:06:46 +01: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
df81b832bb Remove unused variables 2015-12-16 23:52:16 +01:00
Yury Delendik
6b60c8f4db Adds UMD headers to core, display and shared files. 2015-12-15 13:24:39 -06:00
Tim van der Meij
1b5940edd2 Merge pull request #6714 from timvandermeij/annotation-web-to-src
[api-minor] Move annotation DOM manipulation logic to src/display/annotation_layer.js
2015-12-15 19:06:48 +01:00
Tim van der Meij
edce8daeac Implement annotation layer rendering and updating in src/display/annotation_layer.js 2015-12-15 17:00:01 +01:00
Jonas Jenwald
d2c58a4ccc [Firefox] Prevent internal links from displaying "resource://pdf.js/web/" on hover, by tweaking the fallback case in PDFLinkService_getDestinationHash
An example where this is happening is http://www.nyc.gov/html/dcp/pdf/zone/map8c.pdf, check the link just below "Effective Date(s) of Rezoning:" on the right middle of the page.
2015-12-09 10:07:39 +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
Tim van der Meij
2dc3ee38c0 Move most rendering logic to src/display/annotation_layer.js 2015-12-03 00:20:18 +01:00
Tim van der Meij
91274d6d2d Rename annotation_helper.js to annotation_layer.js 2015-12-02 23:30:28 +01:00
Tim van der Meij
a2cac8fa71 Use default line height for the text layer
Fixes #6614.
2015-12-02 23:00:12 +01:00
Yury Delendik
c9cb6a3025 Replaces UnsupportedManager with callback. 2015-11-30 14:42:47 -06: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
Sebastian Hengst
27577a714f Issue #6569 - document_colors_disabled shouldn't escape quotes (compare-locales warning) 2015-11-22 10:14:25 +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
bd7f121c83 Better "text" testing. 2015-11-19 11:03:52 -06:00
Yury Delendik
56ccaea99b Move text layer building logic into src/display/text_layer.js 2015-11-19 10:50:27 -06: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
99f9b523c2 Merge pull request #6627 from prometheansacrifice/use-editorconfig
Uses editorconfig to maintain consistent coding styles
2015-11-16 13:51:45 -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
Tony Jin
570f144fc3 Fix minor capitalization issue in viewer 2015-11-12 13:33:34 -08:00
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
Yury Delendik
a4ca9986e1 Merge pull request #6318 from Snuffleupagus/bug-1191279
For documents with different page sizes, ensure that the correct page becomes visible on load when e.g. the 'page' hash parameter was provided (bug 1191279, issue 6393)
2015-11-10 17:51:02 -06:00
Jonas Jenwald
e629882f2a Correctly handle /FitH destinations with null as the parameter
According to http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#G11.2095870, the vertical position shouldn't change if the parameter is `null`.

Fixes 6615.
2015-11-10 14:22:24 +01:00
Jonas Jenwald
1e0bd07d8d Merge pull request #6595 from yurydelendik/currentscript
Uses document.currentScript for pdf.worker.js path.
2015-11-06 17:28:20 +01:00