Drop lists / combo boxes break after first save

We’re facing an issue where users cannot choose options from drop lists after a document has been saved using PDF.js Express. This is reproducible in the demo on your website.

Secondly, the red outline around drop lists is not positioned correctly. Drop lists should probably not be outlined in red as it implies ‘required’ to most of our users, despite the fields not being required at all.

To reproduce:

  • Upload Original.pdf into the demo.
  • Choose an option from a drop list field.
  • Save / Download.
  • Reload the demo and upload the newly saved pdf.
  • Try to choose a different option from the same drop list that was used earlier.

Original.pdf (263.2 KB)
Broken.pdf (330.3 KB)

1 Like

Hi Ryan,

Thank you for finding this bug on the demo site.

We’ve added the issue to our backlog to be worked on in the future. We don’t have a timeline for when it will be fixed but if it does get fixed we’ll let you know when it’s available in an experimental build to test out and the estimated official release date. If you have a desired timeline for having this issue fixed please let us know and we’ll do our best to work with you on how this can fit into the release schedule.

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.


Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here

We need a quick fix on this Zach, we have 100’s of clients that will be affected by this issue!

Hi there,

I will update this in our internal ticket. It will be worked on ASAP.

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.


Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here

Hi there,

Just an update this issue is on the demo site only.

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.

We discovered this issue on actual production software using PDF.js Express and later reproduced it on the demo site. It is not limited to the demo site.

Which version on you using in production?

I have tested this in version 8.7 and have no issues.

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.

We’re seeing this on 8.7. It only happens after loading a file that was previously saved (see instructions in OP)

I am only able to reproduce this with the ‘Broken.pdf’ that you have attached in the first post.

Could you share how are you saving/downloading the file?

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.

Here is a video of it occurring in the demo (which appears to be 8.7 according to the output in the developer tools):

https://wyliesystems-my.sharepoint.com/:v:/g/personal/r_ewen_wyliesystems_ca/EU7PvOx42thDtDlRMsvAQrQBKIKxSSC5nMWuXH4EHk4p9A?e=DFQLhB

There’s a secondary bug that can be seen in the video as well, which is that the chosen values appear to be lost upon zooming in.

Thank you for the video, however I am referring to how you are saving/download in your application, not on the demo site.

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.

We’re using the API to merge the XFDF and PDF using the ‘set’ command.

Would you be will to provide a code snippet?

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.

It is easily reproducible in your demo given the files and instructions contained within the first post here, so you already have access to code, but here is some of our code as well.

Creating the viewer and loading a PDF document into it:

const viewer = await WebViewer({
    licenseKey: licenseKeys.viewer,
    path: '3rdparty/pdfjs-express/public',
    disableFlattenedAnnotations: true,
}, container_element)

viewer.disableFeatures([
    viewer.Feature.LocalStorage,
    viewer.Feature.Measurement,
    viewer.Feature.FilePicker,
    viewer.Feature.Print,
    viewer.Feature.MultipleViewerMerging,
    viewer.Feature.ThumbnailMerging,
    viewer.Feature.ThumbnailReordering,
    viewer.Feature.MouseWheelZoom,
])

// default to fit-to-width zoom level
viewer.UI.setFitMode(viewer.UI.FitMode.FitWidth)

// custom form field styling
viewer.Core.Annotations.WidgetAnnotation.getCustomStyles = widget => {
    if (widget instanceof viewer.Core.Annotations.TextWidgetAnnotation) {
        return {
            'background-color': 'lightblue'
        }
    }
}

// load blob into viewer and wait for it to be loaded before continuing
await new Promise(res => {
    viewer.docViewer.on('documentLoaded', res)

    viewer.UI.loadDocument(pdf_blob, { extension: 'pdf' })
})

// default to the view tools (has no extra toolbar to show underneath)
viewer.UI.setToolbarGroup('toolbarGroup-View', false)

// default to the pan tool
viewer.UI.setToolMode(viewer.Core.Tools.ToolNames.PAN)

// load annotations using pdf.js express utils
const viewer_utils = new ExpressUtils(licenseKeys.api)

const data = await viewer.docViewer.getDocument().getFileData()

viewer_utils.setFile(data)

const { xfdf } = await viewer_utils.extract()

await viewer.annotManager.importAnnotations(xfdf)

Downloading the updated PDF from the viewer:

const fileData = await viewer.docViewer.getDocument().getFileData({})
const xfdf = await viewer.annotManager.exportAnnotations({})
const resp = await viewer_utils
    .setFile(fileData)
    .setXFDF(xfdf)
    .set()

const blob = await resp.getBlob()

Thanks for the code sample.

While I’m digging into this, can you confirm that you have a license for PDFjs Express Plus?

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.

Yes we do. If not under my specific account, then it’s under the CEO’s account (w.mckinty)