Please give a brief summary of your issue:
(Think of this as an email subject)
Having issues with the following line
PDFNet.initialize()
Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)
I am attempting to create a downloadable PDF that is merged with exported annotations from PDFtron.
Since I have a URL to the PDF I want to merge I was planning on using
await PDFNet.PDFDoc.createFromURL(downloadUrl);
However, I get an error logged from PDFTron saying I need to run the following line first.
await PDFNet.initialize()
Unfortunately the init on my dev server just hangs and any code below it is not run despite it working fine in a local environment. In fact the PDF download works fine with or without the init. I have also tried passing in my license which seems to have no effect on the issue. Is there anything specific I can look into as why there would be a discrepancy between the two environments? The rest of PDFTron is currently working fine in both environments and that seems to be the only line where behavior changes.
Thanks.
Please provide a link to a minimal sample where the issue is reproducible:
The only thing that comes to mind is perhaps the workers are not available in your dev environment.
In which case, there should be an error thrown in the console.
Are there any errors thrown in the console from WebViewer?
Best Regards,
Ahmad Moaaz
Software Developer
PDFTron Systems, Inc. www.pdftron.com
The only errors we get from PDFTron are when we do not include PDFNet.initialize(), it throws an error saying to run it before calling PDFNet.PDFDoc.createFromURL. However in our local env we do not run initialize at all and everything works fine.
The PDFNet.initialize is automatically run by the WebViewer code at some point. But to ensure it is ready when you require it, it’s best to initialize PDFNet yourself.
Are you able to send your WebViewer code, in which you call PDFNet.initialize() so I can reproduce the issue to look into it further?
Best Regards,
Ahmad Moaaz
Software Developer
PDFTron Systems, Inc. www.pdftron.com
This is the code we are using to add a download link into PDFtron. Like I mentioned before, on our local env there are no errors thrown. In fact the initalize line is not even required for the code to work. However when ran on our dev env, we get the error to run PDFNet.initialize() if this line is not included, and when we do include it, the error disappears but no code after the initialize is ever run.
After further investigation, it appears your dataElement is clashing with the existing dataElement for the built-in download button. Please change the dataElement of your added button and see if it still doesn’t work.
Best Regards,
Ahmad Moaaz
Software Developer
PDFTron Systems, Inc. www.pdftron.com
Can you please send your WebViewer initialization code?
Also please update to the latest as it might fix the issue and since it’s a minor release, all your previous code should also work.
Best Regards,
Ahmad Moaaz
Software Developer
PDFTron Systems, Inc. www.pdftron.com
It looks like your license key is not read-only so should be able to use the built-in download.
Were you able to update and did it fix your issue?
Please ensure you do not have any calls like this to disable the download button: