原文:https://www.cnblogs.com/baby123/p/11046704.html
前一段时间使用aspose.slides for java,处理了下才去除的水印,但是时间一久就忘记了,重新整理了下
下载aspose-slides-19.3-jdk16.jar,重命名为aspose.slides-19.3.jar(为了在maven应用才改名的)
(1)使用jd-gui查看jar包
注册文件的加载类License
package com.aspose.slides;
import com.aspose.slides.exceptions.InvalidOperationException;
import com.aspose.slides.internal.k5.return;
import com.aspose.slides.ms.System.IDisposable;
import com.aspose.slides.ms.System.p;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
public class License
implements ILicense
{
public void setLicense(InputStream stream)
throws AsposeLicenseException
{
try
{
ByteArrayInputStream localByteArrayInputStream = null;
if (stream != null)
{
localObject = new ByteArrayOutputStream();
byte[] arrayOfByte = new byte[1024];
int i;
while ((i = stream.read(arrayOfByte)) > 0)
((ByteArrayOutputStream)localObject).write(arrayOfByte, 0, i);
((ByteArrayOutputStream)localObject).flush();
localByteArrayInputStream = new ByteArrayInputStream(((ByteArrayOutputStream)localObject).toByteArray());
}
Object localObject = new return();
((return)localObject).jdMethod_do(localByteArrayInputStream);
}
catch (IOException localIOException1)
{
throw new InvalidOperationException("License stream is not available for reading");
}
}
public void setLicense(String namePath)
throws AsposeLicenseException
{
try
{
FileInputStream localFileInputStream = null;
if ((null != namePath) && (!"".equals(namePath)))
localFileInputStream = new FileInputStream(namePath);
setLicense(localFileInputStream);
}
catch (FileNotFoundException localFileNotFoundException1)
{
throw new InvalidOperationException("License stream is not available for reading");
}
}
public static String getVersion()
{
return return.jdMethod_new();
}
public void resetLicense()
{
return.jdMethod_for();
}
public boolean isLicensed()
{
int i = 0;
Presentation localPresentation = new Presentation();
try
{
ISlide localISlide = localPresentation.getSlides().addEmptySlide(localPresentation.getLayoutSlides().getByType(11));
IAutoShape localIAutoShape = localISlide.getShapes().addAutoShape(5, 10.0F, 10.0F, 200.0F, 100.0F);
localIAutoShape.getTextFrame().setText(p.jdMethod_if("", 500, 'a'));
i = localIAutoShape.getTextFrame().getText().length() == 500 ? 1 : 0;
}
finally
{
if (localPresentation != null)
localPresentation.dispose();
}
return i;
}
}