We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Generate PDF files in Java using Aspose.PDF - Errors sometimes occur when generating pdf

I conducted a pdf generation test. I have confirmed that the pdf generation was successful.
If the error below occurs, the pdf is not generated from that time, and the server has to be restarted to ensure normal pdf generation.

test dev environment
jdk : 1.8 (open jdk)
spring : 4.2.3
tomcat : 8.0

error :
class com.aspose.pdf.internal.ms.System.lk: Value cannot be null.
Parameter name: path1
com.aspose.pdf.internal.ms.System.IO.l1y.lf(Unknown Source)
com.aspose.pdf.FontRepository.lI(Unknown Source)
com.aspose.pdf.FontRepository.getLocalFontPaths(Unknown Source)
com.aspose.pdf.internal.l4k.l0v.l0l(Unknown Source)
com.aspose.pdf.internal.l4k.l0v.lc(Unknown Source)
com.aspose.pdf.internal.l4k.l0v.lv(Unknown Source)
com.aspose.pdf.internal.l4k.l0v.lI(Unknown Source)
com.aspose.pdf.internal.l4k.l0v$2.lI(Unknown Source)
com.aspose.pdf.internal.l4k.l0v$2.lI(Unknown Source)
com.aspose.pdf.internal.l4k.l0v$2.lf(Unknown Source)
com.aspose.pdf.internal.l13p.lI$1.lI(Unknown Source)
com.aspose.pdf.internal.l13p.lt.lj(Unknown Source)
com.aspose.pdf.internal.l13p.lI.lb(Unknown Source)
com.aspose.pdf.internal.l4k.l0v.lj(Unknown Source)
com.aspose.pdf.FontRepository.findFont(Unknown Source)
com.aspose.pdf.TextStamp.getDefaultFont(Unknown Source)
com.aspose.pdf.TextStamp.(Unknown Source)
smartsuite.app.bp.edoc.pdfmaker.signStrategy.PdfUtil.makeHeaderStamp(PdfUtil.java:117)
smartsuite.app.bp.edoc.pdfmaker.signStrategy.PdfUtil.setWatermark(PdfUtil.java:58)
smartsuite.app.bp.edoc.pdfmaker.signStrategy.PdfSignStrategy.signPdf(PdfSignStrategy.java:66)
smartsuite.app.bp.edoc.pdfmaker.PdfMaker.signPdf(PdfMaker.java:48)
smartsuite.app.bp.edoc.pdfmaker.HtmlToPdfMaker.signPdf(HtmlToPdfMaker.java)
smartsuite.app.bp.edoc.contract.PdfMakerService.generatePdfUsingHtml(PdfMakerService.java:59)
smartsuite.app.sp.edoc.contract.SpContractService.generateCntrPdf(SpContractService.java:1005)
smartsuite.app.sp.edoc.contract.SpContractService.findSignContractInfo(SpContractService.java:286)
smartsuite.app.sp.edoc.contract.SpContractService$$FastClassBySpringCGLIB$$e431b6a0.invoke()
org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:718)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:654)
smartsuite.app.sp.edoc.contract.SpContractService$$EnhancerBySpringCGLIB$$e1cf0da2.findSignContractInfo()
smartsuite.app.sp.edoc.contract.SpContractController.openCertSelectionPage(SpContractController.java:124)
smartsuite.app.sp.edoc.contract.SpContractController$$FastClassBySpringCGLIB$$c200e7d1.invoke()
org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)

I think there is an error here.

public TextStamp setTextStamp(TextStamp stamp, int horizontalAlignment, int verticalAlignment){
if(verticalAlignment == VerticalAlignment.Bottom){
stamp.setBottomMargin(10); // footer
}else{
stamp.setTopMargin(10); // header
}
stamp.setLeftMargin(15);
stamp.setHorizontalAlignment(horizontalAlignment);
stamp.setVerticalAlignment(verticalAlignment);

	stamp.getTextState().setFont(new FontRepository().findFont("gulim", true));
	stamp.getTextState().setFontSize(10);
	stamp.getTextState().setFontStyle(FontStyles.Bold);
	return stamp;
}

@emrods

Would you please also share the sample source PDF file with which the error is reproducible? We will test the scenario in our environment and address it accordingly.