Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

The file does not begin with PDF

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
1 Reply
I have discovered this error happens when cContent variable has this value:<br /><br /><document <br /> state="active" <br /> senderVersion="3" <br /> persistent="false" <br /> senderPersistent="false" <br /> passivated="false" <br /> senderPassivated="true" <br /> deserialized="true" <br /> senderHostId="172.26.121.76/127.0.0.1" <br /> callbackId="0" <br /> senderCallbackId="26" <br /> callbackRef="IOR:..." <br /> isLocalizable="false" <br /> isTransactionBound="false" <br /> defaultDisposalTimeout="600" <br /> disposalTimeout="600" <br /> maxInlineSize="65536" <br /> defaultMaxInlineSize="65536" <br /> inlineSize="0" <br /> contentType="application/pdf" length="-1"><br /> <cacheId/><br /> <localBackendId/><br /> <globalBackendId/><br /> <senderLocalBackendId><br /> <DocumentFileID fileName="C:\Documents and Settings\drico\Configuración local\Temp\AdobeDocumentStorage\local\docm1226574987456\h6en8qc4lqa0x7r0a8g3gypm300000oo"/><br /> <senderLocalBackendId/><br /> <senderGlobalBackendId/><br /> <inline/><br /> <senderPullServantJndiName><br /> adobe/idp/DocumentPullServant/adobejb_server1<br /> </senderPullServantJndiName><br /> <attributes <br /> wsfilename="/tmp/AdobeDocumentStorage/local/docm1226574987456/h6en8qc4lqa0x7r0a8g3gypm300000oo" <br /> basename="h6en8qc4lqa0x7r0a8g3gypm300000oo" <br /> file="/tmp/AdobeDocumentStorage/local/docm1226574987456/h6en8qc4lqa0x7r0a8g3gypm300000oo" <br /> ADOBE_SAVE_MODE_ATTRIBUTE="NO_CHANGE" ADOBE_SAVE_MODE_FORCE_COMPRESSED_OBJECTS_ATTRIBUTE="false" <br /> ADOBE_SAVE_MODE_REQUIRED_ATTRIBUTE="false"/><br /></document><br /><br />Ii have seen inlineSize parameter is 0, length in context type is -1 and inline parameter doesn't start with %PDF. Why does it happen? Any idea will be very appreciate.<br /><br />Thank you in advance