This repository has been archived by the owner on Jun 25, 2024. It is now read-only.
Added attribute to set raw data as the source of the pdf #36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We used to pass in the pdf src as a {{ interpolation }} string. However this makes it really difficult to open a pdf from binary data.
This PR instead forces us to to pass in $scope variables, so we can pass the binary data to the directive. Note that interpolation strings will no longer be supported by the directive, so this is a breaking change.
Aside from passing in a URL string as the source, PDF.JS by default supports passing a Uint8Array as the source. Now we can actually use that feature in the directive.
It is fairly easy to create a
UInt8Array
from a pdf resource as can be seen in the updated demo file. Because you can just set the responseType of aXMLHttpRequest
toarraybuffer
and then pass that in theUint8Array
constructor.I also fixed initializing the webviewer with no source. So you can actually load the pdf-viewer without displaying a pdf (for async loaded pdf files). It used to break the view if you passed in
null
as the src.fixes #35 fixes #24