Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to convert PDF into linearized PDF in C #

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report