Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize the conversion between OFD format and PDF format in C #

Shulou Source: shulou.com Published: 2022-06-01 18:43:43 09月11日 Update

This article mainly explains "how to realize the conversion between OFD format and PDF format in C#". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to convert OFD format to PDF format in C#"!

OFD to PDF

The document in OFD format is a unique national standard format document in our country. In different scenarios, we can convert PDF to OFD or OFD to PDF by format conversion.

1. Follow these steps to introduce Spire.Pdf.dll

Step 1: open solution Explorer in Visual Studio-right-click "reference"-"manage NuGet packages".

Step 2: select Browse-enter the search content in the search box, select the search results, and click install.

Step 3: click "OK"-"accept", and then wait for the program to complete installation.

Alternatively, you can download Spire.PDF for .NET from the official website, extract it, and manually import the dll file in the BIN folder into the program.

two。 Code example

When you convert, you only need to do it in two lines of code, namely:

C#

Using Spire.Pdf.Conversion;namespace OFDtoPDF {class Program {static void Main (string [] args) {/ / load OFD document OfdConverter converter = new OfdConverter ("test.ofd"); / / convert to PDF format to save converter.ToPdf ("ToPDF.pdf");}

VB.NET

Imports Spire.Pdf.ConversionNamespace OFDtoPDF Class Program Private Shared Sub Main (args As String ()) 'load OFD document Dim converter As New OfdConverter ("test.ofd")' into PDF format to save converter.ToPdf ("ToPDF.pdf") End Sub End ClassEnd Namespace

Conversion result:

PDF to OFD

OFD, whose full name is Open Fixed-layout Document, is a national standard format of electronic documents that can be stored, read and edited. It belongs to an independent file format in China and has a reliable guarantee in security. In order to break through the limitation of foreign technology in our software and hardware field, more and more enterprises require to adopt domestic technical standards. For this reason, the following article shows how to convert PDF into an OFD document through C # and VB.NET code. Spire.PDF for .NET, a domestic class library tool, is also used to convert documents. In VS programs, you can directly search and install it through Nuget, or download the toolkit (version 7.8.8) locally, decompress it, and then manually add a reference to the Spire.Pdf.dll in the Bin folder to the VS program. The reference result is shown below:

Sample code

C#

Using Spire.Pdf;namespace PDFtoOFD {class Program {static void Main (string [] args) {PdfDocument pdf = new PdfDocument (); pdf.LoadFromFile ("test.pdf"); pdf.SaveToFile ("ToOFD.ofd", FileFormat.OFD);}

VB.NET

Imports Spire.PdfNamespace PDFtoOFD Class Program Private Shared Sub Main (args As String ()) Dim pdf As New PdfDocument () pdf.LoadFromFile ("test.pdf") pdf.SaveToFile ("ToOFD.ofd", FileFormat.OFD) End Sub End ClassEnd Namespace

Comparison of conversion effects:

At this point, I believe you have a deeper understanding of "how to realize the conversion between OFD format and PDF format in C#". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Formats documents codes files steps programs searches contents methods standards results can be adopted domestic national national standards tools manual technology folders Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple vpn Huawei MySQL NVidia