This repository has been archived by the owner on Jun 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from legalthings/source-as-binary
Added attribute to set raw data as the source of the pdf
- Loading branch information
Showing
7 changed files
with
197 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,25 @@ | ||
angular.module('app', ['pdfjsViewer']); | ||
|
||
angular.module('app').controller('AppCtrl', function($scope) { | ||
angular.module('app').controller('AppCtrl', function ($scope, $http, $timeout) { | ||
var url = 'example.pdf'; | ||
|
||
$scope.pdf = { | ||
src: 'example.pdf' | ||
src: url, // get pdf source from a URL that points to a pdf | ||
data: null // get pdf source from raw data of a pdf | ||
}; | ||
|
||
getPdfAsArrayBuffer(url).then(function (response) { | ||
$scope.pdf.data = new Uint8Array(response.data); | ||
}, function (err) { | ||
console.log('failed to get pdf as binary:', err); | ||
}); | ||
|
||
function getPdfAsArrayBuffer (url) { | ||
return $http.get(url, { | ||
responseType: 'arraybuffer', | ||
headers: { | ||
'foo': 'bar' | ||
} | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.