Pdf Viewer net service¶
This is in principle the .net code we are using:
https://ej2.syncfusion.com/javascript/documentation/pdfviewer/how-to/create-pdfviewer-service/
It’s a bit tweaked to be more up to date in regards to the VS version and that page there doesn’t have the latest .cs code.
It’s early days, so not much functionality beyond displaying a pdf and clearing the viewer.
You can download the compiled version of the .net pdf service from the Files tab above (we will supply the .net source code later on as well)
The folder above is the .net webservice. It also has a bunch of pdf’s in the Data subfolder.
Please note this zip contains .dll files and other binaries. So you will have to use “Unblock” in the zip file properties in order to be able to use it.
The way to setup this webservice is:
• Unzip it in a folder that IIS can use (so not under Program Files, but in a location easily accessible from your webapp)
• Keep the folder name sfWebPdfViewer
• Create an IIS app for that by pointing to it in IIS (New Application -> C:\whereever\the\folder\lives\sfWebPdfViewer )
• Give it the application name “sfWebPdfViewer”
• Browse to that folder ( eg. http://localhost/sfWebPdfViewer )
• If all is well then you get to see the pdf viewer rendering a pdf. (I put a simple index.html demo in the same folder, so you can test the setup)
• If not, reply with the error you’re seeing.
• First thing to try is to rename/delete the x86 folder .. seems like the web service created that itself and I left it in the zip for now.
Once that works… the next thing is to download the updated demo workspace and try it in the demo.
Troubleshooting¶
HTTP Error 500.19¶
If you get the following error:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Error code: 0x80070021
Error data: The configuration cannot be used at this path. This happens when a section is locked at the parent level. Blah blah blah
Then you're seeing this error because .net support has not been added to your server yet.
Add the following under Windows features:
(Hint: Type "Windows Features" at the start menu in Windows and it should show up)
-> Internet Information Services -> World Wide Web Services -> Application Development Features
* .NET Extensibility 4.8
* ASP.NET 4.8
Click OK
This needs to be at least ASP.net 4.5 or higher.
Without any of that you can't run a .net website.
Service isn't running¶
Note that in order to satisfy CORS that the .net webservice has to run under the same domain.
So you can test your localhost web app by setting up a localhost service.
But if your webapp is running on say example.com then the pdf webservice will also have to run under example.com.
After that you'll have to set the psServiceURL property.
Assuming you have kept the default name for the folder sfWebPdfViewer that would look like:
Set psServiceUrl to "https://example.com/sfWebPdfViewer/api/pdfviewer"