Knowledgebase (2300)
This article demonstrates the steps to use Spire.OCR for .NET in .NET Core applications.
Step 1: Create a .NET Core project in Visual Studio.

Step 2: Add reference to Spire.OCR for .NET DLLs in your project.
You can add reference to Spire.OCR for .NET DLLs through one of the following two ways:
1. Install Spire.OCR for .NET through NuGet using NuGet Package Manager (recommended):
- In Solution Explorer, right-click the project or "Dependencies" and select "Manage NuGet Packages".
- Click "Browse" tab and search Spire.OCR.
- Install Spire.OCR.

2. Manually add reference to Spire.OCR for .NET DLLs.
- Download Spire.OCR for .NET package from the following link, unzip it, you will get the DLLs from the "netstandard2.0" folder.
- Right-click the project or "Dependencies" – select "Add Reference" – click "Browse" – select all DLLs under "netstandard2.0" folder – click "Add".
- Install the other two packages: SkiaSharp and System.Text.Encoding.CodePages in your project via the NuGet Package Manager.


Right-click the project or "Dependencies" – select "Manage NuGet Packages" – click "Browse" – type the package name – select the package from the search results – click "Install".

Step 3: Copy dependency DLLs to running directory of your project.
If you install Spire.OCR from NuGet and your project's target framework is .NET Core 3.0 or above, please build the project, then copy the 6 DLLs from bin\Debug\netcoreapp3.0\runtimes\win-x64\native folder to the running directory such as bin\Debug\netcoreapp3.0 or C:\Windows\System32 .

If your project's target framework is below .NET Core 3.0 or you download Spire.OCR from our website, please copy the 6 DLLs from Spire.OCR\Spire.OCR_Dependency\x64 folder to the running directory such as bin\Debug\netcoreapp2.1 or C:\Windows\System32.

Step 4: Now you have successfully included Spire.OCR in your project. You can refer the following code example to scan images using Spire.OCR.
- C#
using Spire.OCR;
using System.IO;
namespace SpireOCR
{
class Program
{
static void Main(string[] args)
{
OcrScanner scanner = new OcrScanner();
scanner.Scan("image.png");
File.WriteAllText("output.txt", scanner.Text.ToString());
}
}
}
PowerPoint to HTML conversion opens up opportunities for wider accessibility and enhanced interactivity. By transforming your presentations into HTML format, you can effortlessly distribute them across various platforms and devices. Whether you aim to share slides online or integrate them seamlessly within a web page, converting PowerPoint to HTML provides a flexible and versatile solution. In this article, we will explore how to convert PowerPoint files to HTML in Java using Spire.Presentation for Java.
- Convert a PowerPoint Presentation to HTML in Java
- Convert a Specific PowerPoint Slide to HTML in Java
Install Spire.Presentation for Java
First, you're required to add the Spire.Presentation.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.presentation</artifactId>
<version>10.11.4</version>
</dependency>
</dependencies>
Convert a PowerPoint Presentation to HTML in Java
With Spire.Presentation for Java, you can convert PowerPoint files to HTML format in just three steps. The detailed steps are as follows:
- Initialize an instance of the Presentation class.
- Load a sample PowerPoint document using Presentation.loadFromFile() method.
- Save the PowerPoint presentation as HTML using Presentation.saveToFile() method.
- Java
import com.spire.presentation.FileFormat;
import com.spire.presentation.Presentation;
public class ToHtml {
public static void main(String[] args) throws Exception {
//Create a Presentation object
Presentation presentation = new Presentation();
//Load the sample document presentation.loadFromFile("C:\\Users\\Administrator\\Desktop\\sample.pptx");
//Save the document to HTML format presentation.saveToFile("C:\\Users\\Administrator\\Desktop\\ToHtml.html", FileFormat.HTML);
presentation.dispose();
}
}

Convert a Specific PowerPoint Slide to HTML in Java
Sometimes, it may be necessary to convert a single slide rather than the entire presentation to HTML. In such cases, Spire.Presentation for Java provides the ISlide.saveToFile() method for converting a PowerPoint slide to HTML format. The following are the detailed steps:
- Initialize an instance of the Presentation class.
- Load a sample PowerPoint document using Presentation.loadFromFile() method.
- Get the specific slide using Presentation.getSlides().get() method.
- Save the PowerPoint slide to HTML using ISlide.saveToFile() method.
- Java
import com.spire.presentation.FileFormat;
import com.spire.presentation.Presentation;
import com.spire.presentation.ISlide;
public class ConvertSpecificSlideToHtml { public static void main(String[] args) throws Exception {
// Create a Presentation object
Presentation presentation = new Presentation();
// Load the sample document presentation.loadFromFile("C:\\Users\\Administrator\\Desktop\\sample.pptx");
// Get the specific slide by index (e.g., index 0 for the second slide)
ISlide slide = presentation.getSlides().get(1);
// Save the specific slide to HTML format slide.saveToFile("C:\\Users\\Administrator\\Desktop\\SpecificSlideToHtml.html", FileFormat.HTML);
slide.dispose();
}
}

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.
A digital signature is a specific type of signature that is backed by a digital certificate, providing proof of your identity. Digital signatures are used to protect documents in a wide range of fields such as life insurance, invoices, rental agreements, and employment contracts and so on. This article will show you how to digitally sign a Word document in Java using Spire.Doc for Java.
Install Spire.Doc for Java
First, you're required to add the Spire.Doc.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.doc</artifactId>
<version>13.11.2</version>
</dependency>
</dependencies>
Add a Digital Signature to a Word Document in Java
The follows are the steps to digitally sign a Word document using Spire.Doc for Java.
- Create a Document object.
- Load a Word document using Document.loadFromFile() method.
- Specify the path and the password of a PFX certificate.
- Digitally sign the document while saving the document using Document.saveToFile(string fileName, FileFormat fileFormat, string certificatePath, string securePassword) method. There are some other methods that you can use to digitally sign a Word document.
- public void saveToFile(string fileName, FileFormat fileFormat, byte[] certificateData, string securePassword);
- public void saveToStream(Stream stream, FileFormat fileFormat, byte[] certificateData, string securePassword);
- public void saveToStream(Stream stream, FileFormat fileFormat, string certificatePath, string securePassword);
- public static byte[] Document.sign(Stream sourceStream, byte[] certificateData, string securePassword);
- public static byte[] Document.sign(Stream sourceStream, string certificatePath, string securePassword);
- Java
import com.spire.doc.Document;
import com.spire.doc.FileFormat;
public class DigitallySignWordDocument {
public static void main(String[] args) {
//Create a Document object
Document doc = new Document();
//Load a Word file
doc.loadFromFile("C:\\Users\\Administrator\\Desktop\\sample.docx");
//Specify the certificate path
String certificatePath = "C:\\Users\\Administrator\\Desktop\\certificate.pfx";
//Specify the password of the certificate
String password = "e-iceblue";
//Digitally sign the document while saving it to a .docx file
doc.saveToFile("AddDigitalSignature.docx", FileFormat.Docx_2013, certificatePath, password);
}
}

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.