Pdf Viewer net service » History » Version 3
Wil van Antwerpen, 03/20/2024 12:11 PM
| 1 | 1 | Wil van Antwerpen | # Pdf Viewer net service |
|---|---|---|---|
| 2 | |||
| 3 | This is in principle the .net code we are using: |
||
| 4 | https://ej2.syncfusion.com/javascript/documentation/pdfviewer/how-to/create-pdfviewer-service/ |
||
| 5 | |||
| 6 | 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. |
||
| 7 | |||
| 8 | It’s early days, so not much functionality beyond displaying a pdf and clearing the viewer. |
||
| 9 | |||
| 10 | 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) |
||
| 11 | |||
| 12 | The folder above is the .net webservice. It also has a bunch of pdf’s in the Data subfolder. |
||
| 13 | 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. |
||
| 14 | |||
| 15 | The way to setup this webservice is: |
||
| 16 | • Unzip it in a folder that IIS can use (so not under Program Files, but in a location easily accessible from your webapp) |
||
| 17 | • Keep the folder name sfWebPdfViewer |
||
| 18 | • Create an IIS app for that by pointing to it in IIS (New Application -> C:\whereever\the\folder\lives\sfWebPdfViewer ) |
||
| 19 | • Give it the application name “sfWebPdfViewer” |
||
| 20 | • Browse to that folder ( eg. http://localhost/sfWebPdfViewer ) |
||
| 21 | • 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) |
||
| 22 | • If not, reply with the error you’re seeing. |
||
| 23 | • 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. |
||
| 24 | |||
| 25 | |||
| 26 | Once that works… the next thing is to download the updated demo workspace and try it in the demo. |
||
| 27 | |||
| 28 | 2 | Wil van Antwerpen | ## Troubleshooting |
| 29 | |||
| 30 | ### HTTP Error 500.19 |
||
| 31 | |||
| 32 | 1 | Wil van Antwerpen | If you get the following error: |
| 33 | |||
| 34 | HTTP Error 500.19 - Internal Server Error |
||
| 35 | |||
| 36 | The requested page cannot be accessed because the related configuration data for the page is invalid. |
||
| 37 | |||
| 38 | Error code: 0x80070021 |
||
| 39 | |||
| 40 | Error data: The configuration cannot be used at this path. This happens when a section is locked at the parent level. Blah blah blah |
||
| 41 | |||
| 42 | Then you're seeing this error because .net support has not been added to your server yet. |
||
| 43 | |||
| 44 | Add Windows features: |
||
| 45 | |||
| 46 | -> IIS -> Application Development |
||
| 47 | * .NET Extensibility 4.7 |
||
| 48 | * ASP.NET 4.7 |
||
| 49 | |||
| 50 | This needs to be ASP.net 4.5 or higher. |
||
| 51 | |||
| 52 | Without any of that you can't run a .net website. |
||
| 53 | 2 | Wil van Antwerpen | |
| 54 | ### Service isn't running |
||
| 55 | |||
| 56 | Note that in order to satisfy CORS that the .net webservice has to run under the same domain. |
||
| 57 | So you can test your localhost web app by setting up a localhost service. |
||
| 58 | But if your webapp is running on say example.com then the pdf webservice will also have to run under example.com. |
||
| 59 | 3 | Wil van Antwerpen | |
| 60 | After that you'll have to set the psServiceURl, assuming you have kept the default name for the folder sfWebPdfViewer that would look like: |
||
| 61 | |||
| 62 | ~~~ text |
||
| 63 | Set psServiceUrl to "https://example.com/sfWebPdfViewer/api/pdfviewer" |
||
| 64 | ~~~ |