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

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

How to render PDF from Local File System

Avatar

Not applicable
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