I hope you’re all doing well. So I’ve been working with PDF.js by Mozilla for a while now. We’re using it to display PDF forms to be filled out on a mobile app. Everything works great, I’m just trying to implement a feature where you can cache the users entries so that they can resume from where they left off. For a few reasons I can’t just download the PDF to save it and then load it back up when they wat to resume.
Essentially I want to store all the user entries and the Field ID for each of them, which I’ve already gotten working, and then when the user wants to resume I want it to load the empty PDF, and then automatically re-populate all the fields with the cached entries.
I know I could set the individual text fields, but when I do that it doesn’t apply to the annotationStorage so when I parse the form, those fields are read as blank.
I’ve tried the following lines of code in an attempt to set a field value with the id “5R”
PDFViewerApplication.pdfDocument.annotationStorage.getAll()['5R'].value = "Shirboogle";
var objs = await PDFViewerApplication.pdfDocument.getFieldObjects(); objs['Address 1 Text Box'].value = "Shirboogle"; // and objs['Address 1 Text Box'].defaultValue = "Shirboogle";
// This will actually set the value of the text field, but when I look for it in annotationStorage OR // getFieldObjects() the value is still unchanged. document.getElementById('pdfjs_internal_id_5R').value = 'Shapoopsies';
along with many other attempts. I’ve looked all over and nothing seems to be available, so if you have any ideas please let me know!