冰蓝科技
|
028-81705109
|
|
微信扫一扫
|

Spire.Cloud 纯前端文档控件

Spire.Office 7.8.4 已发布。该版本进行了一些功能更新,如:Spire.XLS支持获取单元格相关联的范围; Spire.Presentation增强了PPT到PDF的转换功能;Spire.PDF增强了 PDF 到 SVG 和图片,以及 OFD 到 PDF 的转换。此外,该版本还成功修复了大量已知问题。详情请阅读以下内容。

该版本涵盖了最新版的Spire.Doc,Spire.PDF,Spire.XLS,Spire.Email,Spire.DocViewer, Spire.PDFViewer,Spire.Presentation,Spire.Spreadsheet, Spire.OfficeViewer, Spire.DocViewer, Spire.Barcode, Spire.DataExport。

版本信息如下:

获取Spire.Office 7.8.4 请点击:

https://www.e-iceblue.cn/Downloads/Spire-Office-NET.html


Spire.XLS

新功能:

问题修复:


Spire.Presentation

问题修复:


Spire.PDF

问题修复:

Spire.Presentation for Java 7.8.2 已发布。本次更新新增支持设置自动换片时间以及判断文档是否加密。此版本还增强了 PPT 到 HTML 和 PDF 的转换。此外,许多已知问题也得到了修复,如:拆分 PPT 文档后, “自动换片” 的选中状态不正确等问题。详情请阅读以下内容。

新功能:

问题修复:


获取Spire.Presentation for Java 7.8.2请点击:

https://www.e-iceblue.cn/Downloads/Spire-Presentation-JAVA.html

Spire.PDF 8.8.6 已发布。本次更新增强了 PDF 到 SVG 和图片,以及 OFD 到 PDF 的转换。此外,此版本还修复了一些已知问题,如:转换的 PDF/A3A 文档不符合标准和灰度转换后文件损坏等问题。详情请阅读以下内容。

问题修复:


获取Spire.PDF 8.8.6请点击:

https://www.e-iceblue.cn/Downloads/Spire-PDF-NET.html

Spire.XLS 12.8.1已发布。本次更新支持获取单元格相关联的范围。并增强了Excel到PDF的转换功能。此外,还修复了保存后,Excel文档中的图片被替换等已知问题。详情请阅读以下内容。

新功能:

问题修复:


下载Spire.XLS 12.8.1请点击:

https://www.e-iceblue.cn/Downloads/Spire-XLS-NET.html

RTF(Rich Text Format)指富文本格式,是微软开发的一种跨平台文档格式,方便于不同的设备、系统查看的文本和图形文档。大多数文字处理软件都能读取和保存RTF文档。富文本格式包含多种页面格式选项,如自定义页边距、行距和跳格宽度等。富文本格式可以帮助使用者便捷地创建栏目、表格,以及以更易阅读的格式制作文档。本文将介绍如何使用 Spire.Doc for .NET 将 Word 文档转换为 RTF 文档或将 RTF 文档转换为 Word 文档

安装 Spire.Doc for .NET

首先,您需要添加 Spire.Doc for .NET 包中包含的 DLL 文件作为 .NET 项目中的引用。DLL 文件可以从此链接下载或通过 NuGet 安装。

PM> Install-Package Spire.Doc

将 Word 文档转为 RTF 文档

使用 Spire.Doc for .NET 将 Word 文档转换为 RTF 文档非常简单,只需载入 Word 文档后保存问 RTF 文件即可。以下是操作步骤:

  • C#
  • VB.NET
using Spire.Doc;
using System;

namespace ConvertWordToPng
{
    class Program
    {
        static void Main(string[] args)
        {
            //创建 Document 类的对象
            Document doc = new Document();

            //载入Word文档
            doc.LoadFromFile(@"C:\示例.docx");

            //将Word文档保存为RTF文档
            doc.SaveToFile("Word转RTF.rtf", FileFormat.Rtf);
        }
    }
}
Imports Spire.Doc
Imports System

Namespace ConvertWordToPng
    Class Program
        Shared Sub Main(ByVal args() As String)
            '创建 Document 类的对象
            Dim doc As Document = New Document()

            '载入Word文档
            doc.LoadFromFile("https://cdn.e-iceblue.cn/C:\示例.docx")

            '将Word文档保存为RTF文档
            doc.SaveToFile("Word转RTF.rtf", FileFormat.Rtf)
        End Sub
    End Class
End Namespace

C#/VB.NET Word 转 RTF 或 RTF 转 Word

将 RTF 文档转为 Word 文档

操作步骤如下:

  • C#
  • VB.NET
using Spire.Doc;
using System;

namespace ConvertWordToPng
{
    class Program
    {
        static void Main(string[] args)
        {
            //创建 Document 类的对象
            Document doc = new Document();

            //载入RTF文档
            doc.LoadFromFile(@"C:\示例.rtf", FileFormat.Rtf);

            //将RTF文档保存为Word文档
            doc.SaveToFile("RTF转Word.docx", FileFormat.Docx2013);
        }
    }
}
Imports Spire.Doc
Imports System

Namespace ConvertWordToPng
    Class Program
        Shared Sub Main(ByVal args() As String)
            '创建 Document 类的对象
            Dim doc As Document = New Document()

            '载入RTF文件
            doc.LoadFromFile("https://cdn.e-iceblue.cn/C:\示例.rtf", FileFormat.Rtf)

            '将RTF文件保存为Word文档
            doc.SaveToFile("RTF转Word.docx", FileFormat.Docx2013)
        End Sub
    End Class
End Namespace

C#/VB.NET Word 转 RTF 或 RTF 转 Word

申请临时 License

如果您希望删除结果文档中的评估消息,或者摆脱功能限制,请该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。获取有效期 30 天的临时许可证。

与 Word 文档相比,图片格式的文件不需要安装 MS Word 就可以直接查看,便于在不同平台之间分享和预览文档内容。而且将 Word 文档转换为图片可以保护文档的原始外观,让文档不会因被他人编辑而破坏原有的排布等。本文将展示用 Spire.Doc for .NET 以编程的方式将 Word 文档转换为图片的操作方法。

安装 Spire.Doc for .NET

首先,您需要添加 Spire.Doc for .NET 包中包含的 DLL 文件作为 .NET 项目中的引用。DLL 文件可以从此链接下载或通过 NuGet 安装。

PM> Install-Package Spire.Doc

将 Word 文档转换为 JPG 格式的图片

Spire.Doc for .NET 为大家提供了 Document.SaveToImages() 方法以将 Word 文档的页面分别转换为位图(Bitmap)或图元文件(Metafile)。之后,我们可以将位图或图元文件保存为 BMP、EMF、JPEG、PNG、GIF、WMF 等格式的图片。以下是将 Word 文档转换为 JPG 格式图片的操作步骤。

  • C#
  • VB.NET
using Spire.Doc;
using Spire.Doc.Documents;
using System;
using System.Drawing;
using System.Drawing.Imaging;

namespace ConvertWordToJPG
{
    class Program
    {
        static void Main(string[] args)
        {
            //创建 Document 类的对象
            Document doc = new Document();

            //载入Word文档
            doc.LoadFromFile(@"C:\示例.docx");

            //将整个文档的页面分别转换为图片
            Image[] images = doc.SaveToImages(ImageType.Bitmap);

            //在转换出的图片集合中循环
            for (int i = 0; i < images.Length; i++)
            {
                //将图片保存的JPG文件
                string outputfile = String.Format("图片-{0}.jpg", i);
                images[i].Save(outputfile, ImageFormat.Jpeg);
            }
        }
    }
}
Imports Spire.Doc
Imports Spire.Doc.Documents
Imports System
Imports System.Drawing
Imports System.Drawing.Imaging

Namespace ConvertWordToJPG
    Class Program
        Shared Sub Main(ByVal args() As String)
            '创建 Document 类的对象
            Dim doc As Document = New Document()

            '载入Word文档
            doc.LoadFromFile("https://cdn.e-iceblue.cn/C:\示例.docx")

            '将整个文档的页面分别转换为图片
            Dim images() As Image = doc.SaveToImages(ImageType.Bitmap)

            '在转换出的图片集合中循环
            Dim i As Integer
            For i = 0 To images.Length - 1 Step i + 1
                '将图片保存的JPG文件
                Dim outputfile As String = String.Format("图片-{0}.jpg", i)
                images(i).Save(outputfile, ImageFormat.Jpeg)
            Next
        End Sub
    End Class
End Namespace

将 Word 文档转换为 SVG 格式的图片

你可以用 Spire.Doc for .NET 将 Word 文档保存为一系列字节数组(Byte Array),然后再将这些字节数组分别写入 SVG 文件。以下是将 Word 文档转换为 SVG 文件的操作步骤。

  • C#
  • VB.NET
using Spire.Doc;
using System;
using System.Collections.Generic;
using System.IO;

namespace CovnertWordToSVG
{
    class Program
    {
        static void Main(string[] args)
        {
            //创建 Document 类的对象
            Document doc = new Document();

            //载入Word文档
            doc.LoadFromFile(@"C:\示例.docx");

            //将文档保存为一系列字节数组
            Queue<byte[]> svgBytes = doc.SaveToSVG();

            //循环遍历所有字节数组
            for (int i = 0; i < svgBytes.Count; i++)
            {
                //将数组写入SVG文件
                byte[][] bytes = svgBytes.ToArray();
                string outputfile = String.Format("图片-{0}.svg", i);
                FileStream fs = new FileStream(outputfile, FileMode.Create);
                fs.Write(bytes[i], 0, bytes[i].Length);
                fs.Close();
            }
        }
    }
}
Imports Spire.Doc
Imports System
Imports System.Collections.Generic
Imports System.IO

Namespace CovnertWordToSVG
    Class Program
        Shared Sub Main(ByVal args() As String)
            '创建 Document 类的对象
            Dim doc As Document = New Document()

            '载入Word文档
            doc.LoadFromFile("https://cdn.e-iceblue.cn/C:\示例.docx")

            '将文档保存为一系列字节数组
            Dim svgBytes()> As Queue<Byte =  doc.SaveToSVG() 
 
            '循环遍历所有字节数组
            Dim i As Integer
            For i = 0 To svgBytes.Count - 1 Step i + 1
                '将数组写入SVG文件
                Dim bytes()() As Byte = svgBytes.ToArray()
                Dim outputfile As String = String.Format("图片-{0}.svg", i)
                Dim fs As FileStream = New FileStream(outputfile, FileMode.Create)
                fs.Write(bytes(i), 0, bytes(i).Length)
                fs.Close()
            Next
        End Sub
    End Class
End Namespace

将 Word 文档转换为 PNG 图片并自定义分辨率

分辨率更高的图片能够将内容展示得更清楚,通过以下步骤,你可以在转换 Word 文档到 PNG 图片时,设置其分辨率。

  • C#
  • VB.NET
using Spire.Doc;
using System;
using System.Drawing;
using System.Drawing.Imaging;
using Spire.Doc.Documents;

namespace ConvertWordToPng
{
    class Program
    {
        static void Main(string[] args)
        {
            //创建 Document 类的对象
            Document doc = new Document();

            //载入 Word 文档
            doc.LoadFromFile(@"C:\示例.docx");

            //将整个Word文档转换为位图集合
            Image[] images = doc.SaveToImages(ImageType.Metafile);

            //循环遍历位图集合中的位图
            for (int i = 0; i < images.Length; i++)
            {
                //设置图片的分辨率
                Image newimage = ResetResolution(images[i] as Metafile, 150);

                //将图片保存为PNG文件
                string outputfile = String.Format("图片-{0}.png", i);
                newimage.Save(outputfile, ImageFormat.Png);
            }
        }

        //设置图片分辨率
        public static Image ResetResolution(Metafile mf, float resolution)
        {
            int width = (int)(mf.Width * resolution / mf.HorizontalResolution);
            int height = (int)(mf.Height * resolution / mf.VerticalResolution);
            Bitmap bmp = new Bitmap(width, height);
            bmp.SetResolution(resolution, resolution);
            using (Graphics g = Graphics.FromImage(bmp))
            {
                g.DrawImage(mf, Point.Empty);
            }
            return bmp;
        }
    }
}
Imports Spire.Doc
Imports System
Imports System.Drawing
Imports System.Drawing.Imaging
Imports Spire.Doc.Documents

Namespace ConvertWordToPng
    Class Program
        Shared Sub Main(ByVal args() As String)
            '创建 Document 类的对象
            Dim doc As Document = New Document()

            '载入 Word 文档
            doc.LoadFromFile("https://cdn.e-iceblue.cn/C:\示例.docx")

            '将整个Word文档转换为位图集合
            Dim images() As Image = doc.SaveToImages(ImageType.Metafile)

            '循环遍历位图集合中的位图
            Dim i As Integer
            For i = 0 To images.Length - 1 Step i + 1
                '设置图片的分辨率
                Dim Newimage As Image = ResetResolution(images(i) As Metafile, 150)

                '将图片保存为PNG文件
                Dim outputfile As String = String.Format("图片-{0}.png", i)
                Newimage.Save(outputfile, ImageFormat.Png)
            Next
        End Sub

        '设置图片分辨率
        Public Shared Function ResetResolution(ByVal mf As Metafile, ByVal resolution As Single) As Image
            Dim width As Integer = CType((mf.Width * resolution / mf.HorizontalResolution), Integer)
            Dim height As Integer = CType((mf.Height * resolution / mf.VerticalResolution), Integer)
            Dim bmp As Bitmap = New Bitmap(width, height)
            bmp.SetResolution(resolution, resolution)
            Imports (Graphics g = Graphics.FromImage(bmp))
            {
                g.DrawImage(mf, PoInteger.Empty)
            }
            Return bmp
        End Function
    End Class
End Namespace

C#/VB.NET 将 Word 转为图片(JPG、PNG、SVG)

申请临时 License

如果您希望删除结果文档中的评估消息,或者摆脱功能限制,请该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。获取有效期 30 天的临时许可证。

我们创建的 Excel 表格有时可能包含一些不想让其他人编辑的数据或是公式,这时我们可以将对应的单元格锁定,这样可以有效地保护表格数据或公式的完整性。本文将介绍如何使用 Spire.XLS for .NET 以编程的方式锁定 Excel 表格的指定单元格

安装 Spire.XLS for .NET

首先,您需要将 Spire.XLS for .NET 包含的 DLL 文件作为引用添加到您的 .NET 项目中。DLL 文件可以从此链接下载,也可以通过 NuGet 安装。锁定 Excel 表格的指定单元格

PM> Install-Package Spire.XLS

锁定 Excel 表格的指定单元格

通常情况下,Excel 表格中的所有单元格都是锁定的状态。因此,我们需要先将所有单元格解锁,再进行锁定。需要注意的是,只有在表格被保护的情况下,锁定单元格的设置才会生效。

以下是在 Excel 表格中锁定指定单元格的详细操作步骤:

  • C#
  • VB.NET
using Spire.Xls;

namespace LockCells
{
    class Program
    {
        static void Main(string[] args)
        {
            //创建 Workbook 类的对象
            Workbook workbook = new Workbook();

            //载入 Excel 表格
            workbook.LoadFromFile(@"C:\示例.xlsx");

            //获取第一个工作表
            Worksheet sheet = workbook.Worksheets[0];

            //解锁该工作表中所有已使用的单元格
            CellRange usedRange = sheet.Range;
            usedRange.Style.Locked = false;

            //锁定指定单元格
            CellRange cells = sheet.Range["A1:F2"];
            cells.Style.Locked = true;

            //用密码保护该工作表
            sheet.Protect("123456", SheetProtectionType.All);

            //保存 Excel 表格
            workbook.SaveToFile("锁定单元格.xlsx", ExcelVersion.Version2016);
        }
    }
}
Imports Spire.Xls

