mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 01:35:43 +02:00
Ensure that the PDF header contains an actual number (PR 11463 follow-up)
While it would be nice to change the `PDFFormatVersion` property, as returned through `PDFDocumentProxy.getMetadata`, to a number (rather than a string) that would unfortunately be a breaking API change. However, it does seem like a good idea to at least *validate* the PDF header version on the worker-thread, rather than potentially returning an arbitrary string.
This commit is contained in:
parent
a5fec297c0
commit
88c35d872f
4 changed files with 101 additions and 1 deletions
|
@ -1121,6 +1121,28 @@ describe("api", function() {
|
|||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
it("gets metadata, with missing PDF header (bug 1606566)", function(done) {
|
||||
const loadingTask = getDocument(buildGetDocumentParams("bug1606566.pdf"));
|
||||
|
||||
loadingTask.promise
|
||||
.then(function(pdfDocument) {
|
||||
return pdfDocument.getMetadata();
|
||||
})
|
||||
.then(function({ info, metadata, contentDispositionFilename }) {
|
||||
// The following are PDF.js specific, non-standard, properties.
|
||||
expect(info["PDFFormatVersion"]).toEqual(null);
|
||||
expect(info["IsLinearized"]).toEqual(false);
|
||||
expect(info["IsAcroFormPresent"]).toEqual(false);
|
||||
expect(info["IsXFAPresent"]).toEqual(false);
|
||||
expect(info["IsCollectionPresent"]).toEqual(false);
|
||||
|
||||
expect(metadata).toEqual(null);
|
||||
expect(contentDispositionFilename).toEqual(null);
|
||||
|
||||
loadingTask.destroy().then(done);
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
|
||||
it("gets data", function(done) {
|
||||
var promise = doc.getData();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue