import { PDFServicesJob } from "./PDFServicesJob"; import { Asset } from "../../io/Asset"; import { HTMLToPDFParams } from "../params/htmltopdf/HTMLToPDFParams"; import { ExecutionContext } from "../../internal/ExecutionContext"; import { NotifierConfig } from "../../config/notifier/NotifierConfig"; /** * A job that converts a HTML file to a PDF file. Some source formats may have associated conversion parameters * which can be set using the {@link HTMLToPDFParams} parameter. * * *
* An HTML input can be provided either as a local zip archive or as a static HTML file with inline CSS.
* Alternatively, an HTML can also be specified via URL.
*
* While creating the corresponding Asset instance, the media type must be:
*
* Sample layout:
* html_files.zip * |__index.html * |__referenced_file_1.css * |__referenced_file_2.jpeg * |__subfolder_1 * |_____referenced_file_3.jpeg ** *
*
* @example
* Sample Usage:
* ```js
* const credentials = new ServicePrincipalCredentials({
* clientId: process.env.PDF_SERVICES_CLIENT_ID,
* clientSecret: process.env.PDF_SERVICES_CLIENT_SECRET
* });
*
* const pdfServices = new PDFServices({credentials});
*
* const job = new HTMLToPDFJob({inputURL: ""});
*
* const pollingURL = await pdfServices.submit({job});
*
* const pdfServicesResponse = await pdfServices.getJobResult({
* pollingURL,
* resultType: HTMLToPDFResult
* });
*
* const resultAsset = pdfServicesResponse.result.asset;
* const streamAsset = await pdfServices.getContent({asset: resultAsset});
* ```
*/
export declare class HTMLToPDFJob extends PDFServicesJob {
private readonly _inputAsset?;
private readonly _inputURL?;
private readonly _outputAsset?;
private readonly _htmlToPDFParams?;
/**
* Constructs a new `HTMLToPDFJob` instance.
*
* @param params The parameters for constructing an instance of `HTMLToPDFJob`.
* @param [params.inputAsset] {@link Asset} object containing the input file.
* @param [params.inputURL] The URL of the input HTML file.
* @param [params.outputAsset] {@link Asset} object representing the output asset.
* @param [params.params] {@link HTMLToPDFParams} object containing the HTML to PDF conversion parameters.
* @remarks External assets can be set as output only when input is external asset as well.
*/
constructor(params: {
inputAsset?: Asset;
inputURL?: string;
outputAsset?: Asset;
params?: HTMLToPDFParams;
});
/**
* @hidden
*/
process(executionContext: ExecutionContext, notifierConfigList?: NotifierConfig[]): Promise