Get the App
SLTechnology News&Howtos  ›  Development  › 

How to convert PDF into linearized PDF in C #

Shulou Source: shulou.com Published: 2022-06-02 05:35:58 11月15日 Update

This article mainly introduces how C # turns PDF into linear PDF, which has a certain reference value. Interested friends can refer to it. I hope you can learn a lot after reading this article.

Linearized PDF files are a special format of PDF files that can be viewed more quickly through Internet. Linear PDF, in the case of a large number of pages, can highlight the advantage of fast browsing. The following is a way to convert PDF files into linearized PDF through a back-end .NET program.

Program environment

Visual Studio 2017

.NET Framework 4.6.1

Spire.PDF for .NET 7.12.1

Method step 1. Install the PDF plug-in.

Installation or referencing can be implemented in two ways:

Method 1: search for installation through NuGet. Open * * solution Explorer * * in Visual Studio, right-click * * reference * *, select * * manage NuGet package * *, and follow the steps shown in the figure to complete the installation in the open interface:

Or install it through the PM console:

Install-Package Spire.PDF-Version 7.12.1

Method 2: reference dll manually. Download Spire.PDF for .NET locally, extract it, locate the dll file in the BIN folder, and follow the steps shown in the figure to add a reference to the Visual Studio program:

Step 2. Edit the following code to implement the transformation.

C#

Using Spire.Pdf.Conversion;namespace ToLinearlizedPDF {class Program {static void Main (string [] args) {/ / load PDF document PdfToLinearizedPdfConverter converter = new PdfToLinearizedPdfConverter ("test.pdf"); / / convert to linear PDF converter.ToLinearizedPdf ("Linearized.pdf");}

VB.NET

Imports Spire.Pdf.ConversionNamespace ToLinearlizedPDF Class Program Private Shared Sub Main (args As String ()) 'load PDF document Dim converter As New PdfToLinearizedPdfConverter ("test.pdf")' to linear PDF converter.ToLinearizedPdf ("Linearized.pdf") System.Diagnostics.Process.Start ("Linearized.pdf") End Sub End ClassEnd Namespace

After executing the program, the generated documents are saved under the running path of the program, such as F:\ VS2017Project\ ToLinearlizedPDF\ bin\ Debug (the file path can be customized). Check whether PDF is linear PDF. After opening the PDF file, click "File"-"Properties" to view it, as shown in the figure:

Thank you for reading this article carefully. I hope the article "how to convert PDF into linear PDF" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Linearity file linearization method step program article document path such as figure Category reference management special code value advantage interest can be passed available in Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux MariaDB vpn MySQL Docker