ng-pdf-renderer
Version:
A modern, zero-configuration PDF viewer for Angular applications with enhanced error handling, auto-fit, text selection, and responsive design
109 lines (108 loc) • 3.32 kB
TypeScript
import { Observable } from 'rxjs';
import * as i0 from "@angular/core";
/**
* Service handling PDF operations using PDF.js
* Provides methods to load, navigate, and manipulate PDF documents
*/
export declare class PdfService {
private pdfDocumentSubject;
pdfDocument$: Observable<any>;
private currentPageSubject;
currentPage$: Observable<number>;
private totalPagesSubject;
totalPages$: Observable<number>;
private zoomSubject;
zoom$: Observable<number>;
private rotationSubject;
rotation$: Observable<number>;
private linkService;
private _pdfDocument;
private _viewer;
private configService;
constructor();
/**
* Gets the link service for handling annotations
* @returns The link service instance
*/
getLinkService(): any;
/**
* Get the current PDF document
* @returns The current PDF document or null if none is loaded
*/
getCurrentDocument(): any;
/**
* Clear the current document and reset state
* Used when switching between PDFs
*/
clearDocument(): void;
/**
* Configures the PDF.js worker source automatically
* This eliminates the need for users to manually copy worker files
*/
private configureWorkerSource;
/**
* Loads a PDF document from a URL or binary data
* @param src URL or binary data of the PDF
* @returns Promise resolving to the loaded PDF document
*/
loadDocument(src: string | Uint8Array): Promise<any>;
/**
* Sets the current page to display
* @param pageNumber The page number to display (1-based index)
*/
setCurrentPage(pageNumber: number): void;
/**
* Navigate to the next page if available
*/
nextPage(): void;
/**
* Navigate to the previous page if available
*/
previousPage(): void;
/**
* Set the zoom level for the PDF
* @param zoom The zoom level (1 = 100%)
*/
setZoom(zoom: number): void;
/**
* Increase zoom by 20%
*/
zoomIn(): void;
/**
* Decrease zoom by 20%
*/
zoomOut(): void;
/**
* Rotate the PDF by a specified number of degrees
* @param degrees The degrees to rotate (positive = clockwise, negative = counterclockwise)
*/
rotate(degrees: number): void;
/**
* Get the document outline (bookmarks)
* @returns Promise resolving to the outline structure or empty array
*/
getOutline(): Promise<any[]>;
/**
* Generate a thumbnail for a specific page
* @param pageNumber The page number to generate thumbnail for
* @param scale The scale for the thumbnail (smaller = faster)
* @returns Promise resolving to data URL of the thumbnail
*/
generateThumbnail(pageNumber: number, scale?: number): Promise<string>;
/**
* Search for text in the PDF document
* @param text The text to search for
* @returns Promise resolving to an array of search results
*/
search(text: string): Promise<any[]>;
/**
* Download the PDF document
*/
downloadPdf(): Promise<void>;
/**
* Print the PDF document
*/
printPdf(): Promise<void>;
static ɵfac: i0.ɵɵFactoryDeclaration<PdfService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<PdfService>;
}