VadimDez / ng2-pdf-viewer

📄 PDF Viewer Component for Angular
https://vadimdez.github.io/ng2-pdf-viewer/
MIT License
1.3k stars 419 forks source link

How to Send the HTML to backend #1023

Open VijiSridhar95 opened 1 year ago

VijiSridhar95 commented 1 year ago
Bug Report or Feature Request (mark with an x)
- [ ] Regression (a behavior that used to work and stopped working in a new release)
- [ ] Bug report -> please search issues before submitting
- [X] Feature request
- [ ] Documentation issue or request

First Question: In my scenario, am supposed to send the HTML rendered to backend also.(C# .NET server).I uploaded the PDF and able to view the HTML but need to send the same HTML to back end also. When I tried to get the html via innerHtml of the viewChild am not getting all the pages(only 1st 2 pages is having data others are Loading), since the HTML is not rendered completely. Am using the below logic . Is there any other way to get the html for the uploaded pdf and send it back to server.

@ViewChild('pdfViewer', { static: false }) pdfViewer!: PdfViewerComponent; render() : void { this.html = this.pdfViewer.pdfViewerContainer.nativeElement.innerHTML; console.log("the rendered html", this.html); }

Loading page

Second Question: I need to navigate to a particular section and highlight the section. How to achieve the navigation. Outline function is returning null for the PDF document which I uploaded. In html: <pdf-viewer #pdfViewer [src]="pdfSrc" (after-load-complete)="callBackFn($event)">

In typescript: callBackFn(pdf: PDFDocumentProxy): void { pdf.getOutline().then((outline: any[]) => { console.log("outline", outline); }); }

VijiSridhar95 commented 1 year ago

@VadimDez any suggestion on how to get the HTML and send it to backend.

stale[bot] commented 9 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.