#1
Posted
:
Thursday, July 25, 2019 3:41:37 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.
In the example provided below we utilize the Leadtools.pdf.jar file to
rotate a page using the rotation property in our PDF Document Page Class.
Code:import leadtools.*;
import leadtools.pdf.*;
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.CODECS);
Platform.loadLibrary(LTLibrary.DOCUMENT);;
Platform.loadLibrary(LTLibrary.DOCUMENT_CONVERTER);
Platform.loadLibrary(LTLibrary.PDF);
//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 pdfFileName = "C:\\Users\\cthompson\\Desktop\\Leadtools.pdf";
String outFileName = "C:\\Users\\cthompson\\Desktop\\Leadtools_test.pdf";
PDFDocument document = new PDFDocument(pdfFileName);
PDFFile file = new PDFFile(pdfFileName);
int[] rotateAngle = {90, 180, 270};
file.rotatepages(rotateAngle, 1, 1, outFileName);
document.dispose();
}catch (Exception ex) {
ex.printStackTrace();
}
}
}
Chris Thompson
Developer Support Engineer
LEAD Technologies, Inc.
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.