mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Add support for saving forms
This commit is contained in:
parent
3380f2a7fc
commit
1a6816ba98
16 changed files with 1060 additions and 8 deletions
|
@ -13,10 +13,10 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { isRef, Ref } from "../../src/core/primitives.js";
|
||||
import { Page, PDFDocument } from "../../src/core/document.js";
|
||||
import { assert } from "../../src/shared/util.js";
|
||||
import { isNodeJS } from "../../src/shared/is_node.js";
|
||||
import { isRef } from "../../src/core/primitives.js";
|
||||
import { StringStream } from "../../src/core/stream.js";
|
||||
|
||||
class DOMFileReaderFactory {
|
||||
|
@ -70,6 +70,7 @@ class XRefMock {
|
|||
streamTypes: Object.create(null),
|
||||
fontTypes: Object.create(null),
|
||||
};
|
||||
this._newRefNum = null;
|
||||
|
||||
for (const key in array) {
|
||||
const obj = array[key];
|
||||
|
@ -77,6 +78,17 @@ class XRefMock {
|
|||
}
|
||||
}
|
||||
|
||||
getNewRef() {
|
||||
if (this._newRefNum === null) {
|
||||
this._newRefNum = Object.keys(this._map).length;
|
||||
}
|
||||
return Ref.get(this._newRefNum++, 0);
|
||||
}
|
||||
|
||||
resetNewRef() {
|
||||
this.newRef = null;
|
||||
}
|
||||
|
||||
fetch(ref) {
|
||||
return this._map[ref.toString()];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue