Split pdf file to individual pages get this error - value can not be null in java

hi dears,


i try pdf splitting in aspose java and occured this error

Caused by: class com.aspose.ms.System.g: Value cannot be null.
Parameter name: path1
com.aspose.ms.System.e.ae.bp(Unknown Source)
com.aspose.g.i.r.aNo(Unknown Source)
com.aspose.g.m.h.bfO(Unknown Source)
com.aspose.pdf.Document.(Unknown Source)


here’s my code

Document pdf = new Document(myDir + myFile);// error occure in this line…
for (int i = 1; i <= pdf.getPages().size(); i++) {
Document document = new Document();
document.getPages().add(pdf.getPages().get_Item(i));
document.save(myDir + outputName + “_” + i + “.pdf”);
}


pdf file is in attachment

thanks your suggests.

hi dears,


i try pdf splitting in aspose java and occured this error

Caused by: class com.aspose.ms.System.g: Value cannot be null.
Parameter name: path1
com.aspose.ms.System.e.ae.bp(Unknown Source)
com.aspose.g.i.r.aNo(Unknown Source)
com.aspose.g.m.h.bfO(Unknown Source)
com.aspose.pdf.Document.(Unknown Source)


here’s my code

Document pdf = new Document(myDir + myFile);// error occure in this line…
for (int i = 1; i <= pdf.getPages().size(); i++) {
Document document = new Document();
document.getPages().add(pdf.getPages().get_Item(i));
document.save(myDir + outputName + “_” + i + “.pdf”);
}


pdf file is in attachment

thanks your suggests.

Hi there,


Thanks for your inquiry. We have tested the scenario using Aspose.Pdf for Java 9.0.0 over Win 7 64 bit and unable to replicate the issue. Please confirm your environment settings, so we will try to replicate the issue and provide you more information accordingly.

Best Regards,

hi Ahmad,


thanks for reply. the problem can not be resolved. i use Win7 64 bit, aspose 9.0. run it in a web server and there is no any problems. It seems my enviro. i will try to find best enviroments for my ide.

thanks for all suggest, Best regards.

Hi there,


Thanks for your feedback. Please test the scenario at your environment and feel free to ask any question/concern. We will be more than happy to extend our support.

Moreover for your information, we have noticed above shared issue with some Linux/MAC users due to the font folder path setting. If you are using Non-Windows OS then please set font folder before any operation.

You can use following methods to get system folder of fonts or set font path to font folders. Hopefully it will help you to fix the issue.

Document.getLocalFontPath () - shows the system folder in which project will look for fonts.
Document.setLocalFontPath (String) - Setting font path to custom folder

//adding a new font path<o:p></o:p>

String path = “c:\fonts\”;<o:p></o:p>

com.aspose.pdf.Document.addLocalFontPath(path);<o:p></o:p>


Moreover please also check following code snippet to set font path if there are more than one font path.


//geting the list for standard font directories in different OS<o:p></o:p>

java.util.List list = com.aspose.pdf.Document.getLocalFontPaths();<o:p></o:p>

//seting the user list for standard font directories<o:p></o:p>

list.add(“c:\fonts2\”);<o:p></o:p>

list.add(“c:\fonts3\”);<o:p></o:p>

com.aspose.pdf.Document.setLocalFontPaths(list);<o:p></o:p>

//Restoring list for standard font directories by default.<o:p></o:p>

com.aspose.pdf.Document.restoreLocalFontPath();<o:p></o:p>

<o:p> </o:p>

<o:p>Please feel free to contact us for any further assistance.</o:p>

<o:p>
</o:p>

<o:p>Best Regards,</o:p>

hi Ahmad again,


i’m really sorry, i tried your suggestions but result didn’t change. also throw an exception in Document.addLocalFontPath(“D:\”); line.

in debug mode, i looked something. maybe it helps you
ae.bp(String, String) line: not available
r.aNo() line: not available
h.bfO() line: not available
Document.() line: not available

… bla bla… at the end of go to ExceptionInInitializerError(Throwable thrown) method…

i’m using windows7 64 bit, but when I try another computer which windows 8 64 bit, there is no any problem.

thanks for all support,
best regards.
Hi there,

cyber_deneme:
hi Ahmad again,

i'm really sorry, i tried your suggestions but result didn't change. also throw an exception in Document.addLocalFontPath("D:\\"); line.

in debug mode, i looked something. maybe it helps you
ae.bp(String, String) line: not available
r.aNo() line: not available
h.bfO() line: not available
Document.() line: not available

.... bla bla.. at the end of go to ExceptionInInitializerError(Throwable thrown) method..

I am sorry for the confusion. You only need to set font folder path in case of non-windows OS. It is not required in case of Windows.

cyber_deneme:
i'm using windows7 64 bit, but when I try another computer which windows 8 64 bit, there is no any problem.

Can you please confirm you are using JAR in evaluation mode or using some valid license for testing? If you are testing JAR without any license, then please make a request for a temporary 30 days license and apply it as described in the licensing link and share the result.

We are sorry for the inconvenience caused.

Best Regards,

hi Ahmed,


i’m using aspose-pdf-jdk14.jar and have a developer small business licence. i’m installing license, but i couldn’t understand why this exception throw.

thanks a lot for taking care of

best regards.

Hi there,


I am afraid I am still unable to replicate the issue, while testing the scenario using aspose-pdf-jdk14.jar of Aspose.Pdf for .NET 9.0.0, JDK 1.6, Eclipse JUNO 4.2.2 and Wind 7(64 bit). We will appreciate if you please share your environment details, so we will try to replicate the issue. It is quite difficult to suggest you anything wihtout replicating issue at our end.

We are sorry for the inconvenience caused.

Best Regards,

hi Ahmad,


here is my java class and other knowledge about system environment.
thanks a lot for your helps,

Yours Sincerely.

Hi there,


Thanks for sharing the details. We are looking into it and will update you with our findings soon.

Best Regards,

Hi there,


Thanks for your patience. We have tried to replicate the issue over a couple of machines and I am afraid we are unable to notice the issue. Can you please confirm your region and language setting of your system?

Moreover in recent past, we have noticed some issue if default Locale was other than English. To confirm the problem cause at your end, please test your code by changing Locale to English before instantiating Aspose.Pdf object as following and share the results.

Locale.setDefault(Locale.ENGLISH);


We are truly sorry for the inconvenience caused.

Best Regards,

Hi Ahmed,


thats great :slight_smile: my system language is Turkish, and i tried Locale.setDefault(Locale.ENGLISH); pdf splitted in 0 minute :slight_smile:

thanks for all support,

Best regards.

Hi there,


Thanks for your feedback. It is good to know that your issue has been resolved.

Please feel free to contact us for any further assistance, we will be more than happy to extend our support.

Best Regards,