How to convert massively from pdf to pdf/a

when processing several pdf I get this exception “Exception in thread “main” java.lang.OutOfMemoryError: Java heap space”
//this is the code I am using

for (String archivo : carpeta.list()) {
Document pdfDocument = new Document(_dir + “/” + archivo);
// convertir a pdf/a
pdfDocument.convert(_dir + “/log.xml”, PdfFormat.PDF_A_1A,ConvertErrorAction.Delete);
nombrearchivo = pdfDocument.getFileName();
pdfDocument.save(“src/out-pdf/” + nombrearchivo);
pdfDocument.close();
}

@emeza

Can you please share your sample PDF file for our references so that we can test the scenario in our environment and address it accordingly.

I’m sorry, but my pdf is confidential, is there another way to address the problem?

@emeza

We do not share your files with anyone and erase them from our system once the issue investigated and resolved. You can send your file in a private message as shown in the image so that we can try to replicate the issue in our environment and address it accordingly. image.png (10.1 KB)

Thank you very much for your attention, after investigating a bit more about it I was able to solve the problem, simply adding an argument to the class to increase jvm memory --> -Xms8g

@emeza

It is nice to know that your issue has been resolved. Please keep using our API and feel free to let us know in case you need any kind of assistance by creating a new topic.