I have created a pdf with a xdp file but, sometimes, this pdf is created wrong. When I show my pdf file in my browser i have this error message "The file does not begin with PDF". This only occurs when my xdp has a big size (775 Kb or more). Have xdp files any restriction in its size? How can be the problem with that error? My java code is:
Properties connectionProps = new Properties();
connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "jnp://myip:1099");
connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_EJB_PROTOCOL);
connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "Administrator");
connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");
//Create a ServiceClientFactory object
ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);
//
//1. CONSTRUCCION DE PARAMETROS
//
//Nombre del XDP
String sNom = "solicitud2.xdp";
//Ruta del formulario
String sRoot = "/opt/adobe/livecycle8.2/LiveCycle_ES_SDK/plantillas";
//Construyo el path de la aplicacion, para que el form server sepa volver
String appPath = request.getServletPath();
//appPath = appPath.substring(0, appPath.lastIndexOf("/"));
String sURL = request.getScheme() + "://" +
request.getServerName() + ":" +
request.getServerPort() +
request.getContextPath() +
appPath;
//Configuro las opciones
String m_sOptions = "RenderAtClient=true&CacheEnabled=false";
//Specify URI values that are required to render a form
URLSpec uriValues = new URLSpec();
uriValues.setApplicationWebRoot(sURL);
uriValues.setContentRootURI(sRoot);
uriValues.setTargetURL(sURL);
//
//2. CONSTRUCCION DEL XML PARA LA PRECARGA
//
//Cojo el XML para la preCarga del formulario
byte[] mData = "".getBytes();
Document oInputData = new Document(mData);
//String sRutaXML = mRootForms + "/" + mXMLData;
//mData = readFile(sRutaXML);
//
//3. CONSTRUCCION DEL FORM
//
//Instancio el FormServer mediante la API
//Create a FormsServiceClient object
FormsServiceClient ifs = new FormsServiceClient(myFactory);
//LLamo al metodo que conastruye el formulario
FormsResult mIOC = ifs.renderPDFForm(
sNom,
oInputData,
null,
uriValues,
null
);
//
//4. MOSTRAR EL FORM
//
//Construyo la salida y la muestro por pantalla
Document cContent = mIOC.getOutputContent();
response.setContentType(cContent.getContentType());
//Create a ServletOutputStream object
ServletOutputStream oOutput = response.getOutputStream();
//FileOutputStream fos = new FileOutputStream(new File("C:\\prueba.pdf"));
//Create an InputStream object
InputStream inputStream = cContent.getInputStream();
//Get the size of the InputStream object
int size = inputStream.available();
//Create and populate a byte array
byte[] data = new byte[size];
inputStream.read(data);
//Write the data stream to the web browser
oOutput.write(data);
//fos.write(data);
Thanks in advance