Free Support Forum - aspose.com

PDF to PDF A/3-b with attachment - standalone Java - Linux - JDK16 - ZUGFerD

We are getting below with temporary license…

java.lang.IllegalStateException: The license is not valid for this product. For free technical support, please post this error and the file in the Aspose.Pdf Forums http://www.aspose.com/community/forums/aspose.pdf-product-family/20/showforum.aspx
at com.aspose.pdf.z50.m1(Unknown Source)
at com.aspose.pdf.License.setLicense(Unknown Source)
at ConvertPDFToPDFAFormat.main(ConvertPDFToPDFAFormat.java:17)

we are using ASPORE PDF for JAVA 10.6.1

@nbopanna

We would like to share with you that please try to use latest available version of the API i.e. Aspose.PDF for Java 20.10. The older versions have a lot of discontinued Classes and Methods and we are not providing support against the issues in older versions if they do not exist in the latest one.

As per our suggestion and request, please try using 20.10 version of the API with a temporary license and let us know in case you still face any issues.

With JAR20.10 we are getting below error message while compiling

bad class file: /u01/oracle/devc/comn/java/com/aspose/pdf/ConvertErrorAction.cla ss
class file has wrong version 52.0, should be 50.0
Please remove or make sure it appears in the correct subdirectory of the classpa th.
import com.aspose.pdf.ConvertErrorAction;

We can’t upgrade our JAVA from 1.6 to 1.8 as we are running oracle on JAVA1.6 if we have to upgrade this affects entiry business community which we don’t want.

But your ASPOSE PDF for 12 or 10 Jar’s are compiling fine and like to test them they work in our environment.

So, pl provide license and suggest which version is best that works for JRE 1.6 with PDF to PDFA3/B conversation feature

@nbopanna

We have responded to you similar inquiry in other thread as well.

We would like to share with you that you can use Aspose.PDF with JDK 1.6 as well. Please try to download the file aspose-pdf-20.10-jdk16.jar and include it in your project targeting JDK 1.6. Please let us know in case you still face any issue.

Still getting below errors…

