/// <summary> /// Sets any custom options for the operation. /// </summary> /// <param name="htmlToPDFOperation">operation instance for which the options are provided.</param> private static void SetCustomOptions(CreatePDFOperation htmlToPDFOperation) { // Define the page layout, in this case an 8 x 11.5 inch page (effectively portrait orientation). PageLayout pageLayout = new PageLayout(); pageLayout.SetPageSize(8, 11.5); // Set the desired HTML-to-PDF conversion options. CreatePDFOptions htmlToPdfOptions = CreatePDFOptions.HtmlOptionsBuilder() .IncludeHeaderFooter(true) .WithPageLayout(pageLayout) .Build(); htmlToPDFOperation.SetOptions(htmlToPdfOptions); }
/// <summary> /// Sets any custom options for the operation. /// </summary> /// <param name="htmlToPDFOperation">operation instance for which the options are provided.</param> private static void SetCustomOptions(CreatePDFOperation htmlToPDFOperation) { // Define the page layout, in this case an 8 x 11.5 inch page (effectively portrait orientation). PageLayout pageLayout = new PageLayout(); pageLayout.SetPageSize(8, 11.5); //Set the dataToMerge field that needs to be populated in the HTML before its conversion JObject dataToMerge = new JObject { { "title", "Create, Convert PDFs and More!" }, { "sub_title", "Easily integrate PDF actions within your document workflows." } }; // Set the desired HTML-to-PDF conversion options. CreatePDFOptions htmlToPdfOptions = CreatePDFOptions.HtmlOptionsBuilder() .IncludeHeaderFooter(true) .WithPageLayout(pageLayout) .WithDataToMerge(dataToMerge) .Build(); htmlToPDFOperation.SetOptions(htmlToPdfOptions); }