|
|
@ -1,13 +1,17 @@ |
|
|
|
|
|
|
|
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
|
|
|
|
|
|
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ |
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// See README for overview
|
|
|
|
// See README for overview
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Ajax GET request, for binary files
|
|
|
|
// Ajax GET request, for binary files
|
|
|
|
// (like jQuery's $.get(), but supports the binary type ArrayBuffer)
|
|
|
|
// (like jQuery's $.get(), but supports the binary type ArrayBuffer)
|
|
|
|
//
|
|
|
|
//
|
|
|
|
var ajaxGet = function(url, callback){ |
|
|
|
var ajaxGet = function(url, callback) { |
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
|
xhr.open('GET', url); |
|
|
|
xhr.open('GET', url); |
|
|
|
xhr.mozResponseType = xhr.responseType = 'arraybuffer'; |
|
|
|
xhr.mozResponseType = xhr.responseType = 'arraybuffer'; |
|
|
@ -21,12 +25,12 @@ var ajaxGet = function(url, callback){ |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
xhr.send(null); |
|
|
|
xhr.send(null); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// This is where the fun happens
|
|
|
|
// This is where the fun happens
|
|
|
|
//
|
|
|
|
//
|
|
|
|
ajaxGet('helloworld.pdf', function(data){ |
|
|
|
ajaxGet('helloworld.pdf', function ajaxGetHelloWorld(data) { |
|
|
|
//
|
|
|
|
//
|
|
|
|
// Instantiate PDFDoc with PDF data
|
|
|
|
// Instantiate PDFDoc with PDF data
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -47,3 +51,4 @@ ajaxGet('helloworld.pdf', function(data){ |
|
|
|
//
|
|
|
|
//
|
|
|
|
page.startRendering(context); |
|
|
|
page.startRendering(context); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|