Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

How to render PDF from Local File System

Avatar

Former Community Member
Hi,

Our code to render PDF form is as follows

____________________________________________________________________________________________________________________________________

Properties connectionProps = new Properties();

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "http:\\end point url");

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "WebSphere");

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "admin");

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");



ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);

FormsServiceClient formsClient = new FormsServiceClient(myFactory);



String formName = "/ManualGEAC.pdf";

byte[] cData = "".getBytes();



Document oInputData = new Document(cData);

PDFFormRenderSpec pdfFormRenderSpec = new PDFFormRenderSpec();

pdfFormRenderSpec.setCacheEnabled(new Boolean(true));

URLSpec uriValues = new URLSpec();



uriValues.setContentRootURI("http://10.145.86.201:9080/PANBaseApp/forms");



FormsResult formOut = formsClient.renderPDFForm(

formName, //formQuery

oInputData, //inDataDoc

pdfFormRenderSpec, //PDFFormRenderSpec

uriValues, //urlSpec

null //attachments



Document myData = formOut.getOutputContent();

_____________________________________________________________________________________________



In the above snippet the setting of ContentRootUrl is not working. At the given line :

_____________________________________________________________________________________________

uriValues.setContentRootURI("http://10.145.86.201:9080/PANBaseApp/forms");

_____________________________________________________________________________________________



Can anybody help me to set the content root url as the local file path of the Pdf form.



Thanks,

Saravanan
1 Reply

Avatar

Level 10
You can put file:///c:/myfolder/forms



Jasmin