Namespace LockCells
    Class Program
        Shared Sub Main(ByVal args() As String)
            '创建 Workbook 类的对象
            Dim workbook As Workbook = New Workbook()

            '载入 Excel 表格
            workbook.LoadFromFile("C:\示例.xlsx")

            '获取第一个工作表
            Dim sheet As Worksheet = workbook.Worksheets(0)

            '解锁该工作表中所有已使用的单元格
            Dim usedRange As CellRange = sheet.Range
            usedRange.Style.Locked = False

            '锁定指定单元格
            Dim cells As CellRange = sheet.Range("A1:F2")
            cells.Style.Locked = True

            '用密码保护该工作表
            sheet.Protect("123456", SheetProtectionType.All)

            '保存 Excel 表格
            workbook.SaveToFile("锁定单元格.xlsx", ExcelVersion.Version2016)
        End Sub
    End Class
End Namespace

C#/VB.NET Excel 表格中锁定指定单元格

申请临时 License

如果您希望删除结果文档中的评估消息,或者摆脱功能限制,请该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。获取有效期 30 天的临时许可证。

在篇幅较长的 Word 文档中查找指定的文本内容是比较麻烦的事情,好在 MS Word 提供了查找功能,能够快速定位到文档中指定内容所在的位置。当然,你还可以对找到的文本内容进行突出显示,以防读者遗漏这些内容。本文将介绍如何使用 Spire.Doc for .NET 以编程的方式在 Word 文档中查找并突出显示文本

安装 Spire.Doc for .NET

首先,您需要将 Spire.Doc for.NET 包含的 DLL 文件作为引用添加到您的 .NET 项目中。DLL 文件可以从此链接下载,也可以通过 NuGet 安装。

PM> Install-Package Spire.Doc

在 Word 文档中查找并突出显示指定文本

详细操作步骤如下:

  • C#
  • VB.NET
using System;
using System.Drawing;
using Spire.Doc;
using Spire.Doc.Documents;

namespace FindAndHighlightText
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //创建 Document 类的对象
            Document document = new Document();

            //载入Word文档
            document.LoadFromFile(@"C:/示例.docx");

            //找到所有匹配的文本
            TextSelection[] text = document.FindAllString("庄子", false, true);

            //循环遍历所有匹配的文本,并设置突出显示
            foreach (TextSelection seletion in text)
            {
                seletion.GetAsOneRange().CharacterFormat.HighlightColor = Color.Yellow;
            }

            //保存文档
            document.SaveToFile("查找并突出显示文本.docx", FileFormat.Docx);
        }
    }
}
Imports System
Imports System.Drawing
Imports Spire.Doc
Imports Spire.Doc.Documents

Namespace FindAndHighlightText
    Friend Class Program
        Shared Sub Main(ByVal args() As String)
            '创建 Document 类的对象
            Dim document As Document = New Document()

            '载入Word文档
            document.LoadFromFile("C:/示例.docx")

            '找到所有匹配的文本
            Dim text() As TextSelection = document.FindAllString("庄子", False, True)

            '循环遍历所有匹配的文本,并设置突出显示
            Dim seletion As TextSelection
            For Each seletion In text
                seletion.GetAsOneRange().CharacterFormat.HighlightColor = Color.Yellow
            Next

            '保存文档
            document.SaveToFile("查找并突出显示文本.docx", FileFormat.Docx)
        End Sub
    End Class
End Namespace

C#/VB.NET 在 Word 文档中查找并突出显示文本

申请临时 License

如果您希望删除结果文档中的评估消息,或者摆脱功能限制,请该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。获取有效期 30 天的临时许可证。

Spire.Presentation 7.8 已发布。本次更新增强了 PPT 到 PDF 的转换。此外,该版本还修复了一些已知问题,如:复制幻灯片时程序抛异常 “DocumentEditException” 和修复图表的数据源后数据无法自动更新等问题。详情请阅读以下内容。

问题修复:


获取Spire.Presentation 7.8请点击:

https://www.e-iceblue.cn/Downloads/Spire-Presentation-NET.html

Tab 1

此演示向您展示如何将 PDF 文档转换为 Docx、XPS、HTML、图像等。

Upload

Maximum file size: 1 MB. Files accepted: pdf.
Click here to browse files.
fileerrors