Exception in thread “main” java.lang.UnsupportedClassVersionError: com/aspose/pd f/internal/l29h/le : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14 1)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:304)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:218)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:211)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at com.aspose.pdf.FontRepository.lI(Unknown Source)
at com.aspose.pdf.FontRepository.lI(Unknown Source)
at com.aspose.pdf.FontRepository.getLocalFontPaths(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v.l0l(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v.lc(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v.lv(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v.lI(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v$2.lI(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v$2.lI(Unknown Source)
at com.aspose.pdf.internal.l13v.lI.lb(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v.lj(Unknown Source)
at com.aspose.pdf.ADocument.lj(Unknown Source)
at com.aspose.pdf.ADocument.preSave(Unknown Source)
at com.aspose.pdf.ADocument.lf(Unknown Source)
at com.aspose.pdf.ADocument.saveInternal(Unknown Source)
at com.aspose.pdf.Document.saveInternal(Unknown Source)
at com.aspose.pdf.ADocument.l1u(Unknown Source)
at com.aspose.pdf.ADocument.isLicensed(Unknown Source)
at ConvertPDFToPDFAFormat.main(ConvertPDFToPDFAFormat.java:19)

@nbopanna

Would you please share your environment details where you are trying to run the code snippet e.g. OS Name and Version. Also, please share a sample PDF document with us which is not being converted at your side. We will test the scenario in our environment and address it accordingly.

Hi Asad,

We are running on Linux with JAVA
java version “1.6.0_151”
Java™ SE Runtime Environment (build 1.6.0_151-b31)
Java HotSpot™ Client VM (build 20.151-b31, mixed mode, sharing)

Pl find attached PDF and Java program we are using…

35064981.pdf (35.2 KB)

//package oracle.apps.xxdomi.aspose;

import com.aspose.pdf.ConvertErrorAction;
import com.aspose.pdf.Document;
import com.aspose.pdf.FileSpecification;
import com.aspose.pdf.PdfFormat;
//import com.aspose.ms.System.*;

public class ConvertPDFToPDFAFormat {

public static void main(String[] args) {
	//pdfTopdfA1bConversion();
	//pdfTopdfA3bConversion();
	//pdfTopdfA3aConversion();
	//pdfTopdfA2aConversion();
	createPDFA3AndAttachXMLFile();
}

// public static void pdfTopdfA1bConversion() {
// String myDir = “pathToDir”;
// // Open document
// Document pdfDocument = new Document(myDir + “input.pdf”);
// // Convert to PDF/A compliant document
// pdfDocument.validate(“Validation_log.xml”, PdfFormat.PDF_A_1B);
// pdfDocument.convert(“Conversion_log.xml”, PdfFormat.PDF_A_1B, ConvertErrorAction.Delete);
// // Save updated document
// pdfDocument.save(myDir + “output.pdf”);
// }
//
// public static void pdfTopdfA3bConversion() {
// String myDir = “pathToDir”;
// // Open document
// Document doc = new Document(myDir + “input.pdf”);
// // Convert to PDF/A3 compliant document
// doc.convert(“file.log”, PdfFormat.PDF_A_3B, ConvertErrorAction.Delete);
// // Save resultant document
// doc.save(myDir + “output.pdf”);
// }
//
// public static void pdfTopdfA3aConversion() {
// String myDir = “pathToDir”;
// // Open document
// Document doc = new Document(myDir + “input.pdf”);
// // Convert to PDF/A3 compliant document
// doc.convert(“file.log”, PdfFormat.PDF_A_3A, ConvertErrorAction.Delete);
// // Save resultant document
// doc.save(myDir + “output.pdf”);
// }
//
// public static void pdfTopdfA2aConversion() {
// String myDir = “pathToDir”;
// // Open document
// Document doc = new Document(myDir + “input.pdf”);
// // Convert to PDF/A2_a compliant document
// doc.convert(“file.log”, PdfFormat.PDF_A_2A, ConvertErrorAction.Delete);
// // Save resultant document
// doc.save(myDir + “output.pdf”);
// }

public static void createPDFA3AndAttachXMLFile() {
	String myDir = "/u01/oracle/devc/comn/java/oracle/apps/xxdomi/aspose";
	// instantiate Document instance
	Document doc = new Document();
	// add page to PDF file
	doc.getPages().add();
	// load XML file
	FileSpecification fileSpecification = new FileSpecification(myDir + "attachment.xml", "Sample xml file");
	// Add attachment to document's attachment collection
	doc.getEmbeddedFiles().add(fileSpecification);
	// perform PDF/A_3a conversion
	doc.convert(myDir + "log.xml", PdfFormat./*PDF_A_3A or */PDF_A_3B , ConvertErrorAction.Delete);
	// save final PDF file
	doc.save(myDir + "35064981_PDFA_3A.pdf");
	
	//system.out.println("Hello World!");
}

}

Linux 2.6.39-300.26.1.el5uek i686

@nbopanna

We tested above code snippet in an Eclipse Project (JDK 1.6) and Linux (Ubuntu 15.04 x64). We did not notice any issue. For your kind reference, attached is a sample project. You can put JDK6 compatible Aspose.PDF JAR file in sample16 folder and set the path directory in code to test it. Please let us know if you still face any issue. Also, please make sure that microsoft essential fonts are installed in your system.

sample16.zip (3.9 KB)

Hi asad,

I don’t fine JDK1.6 jar file in sample.zip file
Could you check please

FYI,… with the java file you have given I am still having below error message

Exception in thread “main” java.lang.UnsupportedClassVersionError: com/aspose/pdf/internal/l29h/le : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:304)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:218)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:211)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at com.aspose.pdf.FontRepository.lI(Unknown Source)
at com.aspose.pdf.FontRepository.lI(Unknown Source)
at com.aspose.pdf.FontRepository.getLocalFontPaths(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v.l0l(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v.lc(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v.lv(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v.lI(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v$2.lI(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v$2.lI(Unknown Source)
at com.aspose.pdf.internal.l13v.lI.lb(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v.lj(Unknown Source)
at com.aspose.pdf.ADocument.lj(Unknown Source)
at com.aspose.pdf.ADocument.preSave(Unknown Source)
at com.aspose.pdf.ADocument.lf(Unknown Source)
at com.aspose.pdf.ADocument.lf(Unknown Source)
at com.aspose.pdf.ADocument.save(Unknown Source)
at com.aspose.pdf.Document.save(Unknown Source)
at AsposeTest.createPDFA3AndAttachXMLFile(AsposeTest.java:36)
at AsposeTest.Run(AsposeTest.java:20)
at AsposeTest.main(AsposeTest.java:13)

@nbopanna

You can download the JDK 1.6 compatible JAR from this link and place it in the folder as suggested in our previous response. Furthermore, the issue seems related to missing JAR file at your side. Would you please make sure to add the external JAR to Java Build Path correctly and try again. In case you still face any issue, please share the complete steps to replicate it at our side so that we can further proceed to assist you.

Hi Asad,

Thank you for your prompt support.

Now I am able to run AsposeTest and generated attached file with xml attachment.
But I have few questions …it is not converted original file completely I see blank PDF with attached xml that I can’t open. Is this because of Temporary license?? attachement.xml will be xml format of the PDF?? How can I see what is in atttachement.xml.

Atttched 3A_PDF and log file for your review.35064981_PDFA_3A.pdf (4.2 KB)
log.zip (519 Bytes)

pl find attahed MSFont that we have installed in Linux server where we are running. still error is coming. msfont.JPG (9.1 KB)

@nbopanna

It is good to know that things have started working at your side.

The blank PDF output is due to the fact that an empty PDF was being generated and converted to PDF/A in sample project shared by us. You can modify the code snippet and initialize Document with any existing PDF to convert like below:

Document doc = new Document("source.pdf");

Furthermore, the attachment.xml file can be any type of file either .xml or any other file format. In generated output PDF, you can double click the attachment and it will be opened in supported program installed in your system.

Would you please share what type of error is being experienced at the moment? We will further share our feedback with you accordingly.

Hi Asad,

As soon as I gave a file name in Document doc = new Document(“source.pdf”); I am getting below error messages again…

Exception in thread “main” java.lang.UnsupportedClassVersionError: com/aspose/pdf/internal/l29h/le : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:304)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:218)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:211)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at com.aspose.pdf.FontRepository.lI(Unknown Source)
at com.aspose.pdf.FontRepository.lI(Unknown Source)
at com.aspose.pdf.FontRepository.getLocalFontPaths(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v.l0l(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v.lc(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v.lv(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v.lI(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v$2.lI(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v$2.lI(Unknown Source)
at com.aspose.pdf.internal.l13v.lI.lb(Unknown Source)
at com.aspose.pdf.internal.l4y.l0v.lj(Unknown Source)
at com.aspose.pdf.internal.l4y.l1h.lv(Unknown Source)
at com.aspose.pdf.internal.l4y.l1h.l2if(Unknown Source)
at com.aspose.pdf.Font.lI(Unknown Source)
at com.aspose.pdf.Font.(Unknown Source)
at com.aspose.pdf.FontCollection.ld(Unknown Source)
at com.aspose.pdf.FontCollection.lI(Unknown Source)
at com.aspose.pdf.FontCollection.(Unknown Source)
at com.aspose.pdf.Resources.getFonts(Unknown Source)
at com.aspose.pdf.internal.l8k.ly.lI(Unknown Source)
at com.aspose.pdf.internal.l8k.ly.l0n(Unknown Source)
at com.aspose.pdf.internal.l8k.ly.lf(Unknown Source)
at com.aspose.pdf.internal.l8k.l0if.l0l(Unknown Source)
at com.aspose.pdf.internal.l8k.ly.lI(Unknown Source)
at com.aspose.pdf.ADocument.lI(Unknown Source)
at com.aspose.pdf.ADocument.convert(Unknown Source)
at com.aspose.pdf.Document.convert(Unknown Source)
at com.aspose.pdf.ADocument.convert(Unknown Source)
at com.aspose.pdf.Document.convert(Unknown Source)
at AsposeTest.createPDFA3AndAttachXMLFile(AsposeTest.java:34)
at AsposeTest.Run(AsposeTest.java:20)
at AsposeTest.main(AsposeTest.java:13)

Pl can we have a call to resolve this…we are approching deadline to provide this solution

@nbopanna

Please try to use same sample project which we have shared with you. We have again tested the scenario by using your sample file as a source and did not notice any issue. The sample code snippet was as following:

Document doc = new Document(dataDir + "35064981.pdf");
// add page to PDF file
//doc.getPages().add();
// load XML file
FileSpecification fileSpecification = new FileSpecification(dataDir + "attachment.xml", "Sample xml file");
// Add attachment to document's attachment collection
doc.getEmbeddedFiles().add(fileSpecification);
// perform PDF/A_3a conversion
doc.convert(dataDir + "log.xml", PdfFormat./*PDF_A_3A or */PDF_A_3B , ConvertErrorAction.Delete);
// save final PDF file
doc.save(dataDir + "35064981_PDFA_3A.pdf");

35064981_PDFA_3A.pdf (81.4 KB)

The issue you are facing, does not seem related to the API. It looks like related to your Java/JDK Version. Furthermore, we encourage providing support through our forums and request you post your inquiries here. We will try to assist you at our earliest with respective information.

Hi Asad,

No luck, still getting same error . I used the same sample project that you have shared. but I am using standalone Java no UI tools to create java file.

I am using aspose-pdf-20.10-jdk16. jar file.

If this is complied in JDK16 why error message is showing
Unsupported major.minor version 52.0

version 52 is not for JDK16 right why this error is coming
Exception in thread “main” java.lang.UnsupportedClassVersionError: com/aspose/pdf/internal/l29h/le : Unsupported major.minor version 52.0

am I using right ASPOSE PDF jar ??