Esempio n. 1
0
        /// <summary>
        /// Sets any custom options for the operation.
        /// </summary>
        /// <param name="createPdfOperation">operation instance for which the options are provided.</param>
        private static void SetCustomOptions(CreatePDFOperation createPdfOperation)
        {
            // Select the documentLanguage for input file.
            SupportedDocumentLanguage documentLanguage = SupportedDocumentLanguage.EN_US;

            // Set the desired Word-to-PDF conversion options.
            CreatePDFOptions createPDFOptions = CreatePDFOptions.WordOptionsBuilder()
                                                .WithDocumentLanguage(documentLanguage)
                                                .Build();

            createPdfOperation.SetOptions(createPDFOptions);
        }
Esempio n. 2
0
        /// <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);
        }