import { Injector, Type } from '@angular/core'; import { DomSanitizer } from '@angular/platform-browser'; import { BehaviorSubject } from 'rxjs'; import * as i0 from "@angular/core"; export declare class DmCmpsHtmlPrinterService { private readonly sanitizer; private readonly injector; /** * Controls the direction of the printed content. * * When no value is provided, the service uses the current document direction. */ readonly direction$: BehaviorSubject<"ltr" | "rtl" | undefined>; constructor(sanitizer: DomSanitizer, injector: Injector); /** * Prints the provided HTML content. * * On mobile devices, the content is opened in a new browser window. * On larger screens, the content is rendered inside a temporary iframe. * * @param htmlContent HTML content to print. * @returns Opens the browser printing dialog with the provided HTML content. * * @usageNotes * * #### TypeScript * * ```typescript * export class YourComponent { * constructor( * private readonly htmlPrinterService: DmCmpsHtmlPrinterService, * ) {} * * print(): void { * this.htmlPrinterService.printHtml(` * * *

Content to print

* * * `); * } * } * ``` */ printHtml(htmlContent: string): void; /** * Prints the provided HTML element. * * The method copies the current document stylesheets and includes them in the * printed document. * * @param htmlElement HTML element to print. * @returns Opens the browser printing dialog with the provided element. * * @usageNotes * * #### HTML * * ```html *
* *
* ``` * * #### TypeScript * * ```typescript * export class YourComponent { * constructor( * private readonly htmlPrinterService: DmCmpsHtmlPrinterService, * ) {} * * print(): void { * const element = document.getElementById('example-area-to-print'); * * if (!element) { * console.error('Element not found'); * return; * } * * this.htmlPrinterService.printHtmlElement(element); * } * } * ``` */ printHtmlElement(htmlElement: HTMLElement): void; /** * Creates and prints an Angular component dynamically. * * The component must be available to the application's environment injector. * The component instance is destroyed after its rendered HTML is copied for * printing. * * Angular services needed for dynamic component creation are resolved lazily * only when this method is called. This prevents circular dependency errors * while constructing this service. * * @param component Angular component type to print. * * @usageNotes * * #### TypeScript * * ```typescript * export class YourComponent { * constructor( * private readonly htmlPrinterService: DmCmpsHtmlPrinterService, * ) {} * * print(): void { * this.htmlPrinterService.printComponent(ComponentToPrint); * } * } * ``` */ printComponent(component: Type): void; /** * Opens and prints HTML content using a new browser window. * * This method is mainly used on mobile devices where printing from a hidden * iframe may not work reliably. */ private printHtmlUsingWindow; /** * Opens and prints HTML content using a temporary hidden iframe. */ private printHtmlUsingIframe; /** * Returns all stylesheet links and inline style elements from the current * document. */ private getDocumentStyles; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; }