Closed scry-UrjitDesai closed 3 weeks ago
I don't know why your server doesn't work, but I've pushed a working example to https://github.com/stephanrauh/ngx-extended-pdf-viewer-issues/tree/main/issue2353. Clone the repository, put your large PDF file into the assets/pdf folder, and run npm i express && ng b && node simple-express-server.js
.
If you need a more sophisticated approach, have a look at the file express-server.js
. However, the simple solution already did the trick for me.
Your code snippet looks almost identical to my solution. Maybe it's really nginx that ruins the show. However, that sounds unlikely to me.
Description I have an angular front-end and an express backend. In my backend, I have a route which reads a pdf file and sends it to the frontend. Since the pdf files can be huge (>50mb) I am making use of range-requests as mentioned in the documentation.
In my browser developer tools, I see an initial request and then several other requests being made to the route. The initial request has a response status of 200 and all the others have a response status of 206 which is the expected behavior. However, I notice that the entire pdf file is loaded all at once only when the first request is finished and the response size of the first request is the total file size which I feel shouldn't be the case.
I checked out the following link-https://pdfviewer.net/extended-pdf-viewer/server-side-rendering In the above link, in the networks tab, the pages start to load after the initial few requests. Moreover, the first request has a status code of 200 and the response size is very small.
Here is the code snippet- Angular
Express
I have attached a video link for a smaller file which shows the requests- https://drive.google.com/file/d/1w9FybqJNOJiFAbiZMzUU03V8aiue7sQZ/view?usp=sharing
For context, my backend is being served via nginx.
Versions
"ngx-extended-pdf-viewer": "18.1.14",