I am creating a class to create a PDF through XML. All this I need to do with Aspose.pdf. I have imported the necessary libraries and included in the pom.xml the repository and the corresponding dependency.
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-pdf</artifactId>
<version>2.9.0</version>
</dependency>
<repositories>
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>http://artifact.aspose.com/repo/</url>
</repository>
</repositories>
I import aspose.pdf. * and it gives it to me as valid, no failure. When I create an object of the Pdf class (class of aspose.pdf. *) It does not give me any errors either, and it is until I try to do maven install when it says:
javax.transaction.TransactionRolledbackException: CORBA TRANSACTION_ROLLEDBACK 9998 Maybe; nested exception is:
org.omg.CORBA.TRANSACTION_ROLLEDBACK: vmcid: 0x2000 minor code: 1806 completed: Maybe
The class in which I'm trying to do is this, as you can see, a fairly simple method:
package com.telefonica.pleyade.proveedores.ejb.negocio;
import javax.ejb.Local;
import javax.ejb.LocalBean;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import com.t.pl.pr.c.ejb.s.n.IProcesaDocumentoBeanLocal;
import com.t.pl.pr.c.ejb.s.n.IProcesaDocumentoBeanRemote;
import com.t.pl.pr.c.ejb.s.n.IProcesaDocumentoServicio;
import com.t.pl.pr.m.au.ProveedorAuxiliar;
import aspose.pdf.*;
@Stateless
@LocalBean
@Local(IProcesaDocumentoBeanLocal.class)
@Remote(IProcesaDocumentoBeanRemote.class)
public class GenerarPDF implements IProcesaDocumentoServicio{
@Override
public byte[] crearCertificado(ProveedorAuxiliar idProveedor){
String dataDir = "C:/Users/Pc/Desktop/";
Pdf pdf = new Pdf();
pdf.bindXML(dataDir + "plantillaXML.xml", null);
//Para guardar el archivo se puede hacer con:
pdf.save(dataDir + idProveedor + ".pdf");
return pdf.getBuffer();
}
}