Knowledgebase (2345)
Children categories
PDF linearization, also known as "Fast Web View", is a way of optimizing PDF files. Ordinarily, users can view a multipage PDF file online only when their web browsers have downloaded all pages from the server. However, if the PDF file is linearized, the browsers can display the first page very quickly even if the full download has not been completed. This article will demonstrate how to convert a PDF to linearized in C# and VB.NET using Spire.PDF for .NET.
Install Spire.PDF for .NET
To begin with, you need to add the DLL files included in the Spire.PDF for.NET package as references in your .NET project. The DLLs files can be either downloaded from this link or installed via NuGet.
- Package Manager
PM> Install-Package Spire.PDF
Convert PDF to Linearized
The following are the steps to convert a PDF file to linearized:
- Load a PDF file using PdfToLinearizedPdfConverter class.
- Convert the file to linearized using PdfToLinearizedPdfConverter.ToLinearizedPdf() method.
- C#
- VB.NET
using Spire.Pdf.Conversion;
namespace ConvertPdfToLinearized
{
class Program
{
static void Main(string[] args)
{
//Load a PDF file
PdfToLinearizedPdfConverter converter = new PdfToLinearizedPdfConverter("Sample.pdf");
//Convert the file to a linearized PDF
converter.ToLinearizedPdf("Linearized.pdf");
}
}
}
Imports Spire.Pdf.Conversion
Namespace ConvertPdfToLinearized
Friend Class Program
Private Shared Sub Main(ByVal args As String())
'Load a PDF file
Dim converter As PdfToLinearizedPdfConverter = New PdfToLinearizedPdfConverter("Sample.pdf")
'Convert the file to a linearized PDF
converter.ToLinearizedPdf("Linearized.pdf")
End Sub
End Class
End Namespace
Open the result file in Adobe Acrobat and take a look at the document properties, you can see the value of “Fast Web View” is Yes which means the file is linearized.

Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.
Spire.XLS for Java offers the Workbook.addDigitalSignature() method and the Workbook.removeAllDigitalSignatures() method to add and remove the Excel digital signatures. This article will show you how to detect if an Excel document has been signed or not, and retrieve information about digital signatures in Java applications.
Install Spire.XLS for Java
First of all, you're required to add the Spire.Xls.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. If you use Maven, you can easily import the JAR file in your application by adding the following code to your project's pom.xml file.
<repositories>
<repository>
<id>com.e-iceblue</id>
<name>e-iceblue</name>
<url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>e-iceblue</groupId>
<artifactId>spire.xls</artifactId>
<version>16.6.5</version>
</dependency>
</dependencies>
Detect if an Excel is Digitally Signed or Not
Spire.XLS for Java offers the Workbook.isDigitallySigned() method to check whether an Excel document is digitally signed or not.
- Create a Workbook instance and load a sample Excel document using Workbook.loadFromFile() method.
- Determine if the workbook is digitally signed by Workbook.isDigitallySigned() method.
- Print out the results.
- Java
import com.spire.xls.*;
public class Test {
public static void main(String[] args) throws Exception {
//Create a Workbook instance
Workbook workbook = new Workbook();
//Load an Excel document
workbook.loadFromFile("Sample.xlsx");
//Detect if an Excel Document is digitally signed or not
Boolean signature = workbook.isDigitallySigned();
//Print the results
if (signature) {
System.out.println("Document has been signed");
}
else
{
System.out.println("Document has not been signed");
}
}
}

Get the Digital Signature Details in Excel
The following are the steps to get the details of the digital signatures in an Excel document.
- Create a Workbook instance and load a sample Excel document using Workbook.loadFromFile() method.
- Get the collection of digital signatures using Workbook.getDigitalSignatures() method.
- Get the details of a specific digital signature using the methods under IDigitalSignature object.
- Java
import com.spire.xls.*;
import com.spire.xls.core.interfaces.IDigitalSignature;
import com.spire.xls.core.interfaces.IDigitalSignatures;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
import java.util.Date;
public class Test {
public static void main(String[] args) throws Exception {
//Create a Workbook instance
Workbook workbook = new Workbook();
//Load an Excel document
workbook.loadFromFile("Sample01.xlsx");
//Get the collection of digital signatures
IDigitalSignatures signatures = workbook.getDigitalSignatures();
//Get the details of digital signatures
for (IDigitalSignature digitalSignature : (Iterable) signatures) {
X509Certificate info = digitalSignature.getX509Certificate();
PrivateKey privateKey = digitalSignature.getPrivateKey();
String comment = digitalSignature.getComments();
Date date = digitalSignature.getSignTime();
//Print out the results of the Excel digital signature
System.out.println("Signatature Certificate:" + info + "\n" +
"Signature Comment:" + comment + "\n" +
"Sign Date:" + date + "\n" +
"PrivateKey:" + privateKey + "\n");
}
}
}

Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.
HTML files are Hypertext Markup Language files designed for displaying information in web browsers. In some cases, you might need to convert your Excel document to HTML in order to view it on the web. This article will demonstrate how to achieve this task programmatically in Java using Spire.XLS for Java.
Install Spire.XLS for Java
First of all, you're required to add the Spire.Xls.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. If you use Maven, you can easily import the JAR file in your application by adding the following code to your project's pom.xml file.
<repositories>
<repository>
<id>com.e-iceblue</id>
<name>e-iceblue</name>
<url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>e-iceblue</groupId>
<artifactId>spire.xls</artifactId>
<version>16.6.5</version>
</dependency>
</dependencies>
Convert Excel to HTML
The following are the steps to convert an Excel file to HTML:
- Create a Workbook instance.
- Load an Excel file using Workbook.loadFromFile() method.
- Save the file to HTML using Workbook.saveToFile() method.
- Java
import com.spire.xls.FileFormat;
import com.spire.xls.Workbook;
public class ConvertExcelToHTML {
public static void main(String []args){
//Create a Workbook instance
Workbook workbook = new Workbook();
//Load an Excel file
workbook.loadFromFile("Sample1.xlsx");
//Save the file to HTML
workbook.saveToFile("ToHtml.html", FileFormat.HTML);
}
}

Convert Excel to HTML with Image Embedded
The following are the steps to convert an Excel worksheet to HTML with image embedded:
- Create a Workbook instance.
- Load an Excel file using Workbook.loadFromFile() method.
- Get the first worksheet using Workbook.getWorksheets().get() method.
- Create a HTMLOptions instance and enable image embedding using HTMLOptions.setImageEmbedded() method.
- Save the worksheet to HTML with image embedded using Worksheet.saveToHtml(String, HTMLOptions) method.
- Java
import com.spire.xls.Workbook;
import com.spire.xls.Worksheet;
import com.spire.xls.core.spreadsheet.HTMLOptions;
public class ConvertExcelToHtmlWithImageEmbeded {
public static void main(String []args){
//Create a Workbook instance
Workbook workbook = new Workbook();
//Load an excel file
workbook.loadFromFile("Sample2.xlsx");
//Get the first worksheet
Worksheet sheet = workbook.getWorksheets().get(0);
//Set embedded image as true
HTMLOptions options = new HTMLOptions();
options.setImageEmbedded(true);
//Save the worksheet to HTML
sheet.saveToHtml("ToHtmlWithImageEmbeded.html", options);
}
}

Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.