Skip to content

Commit

Permalink
improve pdf url support
Browse files Browse the repository at this point in the history
  • Loading branch information
crabbly committed May 19, 2018
1 parent 6b1fdd0 commit 507a159
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/js/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import Print from './print'

export default {
print: (params, printFrame) => {
// Format pdf url
params.printable = params.printable.indexOf('http') !== -1
? params.printable
: window.location.origin + (params.printable.charAt(0) !== '/' ? '/' + params.printable : params.printable)

// If showing a loading modal or using a hook function, preload pdf file
if (params.showModal || params.onLoadingStart) {
// Get the file through a http request
Expand All @@ -20,7 +25,7 @@ export default {
send(params, printFrame)
})

req.open('GET', params.printable.indexOf('http') !== -1 ? params.printable : window.location.origin + params.printable, true)
req.open('GET', params.printable, true)
req.send()
} else {
send(params, printFrame)
Expand Down

0 comments on commit 507a159

Please sign in to comment.