If you had read the documentation associated with the ViewPDF extension, you would see that there is an AddOn extension which provides access to assets with the compiled app.
You use the extension for a compiled app, otherwise you can use a file path to the pdf when running the companion. The AddOn extension will not work in companion.