Pdftron blocking the @capacitor/filesystem respnse

@pdftron/webviewer : 11.0.0

I am working on Ionic 7 app using Capacitor 5 and PDFTron for PDF file preview. I am encountering an issue where the @capacitor/filesystem plugin’s readFile function works when you read a file for base64 encoding, but stops responding after using PDFTron to preview the file.

The Problem:

  1. Base64 Encoding with Filesystem: I am using the @capacitor/filesystem plugin to read a file and convert it into a base64 string for previewing it with PDFTron. This step works fine, and I get the base64 encoded string.

  2. PDFTron Preview: Once I pass the base64 string to PDFTron for previewing, things seem to work for the preview, but when you try to access the file again using the @capacitor/filesystem plugin (e.g., to read it again or modify it), the call to readFile does not respond.

  3. When PDFTron code is removed: If I remove the PDFTron-related code, the call to readFile works again, meaning that the issue appears to be tied to using PDFTron for previewing the file.

1 Like

Hi there,

It looks like capacitor’s readFile API reads a file from disk:

If you are loading the file on WebViewer, the file on WebViewer will be in memory. Are you retrieving the file again from the disk or from WebViewer?

Can you share a minimal runnable sample project to reproduce the issue?

Also, are you using the Iframe implementation or WebComponent? The file may be restricted if trying to access it from the Iframe method.

Best regards,
Kevin Kim

1 Like