LEADTOOLS Support
Document
Document SDK Examples
HOW TO: Use LEADTOOLS Java to Rotate a Tiff Page
#1
Posted
:
Thursday, July 25, 2019 3:27:55 PM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 89
Was thanked: 4 time(s) in 4 post(s)
Like with all LEADTOOLS applications you will first need to provide a valid License and Key file that needs to be passed through the
RasterSupport.setLicense() method.
Below is a simple Rotate command that can be implemented with the LEADTOOLS SDK in Java
In some cases the rotation of a document page can work as a security method.
Code:import leadtools.*;
import leadtools.codecs.*;
import leadtools.imageprocessing.*;
public class simpleRotate {
public static void main(String[] args) {
try{
Platform.setLibPath("C:\\LEADTOOLS 20\\Bin\\CDLL\\x64");
Platform.loadLibrary(LTLibrary.LEADTOOLS);
Platform.loadLibrary(LTLibrary.DOCUMENT_WRITER);
//String licensePath = "C:\\LEADTOOLS 20\\Support\\Common\\License\\LEADTOOLS.LIC";
String licensePath = "ENTER FILE PATH TO LICENSE HERE";
String developerKey = "ENTER STRING FROM KEY HERE";
// Set your license
RasterSupport.setLicense(licensePath, developerKey);
if (RasterSupport.getKernelExpired()) {
System.out.println("License NOT Set Successfully");
} else {
System.out.println("License Set Successfully");
}
String fileName = "C:\\Users\\cthompson\\Desktop\\Leadtools.tif";
String outFileName = "C:\\Users\\cthompson\\Desktop\\AfterRotation_Tif_Test.tif";
RasterCodecs codecs = new RasterCodecs();
RasterImage image = codecs.load(fileName, 0, CodecsLoadByteOrder.BGR_OR_GRAY, 1, -1);
RotateCommand command = new RotateCommand();
command.setAngle(90 * 100);
command.run(image);
codecs.save(image, outFileName, RasterImageFormat.TIF, 0);
image.dispose();
codecs.dispose();
}catch (Exception ex) {
ex.printStackTrace();
}
}
}
Chris Thompson
Developer Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Document
Document SDK Examples
HOW TO: Use LEADTOOLS Java to Rotate a Tiff Page
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.