mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
Adds additional parameter so background color of canvas can be set
This commit is contained in:
parent
08f8b68f12
commit
cfc2f36f5c
8 changed files with 429 additions and 27 deletions
|
@ -13,7 +13,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CMapCompressionType } from '../../src/shared/util';
|
||||
import { CMapCompressionType, isNodeJS } from '../../src/shared/util';
|
||||
|
||||
class NodeFileReaderFactory {
|
||||
static fetch(params) {
|
||||
|
@ -23,6 +23,26 @@ class NodeFileReaderFactory {
|
|||
}
|
||||
}
|
||||
|
||||
const TEST_PDFS_PATH = {
|
||||
dom: '../pdfs/',
|
||||
node: './test/pdfs/',
|
||||
};
|
||||
|
||||
function buildGetDocumentParams(filename, options) {
|
||||
let params = Object.create(null);
|
||||
if (isNodeJS()) {
|
||||
params.data = NodeFileReaderFactory.fetch({
|
||||
path: TEST_PDFS_PATH.node + filename,
|
||||
});
|
||||
} else {
|
||||
params.url = new URL(TEST_PDFS_PATH.dom + filename, window.location).href;
|
||||
}
|
||||
for (let option in options) {
|
||||
params[option] = options[option];
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
class NodeCMapReaderFactory {
|
||||
constructor({ baseUrl = null, isCompressed = false, }) {
|
||||
this.baseUrl = baseUrl;
|
||||
|
@ -57,4 +77,6 @@ class NodeCMapReaderFactory {
|
|||
export {
|
||||
NodeFileReaderFactory,
|
||||
NodeCMapReaderFactory,
|
||||
buildGetDocumentParams,
|
||||
TEST_PDFS_PATH,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue