Skip to content

Commit

Permalink
add Uint8Array support (#135)
Browse files Browse the repository at this point in the history
* add Uint8Array support
* reformat pdfjswrapper
  • Loading branch information
haris44 authored and FranckFreiburger committed Jan 22, 2019
1 parent 5f5d7ea commit 6df0b7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/componentFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function(pdfjsWrapper) {
},
props: {
src: {
type: [String, Object],
type: [String, Object, Uint8Array],
default: '',
},
page: {
Expand Down
5 changes: 3 additions & 2 deletions src/pdfjsWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ export default function(PDFJS) {
var source;
if ( typeof(src) === 'string' )
source = { url: src };
else
if ( typeof(src) === 'object' && src !== null )
else if ( src instanceof Uint8Array )
source = { data: src };
else if ( typeof(src) === 'object' && src !== null )
source = Object.assign({}, src);
else
throw new TypeError('invalid src type');
Expand Down

0 comments on commit 6df0b7e

Please sign in to comment.