I have array value that store pdf filename in jsp page print.jsp I want to merge the pdf before it can be print.
Here my code:
<%
try
{
String[] ids=request.getParameterValues("list");
for (String id:ids)
{
System.out.print(id);
}
//Runtime.getRuntime().exec("pdftk" +id+ "cat output output.pdf");
}
catch(Exception e)
{
System.out.println("fail");
}
%>
How do I write array value to fill up the pdftk command. Please help me.
I suppose this is what you need...
try {
String[] ids = request.getParameterValues("list");
StringBuilder sb = new StringBuilder();
for (String id : ids) {
sb.append(" "+id);
System.out.print(id);
}
Runtime.getRuntime().exec("pdftk" + sb.toString() + " cat output output.pdf");
} catch (Exception e) {
System.out.println("PDF fail to merge");
}