Class HTMLToPDFJob
- 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:- "application/zip", if the input is a local zip archive.
- "text/html", if the input is a static HTML file with inline CSS
- The main HTML file must be named "index.html".
- "index.html" must exist at the top level of zip archive, not in a folder.
Sample layout:
html_files.zip |__index.html |__referenced_file_1.css |__referenced_file_2.jpeg |__subfolder_1 |_____referenced_file_3.jpeg
Namespace: Adobe.PDFServicesSDK.pdfjobs.jobs
Assembly: Adobe.PDFServicesSDK.Doc.dll
Syntax
public class HTMLToPDFJob : PDFServicesJob
Examples
Sample Usage:
ICredentials credentials = new ServicePrincipalCredentials(
Environment.GetEnvironmentVariable("PDF_SERVICES_CLIENT_ID"),
Environment.GetEnvironmentVariable("PDF_SERVICES_CLIENT_SECRET"));
PDFServices pdfServices = new PDFServices(credentials);
HTMLToPDFJob htmlToPDFJob = new HTMLToPDFJob("URL");
String location = pdfServices.Submit(htmlToPDFJob);
PDFServicesResponse<HTMLToPDFResult> pdfServicesResponse =
pdfServices.GetJobResult<HTMLToPDFResult>(location, typeof(HTMLToPDFResult));
IAsset resultAsset = pdfServicesResponse.Result.Asset;
StreamAsset streamAsset = pdfServices.GetContent(resultAsset);
Constructors
HTMLToPDFJob(IAsset)
Constructs a new HTMLToPDFJob
instance.
Declaration
public HTMLToPDFJob(IAsset asset)
Parameters
HTMLToPDFJob(String)
Constructs a new HTMLToPDFJob
instance.
Declaration
public HTMLToPDFJob(string inputURL)
Parameters
Type | Name | Description |
---|---|---|
System. |
inputURL | string representing the input URL; can not be null. |
Methods
SetOutput(IAsset)
Sets the output asset for the job.
Declaration
public HTMLToPDFJob SetOutput(IAsset outputAsset)
Parameters
Type | Name | Description |
---|---|---|
IAsset | outputAsset | IAsset object representing the output asset; can not be null. |
Returns
Type | Description |
---|---|
HTMLTo |
|
Remarks
External assets can be set as output only when input is external asset as well
SetParams(HTMLToPDFParams)
Sets the parameters for the job.
Declaration
public HTMLToPDFJob SetParams(HTMLToPDFParams htmlToPDFParams)
Parameters
Type | Name | Description |
---|---|---|
HTMLTo |
htmlToPDFParams | HTMLTo |
Returns
Type | Description |
---|---|
HTMLTo |
|