Unknown action from worker: GetPDFDoc when using WebViewer within PWA

Hello,

i have a Problem when using the WebViewer within a PWA. I’m using Angular und the whole lib-folder with WebViewer-Files is in the ngsw-config.json, so all files are cached.
WebViewer is Version 7.3.3

The Viewer works as expected , commenting on the PDF etc. works fine. I’m using the FullAPI and the PDF is loaded out of indexed db.

But as soon i’d like to call the “getPDFDoc()”-Function as followed:

    await this.webviewer.instance.PDFNet.initialize();
    await this.webviewer.instance.docViewer.getDocument().getPDFDoc();

I get the error “Unkown action from worker: GetPDFDoc”:

But when i don’t cache the lib-Folder (so that the files aren’t cached by the ServiceWorker) everything works as it should (except that i can’t use the Viewer offline).

Any suggestions on how to solve this Problem?

EDIT: I’m using Chrome

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hello Chris,

Can you send the ngsw-config.json file? or the part where you have the lib folder?

Also just to check, I see the error says GetPDFDoc(), there is a small typo, the API is getPDFDoc()

Best Regards,
Tyler Gordon
Web Development Support Engineer
PDFTron Systems, Inc.
www.pdftron.com

Hello Tyler,

here’s the ngsw-config.json:

"assetGroups": [
    {
      "name": "app",
      "installMode": "prefetch",
      "resources": {
        "files": [
          "/favicon.ico",
          "/index.html",
          "/manifest.webmanifest",
          "/*.css",
          "/*.js",
          "/assets/config.js",
          "/assets/i18n/*.json",
          "/libV733/**"
        ]
      },
      "cacheQueryOptions": {
        "ignoreSearch": true
      }
    },
    {
      "name": "assets",
      "installMode": "lazy",
      "updateMode": "prefetch",
      "resources": {
        "files": [
          "!/assets/i18n/**.json",
          "!/assets/config.js",
          "/assets/**",
          "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
        ]
      }
    }
  ]

I don’t know why the error says GetPDFDoc, the code looks like this:

this.webviewer.instance.docViewer.getDocument().getPDFDoc()

Best regards,

Chris

Hey Chris,

Thank you for the config file, this is an interesting problem.

One thing that could be occurring is the non-Full API is being loaded. Can you check/send a screenshot of the network tab to make sure correct WASM files are being loaded? it should look something like this:
NetworkTabWasm

Best Regards,
Tyler Gordon
Web Development Support Engineer
PDFTron Systems, Inc.
www.pdftron.com

Hello Tyler,

looks good i think:

But i also checked the response and it looks a bit weird, but i’m to little in this kind of things to say what the problem here could be. Here are the responses when using Version where Service Worker is caching the PDFTron-Lib-Files:

And here’s the Screenshots of the Version, where Service Worker is not caching the Lib-Files:

Best Regards,

Chris

Hello Chris,

