예제 #1
0
        public void ExportPdf()
        {
            string text = this.Filename;

            if (string.IsNullOrEmpty(text))
            {
                text = this.Title;
            }
            SaveFileDialog saveFileDialog = new SaveFileDialog
            {
                Filter           = this.SavePdfFileTypes,
                FileName         = System.IO.Path.GetFileNameWithoutExtension(text),
                RestoreDirectory = true
            };
            bool?  flag     = saveFileDialog.ShowDialog();
            string fileName = saveFileDialog.FileName;

            if (!flag.Value || string.IsNullOrEmpty(fileName))
            {
                return;
            }
            EditorRenderer._logger.Trace("Exporting PDF document: " + fileName);
            HtmlTemplate htmlTemplate = this.HtmlTemplate;

            htmlTemplate.UseBaseRelativeImageWorkaround = true;
            string      content     = htmlTemplate.GenerateHtmlTemplate(false);
            PdfExporter pdfExporter = new PdfExporter(fileName, content)
            {
                IncludeCssBackground    = this._settings.IO_Pdf_IncludeBackground,
                EnableOutlineGeneration = this._settings.IO_Pdf_EnableOutlineGeneration
            };

            pdfExporter.ExportPdf();
        }