I'm making an app using Laravel 10 & Angular 16, and I want to show only a part of a PDF file, similar to websites like scribd.com
Is it possible to render only part of a PDF file (limited number of pages) using <ngx-extended-pdf-viewer>?
Here's what I have in my component's HTML file:
<ngx-extended-pdf-viewer [src]="fileURL"></ngx-extended-pdf-viewer>
Where fileURL is a Blob object retrieved from a backend API response.
...
showPDF(book_id: number) {
this.bookService.showPDF(book_id).subscribe({
next: (blob) => {
const file = new Blob([blob], { type: 'application/pdf' });
this.fileURL = URL.createObjectURL(file);
},
error: console.log,
})
}
...
Here's the service
...
showPDF(book_id: number): Observable<any> {
const token = localStorage.getItem('token');
const httpOptions = {
headers: new HttpHeaders({
'Authorization': `Bearer ${token}`,
}),
responseType: 'blob' as 'json',
};
return this.http.get<any>(`http://127.0.0.1:8000/api/book/${book_id}/show-pdf`, httpOptions);
}
...
I'm able to render the full PDF file, but that's not quite what I'm looking for.