I was unable to reproduce the issue, however I was able to get it working with this setup (admittedly, I am not proficient in Angular)

  1. Move the WebViewer files from /lib to /assets
  2. Update the parameters passed into the WebViewer constructor like so:
    WebViewer({
      path: '../assets',
      initialDoc: '../files/webviewer-demo-annotated.pdf',
      fullAPI: true
    }, this.viewer.nativeElement).then((instance) => {
      this.wvInstance = instance;


      this.wvInstance.docViewer.on('documentLoaded', async () => {
        await this.wvInstance.PDFNet.initialize();
        let doc = await this.wvInstance.docViewer.getDocument().getPDFDoc()
      });
    })
  1. Update the ngsw-config.json file like so:
{
  "$schema": "./node_modules/@angular/service-worker/config/schema.json",
  "index": "/index.html",
  "assetGroups": [
    {
      "name": "app",
      "installMode": "prefetch",
      "resources": {
        "files": [
          "/favicon.ico",
          "/index.html",
          "/manifest.webmanifest",
          "/*.css",
          "/*.js",
          "/assets/*.js",
          "/assets/config.js",
          "/assets/i18n/*.json",
          "/libV733/**"
        ]
      },
      "cacheQueryOptions": {
        "ignoreSearch": true
      }
    },
    {
      "name": "assets",
      "installMode": "lazy",
      "updateMode": "prefetch",
      "resources": {
        "files": [
          "!/assets/i18n/**.json",
          "!/assets/config.js",
          "/assets/*.js",
          "/assets/**",
          "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
        ]
      }
    }
  ]
}
  1. This is my angular.json file:
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "angular": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {},
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "aot": true,
            "outputPath": "dist/angular",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/files",
              "src/lib",
              "src/assets",
              "src/manifest.webmanifest"
            ],
            "styles": [
              "src/styles.css"
            ],
            "serviceWorker": true,
            "ngswConfigPath": "ngsw-config.json"
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "angular:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "angular:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "angular:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "karmaConfig": "src/karma.conf.js",
            "styles": [
              "src/styles.css"
            ],
            "scripts": [],
            "assets": [
              "src/favicon.ico",
              "src/assets",
              "src/files",
              "src/lib",
              "src/manifest.webmanifest"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "angular-e2e": {
      "root": "e2e/",
      "projectType": "application",
      "prefix": "",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "e2e/protractor.conf.js",
            "devServerTarget": "angular:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "angular:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": "e2e/tsconfig.e2e.json",
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "angular"
}
  1. Then running the commands: ng build --prod and then http-server -p 8080 -c-1 dist/angular, I was able to create a local server to test the service worker.

Let me know if this works for you, if not then the next steps would be sending your angular.json and your file structure.

Best Regards,
Tyler Gordon
Web Development Support Engineer
PDFTron Systems, Inc.
www.pdftron.com

Hello Tyler,

i tried to move the lib-folder to the assets folder, but it didn’t changed anything.

I also downloaded the PDFTron-Angular example and tested it. I also updatet the Versions in the example to the Versions, we are using in our project. Here everything is fine and can’t reproduce it either. So the problem must be on our side. I tried out everything, that could be the problem (in my opinion), so anything that put me in the right direction would be very helpfull…

Here’s the Angular.json:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "myapp": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {},
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/myapp",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets",
              "src/libV733",
              "src/license-key.js",
              "src/manifest.webmanifest"
            ],
            "styles": [
              "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
              "src/styles.css"
            ],
            "scripts": [
            ]
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "6mb"
                }
              ],
              "serviceWorker": true,
              "ngswConfigPath": "ngsw-config.json"
            },
            "production_DE": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.DE.ts"
                },
                {
                  "replace": "src/manifest.webmanifest",
                  "with": "src/manifest.prod.DE.webmanifest"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "6mb"
                }
              ],
              "serviceWorker": true,
              "ngswConfigPath": "ngsw-config.json"
            },
           "es5": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.local.ts"
                }
              ],
              "tsConfig": "src/tsconfig-es5.app.json"
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "myapp:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "myapp:build:production"
            },
            "local": {
              "browserTarget": "myapp:build:local"
            },
            "es5": {
              "browserTarget": "myapp:build:es5"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "myapp:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "karmaConfig": "src/karma.conf.js",
            "styles": [
              "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
              "src/styles.css"
            ],
            "scripts": [],
            "assets": [
              "src/favicon.ico",
              "src/assets",
              "src/manifest.webmanifest"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "myapp-e2e": {
      "root": "e2e/",
      "projectType": "application",
      "prefix": "",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "e2e/protractor.conf.js",
            "devServerTarget": "myapp:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "myapp:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": "e2e/tsconfig.e2e.json",
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "myapp"
}

File structure looks like this:

Best Regards,

Chris

Hello Tyler,

after a lot of trying today, i’m able to reproduce the problem. Here’s what i did:

  • Downloaded the official PDFTron Angular Example
  • Added @angular/pwa to the project
  • Added the needed Folders to the angular.json-file
  • Tweaked the app.component.ts, so that the FullAPI is loaded and PDFNet.initialize() as well as getPDFDoc is called after the documentLoaded-Event
  • Tweaked the ngsw-config.json, so that the lib-Folder and the file-Folder is being cached.

Unfortunately i can’t Upload the ZIP-File with the example …

It seems, that the “ignoreSearch”-Flag has soemthing to do with it. If i delete these Flag in the ngsw-config.json it loads the PDF without the error…
Although the example is with WebViewer Version 8.1 i also have the problem with Version 7.3.3.

Here are the files:
ngsw-config.json:

{
  "$schema": "./node_modules/@angular/service-worker/config/schema.json",
  "index": "/index.html",
  "assetGroups": [
    {
      "name": "app",
      "installMode": "prefetch",
      "resources": {
        "files": [
          "/favicon.ico",
          "/index.html",
          "/manifest.webmanifest",
          "/*.css",
          "/*.js",
          "/lib/**",
          "/files/**"
        ]
      },
      "cacheQueryOptions": {
        "ignoreSearch": true
      }
    },
    {
      "name": "assets",
      "installMode": "lazy",
      "updateMode": "prefetch",
      "resources": {
        "files": [
          "/assets/**",
          "/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"
        ]
      }
    }
  ]
}

angular.json:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "angular": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {},
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "aot": true,
            "outputPath": "dist/angular",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/files",
              "src/lib",
              "src/manifest.webmanifest",
              "src/files",
              "src/assets"
            ],
            "styles": [
              "src/styles.css"
            ],
            "serviceWorker": true,
            "ngswConfigPath": "ngsw-config.json"
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "angular:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "angular:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "angular:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "karmaConfig": "src/karma.conf.js",
            "styles": [
              "src/styles.css"
            ],
            "scripts": [],
            "assets": [
              "src/favicon.ico",
              "src/assets",
              "src/files",
              "src/lib",
              "src/manifest.webmanifest"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "angular-e2e": {
      "root": "e2e/",
      "projectType": "application",
      "prefix": "",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "e2e/protractor.conf.js",
            "devServerTarget": "angular:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "angular:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": "e2e/tsconfig.e2e.json",
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "angular"
}

app.component.ts:

import { Component, ViewChild, OnInit, Output, EventEmitter, ElementRef, AfterViewInit } from '@angular/core';
import { Subject } from 'rxjs';
import WebViewer, { WebViewerInstance } from '@pdftron/webviewer';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit, AfterViewInit {
  @ViewChild('viewer') viewer: ElementRef;
  wvInstance: WebViewerInstance;
  @Output() coreControlsEvent:EventEmitter<string> = new EventEmitter(); 

  private documentLoaded$: Subject<void>;

  constructor() {
    this.documentLoaded$ = new Subject<void>();
  }

  ngAfterViewInit(): void {

    WebViewer({
      path: '../lib',
      initialDoc: '../files/webviewer-demo-annotated.pdf',
      fullAPI: true
    }, this.viewer.nativeElement).then(instance => {
      this.wvInstance = instance;

      this.coreControlsEvent.emit(instance.UI.LayoutMode.Single);

      const { documentViewer, Annotations, annotationManager } = instance.Core;

      instance.UI.openElements(['notesPanel']);

      documentViewer.addEventListener('annotationsLoaded', () => {
        console.log('annotations loaded');
      });

      documentViewer.addEventListener('documentLoaded', async () => {
        this.documentLoaded$.next();
        const rectangleAnnot = new Annotations.RectangleAnnotation({
          PageNumber: 1,
          // values are in page coordinates with (0, 0) in the top left
          X: 100,
          Y: 150,
          Width: 200,
          Height: 50,
          Author: annotationManager.getCurrentUser()
        });
        annotationManager.addAnnotation(rectangleAnnot);
        annotationManager.redrawAnnotation(rectangleAnnot);
        await instance.Core.PDFNet.initialize();
        console.log('Initialized');
        await documentViewer.getDocument().getPDFDoc();
        console.log('getPDFDoc successfull');
      });
    })
  }

  ngOnInit() {
  }

  getDocumentLoadedObservable() {
    return this.documentLoaded$.asObservable();
  }
}

Best Regards,

Chris

Hello Chris,

Thank you for the very detailed instructions on how to reproduce the issue, unfortunately it is working for me when I follow the steps you have provided. This could mean there is a difference with the versions/systems we are using.

  1. What version of Angular, Node, and the @angular/pwa package are you using?
  2. How are you starting up your server?
    • There is ng serve to run the development mode
    • There is also ng build --prod then http-server -p 8080 -c-1 dist/angular to run the production mode
  3. If you could create a zip file and send a dropbox/google drive link for me to access or email it directly to me through tgordon@pdftron.com that would greatly help.

Best Regards,
Tyler Gordon
Web Development Support Engineer
PDFTron Systems, Inc.
www.pdftron.com

Hello Tyler,

  1. For the Testversion (but another Version on our full app, it seems to make no difference):
"@angular/pwa": "^13.0.1"
  1. When running with ng serve it works as expected (because no service-worker is present i think). The Problem occurs only when building with ng build --prod and starting the app with http-server

  2. Here are a Dropbox-Link to my example: Dropbox - webviewer-angular-sample-81.zip - Simplify your life

  • Unzip the project
  • Run npm install
  • Run ng build --prod
  • Run http-server -c-1 dist/angular
  • Open Browser (Chrome or Edge) and wait for it to complete loading. After the site is completly loaded, the error is displayed within the Console-Error-Pane

Edit: I tried to email you the Zip, but it didn’t worked for security reasons. So i uploaded the example to dropbox and attached the link above.

Best Regards

Chris

Hey Chris,

Thank you for providing this. Great news, I was able to reproduce the issue with the project you sent. I have also identified a fix for it.

In the ngsw-config.json file, there is an incorrect path to the /lib folder, it should be /src/lib because the ngsw-config.json folder is outside of the /src folder. This is the updated ngsw-config.json file:

{
  "$schema": "./node_modules/@angular/service-worker/config/schema.json",
  "index": "/index.html",
  "assetGroups": [
    {
      "name": "app",
      "installMode": "prefetch",
      "resources": {
        "files": [
          "/favicon.ico",
          "/index.html",
          "/manifest.webmanifest",
          "/*.css",
          "/*.js",
          "/src/lib/**",
          "/src/files/**"
        ]
      },
      "cacheQueryOptions": {
        "ignoreSearch": true
      }
    },
    {
      "name": "assets",
      "installMode": "lazy",
      "updateMode": "prefetch",
      "resources": {
        "files": [
          "/assets/**",
          "/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"
        ]
      }
    }
  ]
}

Let me know if this works for you!

Best Regards,
Tyler Gordon
Web Development Support Engineer
PDFTron Systems, Inc.
www.pdftron.com

Hello Tyler,

i think the path is right. Installing the pwa-package also adds the assets folder to src/assets but in the ngsw-config.json there is also only /assets (which is all automatically added).

And yes, if i replace /lib/** with /src/lib/** the error doesn’t occur anymore, but this is because the service-worker isn’t finding the lib-folder.

Have you checked the CacheStorage after the change? There should be the files of the lib-folder, but they aren’t after that change. So now when you Check “Offline” inside DevTools->Application->Service Workers, the App isn’t loading anymore.

Although i hoped that it was only a (very dumb) mistake by me, unfortunately it doesn’t solve the Problem.

Best Regards

Chris

Hello Tyler,

i just wanted to let you know, that i opened a Support-Ticket. I thought, this is a error, that would be interesting for other people too, but unfortunately i have a deadline to hold and i hope that things go a little bit faster with “normal” Tech Support (we are payed subscription customers).

Best Regards

Chris

Hello Chris,

Im writing what Andrew replied with on your ticket for other users if they encounter this issue:

“After investigating the issue a bit, it looks like in “ngsw-config.json”, you will need to include “isfull: true” under “cacheQueryOptions”. WebViewer uses web workers and use query parameter to pass information to the worker about which files it needs to load. It looks like Angular isn’t allowing the query parameters to be passed, so the workers are loading the “lean” resources instead of the “full” resources. Let me know if adding the “isfull: true” works for you, we’ll update our guides to include this information and investigate if there anything we can do about it on our end, but it’s looking like there not much we can do for our codebase in this case. Thank you for bringing this issue up for us”

Best Regards,
Tyler Gordon
Web Development Support Engineer
PDFTron Systems, Inc.
www.pdftron.com

Hi,

I want to clear up some confusion about this issue in case someone else come across this issue. The issue is that ignoreSearch: true is preventing query parameters from being used when caching resources. The solution is to split up the “asset Group” in two, so something like

  "assetGroups": [
    {
      "name": "app",
      "installMode": "prefetch",
      "resources": {
        "files": [
          "/favicon.ico",
          "/index.html",
          "/manifest.webmanifest",
          "/*.css",
          "/*.js",
          "/files/**"
        ]
      },
      "cacheQueryOptions": {
        "ignoreSearch": true
      }
    },
    {
      "name": "webviewerResources",
      "installMode": "prefetch",
      "resources": {
        "files": [
          "/lib/**"
        ]
      "cacheQueryOptions": {
        "ignoreSearch":  false
      }
    }
]

So remove the “/lib/**” from the “app” group and create a new group for it without ignoreSearch: true. You don’t actually need the ignoreSearch: false for the “webviewerResources” since it default to false already.

Also in a future release, we might update our workers to use messages passing instead of query parameters so this issue doesn’t come up in the future. But for the time being, make sure the ignoreSearch property isn’t set to true for WebViewer resources.

Best Regards,

Andrew Yip
Software Developer
PDFTron Systems, Inc.
www.pdftron.com