Convert to

Source file:
filename
Target file type:

如果这不是您想要的 Demo,您可以通过填写表格获取免费定制 Demo

如您有与我们产品相关的其他技术问题,请联系 该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。;销售相关的问题,请联系 该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。

Tab 2

import com.spire.pdf.FileFormat;
import com.spire.pdf.PdfDocument;
import com.spire.pdf.conversion.PdfStandardsConverter;
import com.spire.pdf.graphics.PdfImageType;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

public class PdfConvertDemo {

    public void pdfConversion(String pdfFile,String convertType) throws IOException {
        String outputFileName = "output";
        PdfDocument pdf=new PdfDocument();
        pdf.loadFromFile(pdfFile);
        PdfStandardsConverter standardsConverter = new PdfStandardsConverter(pdfFile);
        switch (convertType) {
            case "DOCX":
                outputFileName += ".docx";
                pdf.saveToFile(outputFileName, FileFormat.DOCX);
                break;
            case "DOC":
                outputFileName += ".doc";
                pdf.saveToFile(outputFileName, FileFormat.DOC);
                break;
            case "XPS":
                outputFileName += ".xps";
                pdf.saveToFile(outputFileName, FileFormat.XPS);
                break;
            case "XLSX":
                outputFileName += ".xlsx";
                pdf.saveToFile(outputFileName, FileFormat.XLSX);
                break;
            case "POSTSCRIPT":
                outputFileName += ".ps";
                pdf.saveToFile(outputFileName, FileFormat.POSTSCRIPT);
                break;
            case "HTML":
                outputFileName += ".html";
                pdf.saveToFile(outputFileName, FileFormat.HTML);
                break;
            case "IMAGE":
                BufferedImage image=null;
                for (int i = 0; i < pdf.getPages().getCount(); i++) {
                    image= pdf.saveAsImage(i, PdfImageType.Bitmap);
                    ImageIO.write(image,"PNG",new File(outputFileName+i+".png"));
                }
                break;
            case "SVG":
                outputFileName+=".svg";
                pdf.saveToFile(outputFileName, FileFormat.SVG);
                break;
            case "TIFF":
                outputFileName += ".tiff";
                pdf.saveToTiff(outputFileName);
                break;
            case "PDFA1A":
                outputFileName += ".pdf";
                standardsConverter.toPdfA1A(outputFileName);
                break;
            case "PDFA1B":
                outputFileName += ".pdf";
                standardsConverter.toPdfA1B(outputFileName);
                break;
            case "PDFA2A":
                outputFileName += ".pdf";
                standardsConverter.toPdfA2A(outputFileName);
                break;
            case "PDFA2B":
                outputFileName += ".pdf";
                standardsConverter.toPdfA2B(outputFileName);
                break;
            case "PDFA3A":
                outputFileName += ".pdf";
                standardsConverter.toPdfA3A(outputFileName);
                break;
            case "PDFA3B":
                outputFileName += ".pdf";
                standardsConverter.toPdfA3B(outputFileName);
                break;
        }
        pdf.close();
    }
}

                        

Tab 3

using Spire.Pdf;
using Spire.Pdf.Conversion;
using Spire.Pdf.Graphics;
using System;
using System.Drawing;
using System.Drawing.Imaging;

