WX Pack PDF Viewer problem

I'm trying to use the three PDF Viewer components (the viewer, toolbar and thumbnails) in a WEB Core project. Creating a new project, dropping these three components on the form and connecting them works without issue. I can't seem to load a file though. I get an error like this.

Uncaught ReferenceError: TMSFNCWXPDFViewer1_idshowPDFBase64 is not defined
    at executeScript1FAC01F037B90403F8D3E71E510E1A10 (<anonymous>:2:2)

Curiously, the PDF Viewer demo that comes with the WX Pack works absolutely fine, even with all three components (the demo doesn't use the toolbar or thumbnail components. And I'm at a complete loss as to what is different between them.

Also curiously, the onViewerInitialized event isn't fired in the new project at all, but fires consistently in the WX Pack demo, so I'm thinking that's where the problem might be? But not sure how the component gets initialized? I've tried various combinations of the JS files loaded in Project.html, but it doesn't seem to make any difference either.


Looks like something goes wrong with the scripts in new projects. An empty script tag is added which causes this problem.

<script src="https://code.jquery.com/jquery-3.5.1.min.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.10.377/pdf.min.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.10.377/pdf.worker.min.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.10.377/pdf_viewer.min.js" type="text/javascript"></script>
<script src="" type="text/javascript"></script> <!--This here-->
<script src="$(ProjectName).js" type="text/javascript"></script>

We'll look for a fix but in the meantime can you check if you also have this empty script tag? Is your project working after removing it?

Yes !!!

OMG. That was so frustrating :joy: Didn't even see that lurking there, as I was so focused on everything else that might be different, and nothing was! All good :+1:


1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.