6
C# 将OFD转为PDF
source link: https://blog.51cto.com/miayo/5243860
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
C# 将OFD转为PDF
原创转换的方法将PDF转为OFD,或者将OFD转为PDF。本次内容,将通过C#程序介绍如何实现由OFD到PDF的转换,并附上VB.NET代码供参考。下面是具体方法和步骤。
一、按照如下步骤引入Spire.Pdf.dll
步骤1:在Visual Studio中打开“解决方案资源管理器”- 鼠标右键点击“引用”-“管理NuGet包”。
步骤2:选择“浏览”-在搜索框中输入搜索内容,选择搜索结果,点击“安装”。
步骤3:依次点击“OK”-"接受",然后等待程序完成安装。
二、代码示例
转换时,只需要通过两行代码实现,即:
using Spire.Pdf.Conversion;
namespace OFDtoPDF
{
class Program
{
static void Main(string[] args)
{
//加载OFD文档
OfdConverter converter = new OfdConverter("test.ofd");
//转为PDF格式保存
converter.ToPdf("ToPDF.pdf");
}
}
}
namespace OFDtoPDF
{
class Program
{
static void Main(string[] args)
{
//加载OFD文档
OfdConverter converter = new OfdConverter("test.ofd");
//转为PDF格式保存
converter.ToPdf("ToPDF.pdf");
}
}
}
VB.NET
Imports Spire.Pdf.Conversion
Namespace OFDtoPDF
Class Program
Private Shared Sub Main(args As String())
'加载OFD文档
Dim converter As New OfdConverter("test.ofd")
'转为PDF格式保存
converter.ToPdf("ToPDF.pdf")
End Sub
End Class
End Namespace
Namespace OFDtoPDF
Class Program
Private Shared Sub Main(args As String())
'加载OFD文档
Dim converter As New OfdConverter("test.ofd")
'转为PDF格式保存
converter.ToPdf("ToPDF.pdf")
End Sub
End Class
End Namespace
转换效果:
—END—
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK