Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, July 25, 2019 3:23:59 PM(UTC)
Christopher

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.

As well as reference the Library Path and the Platform.loadLibrary() for any libraries that need to be accessed

Code:
import leadtools.*;
import leadtools.codecs.*;

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);
	        
	        //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");
	        }
	    	
		}catch (Exception ex) {
			ex.printStackTrace();
		}


Once that has been done you can include the calls to reference the file that is being converted and saved out to another file format
The LEADTOOLS RasterCodecs.save() method is a very simple yet very powerful method as it will allow you to save out the file, but also simultaneously convert it to another file format.

Code:
try {
			
			String srcFileName = "C:\\Users\\cthompson\\Desktop\\Leadtools.pdf";
			String dstFileName = "C:\\Users\\cthompson\\Desktop\\Leadtools_test.tif";
			
			RasterCodecs codecs = new RasterCodecs();
			RasterImage image = codecs.load(srcFileName);
			
			codecs.save(image, dstFileName, RasterImageFormat.TIF, 0);
			
			codecs.dispose();
			image.dispose();
			
		}catch (Exception ex){
			ex.printStackTrace();
		}


Chris Thompson
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.072 seconds.