namespace DemoOnlineCode
{
    class PdfConvertDemo
    {
        public void PdfConversions(string pdfFile, string convertType)
        {
            String outputFileName = "output";
            PdfDocument pdf = new PdfDocument();
            pdf.LoadFromFile(pdfFile);
            PdfStandardsConverter standardsConverter = new PdfStandardsConverter(pdfFile);
            switch (convertType)
            {
                case "DOCX":
                    outputFileName += ".docx";
                    pdf.SaveToFile(outputFileName, FileFormat.DOCX);
                    break;
                case "DOC":
                    outputFileName += ".doc";
                    pdf.SaveToFile(outputFileName, FileFormat.DOC);
                    break;
                case "XPS":
                    outputFileName += ".xps";
                    pdf.SaveToFile(outputFileName, FileFormat.XPS);
                    break;
                case "XLSX":
                    outputFileName += ".xlsx";
                    pdf.SaveToFile(outputFileName, FileFormat.XLSX);
                    break;
                case "POSTSCRIPT":
                    outputFileName += ".ps";
                    pdf.SaveToFile(outputFileName, FileFormat.POSTSCRIPT);
                    break;
                case "HTML":
                    outputFileName += ".html";
                    pdf.ConvertOptions.SetPdfToHtmlOptions(true, false, 1, false);
                    pdf.SaveToFile(outputFileName, FileFormat.HTML);
                    break;
                case "IMAGE":
                    Image image = null;
                    for (int i = 0; i < pdf.Pages.Count; i++)
                    {
                        image = pdf.SaveAsImage(i, PdfImageType.Bitmap);
                        image.Save(outputFileName + i + ".png",ImageFormat.Png);
                    }
                    break;
                case "SVG":
                    outputFileName += ".svg";
                    pdf.SaveToFile(outputFileName, FileFormat.SVG);
                    break;
                case "TIFF":
                    outputFileName += ".tiff";
                    JoinTiffImages(SaveAsImage(pdf), outputFileName, EncoderValue.CompressionLZW);
                    break;
                case "PDFA1A":
                    outputFileName += ".pdf";
                    standardsConverter.ToPdfA1A(outputFileName);
                    break;
                case "PDFA1B":
                    outputFileName += ".pdf";
                    standardsConverter.ToPdfA1B(outputFileName);
                    break;
                case "PDFA2A":
                    outputFileName += ".pdf";
                    standardsConverter.ToPdfA2A(outputFileName);
                    break;
                case "PDFA2B":
                    outputFileName += ".pdf";
                    standardsConverter.ToPdfA2B(outputFileName);
                    break;
                case "PDFA3A":
                    outputFileName += ".pdf";
                    standardsConverter.ToPdfA3A(outputFileName);
                    break;
                case "PDFA3B":
                    outputFileName += ".pdf";
                    standardsConverter.ToPdfA3B(outputFileName);
                    break;
            }
            pdf.Close();
        }
        private static Image[] SaveAsImage(PdfDocument document)
        {
            Image[] images = new Image[document.Pages.Count];
            for (int i = 0; i < document.Pages.Count; i++)
            {
                //Use the document.SaveAsImage() method save the pdf as image
                images[i] = document.SaveAsImage(i);
            }
            return images;
        }

        private static ImageCodecInfo GetEncoderInfo(string mimeType)
        {
            ImageCodecInfo[] encoders = ImageCodecInfo.GetImageEncoders();
            for (int j = 0; j < encoders.Length; j++)
            {
                if (encoders[j].MimeType == mimeType)
                    return encoders[j];
            }
            throw new Exception(mimeType + " mime type not found in ImageCodecInfo");
        }
        public static void JoinTiffImages(Image[] images, string outFile, EncoderValue compressEncoder)
        {
            //Use the save encoder
            System.Drawing.Imaging.Encoder enc = System.Drawing.Imaging.Encoder.SaveFlag;
            EncoderParameters ep = new EncoderParameters(2);
            ep.Param[0] = new EncoderParameter(enc, (long)EncoderValue.MultiFrame);
            ep.Param[1] = new EncoderParameter(System.Drawing.Imaging.Encoder.Compression, (long)compressEncoder);
            Image pages = images[0];
            int frame = 0;
            ImageCodecInfo info = GetEncoderInfo("image/tiff");
            foreach (Image img in images)
            {
                if (frame == 0)
                {
                    pages = img;
                    //Save the first frame
                    pages.Save(outFile, info, ep);
                }
                else
                {
                    //Save the intermediate frames
                    ep.Param[0] = new EncoderParameter(enc, (long)EncoderValue.FrameDimensionPage);
                    pages.SaveAdd(img, ep);
                }
                if (frame == images.Length - 1)
                {
                    //Flush and close.
                    ep.Param[0] = new EncoderParameter(enc, (long)EncoderValue.Flush);
                    pages.SaveAdd(ep);
                }
                frame++;
            }
        }
    }
}