on 02-19-2014 12:12 PM
Hi All,
We have two requirements :-
For the print button functionality, we have written a script, but we are not able to get the network printers and thus tthe code is dumping.
Script is :-
import com.sap.custom.clmprinter;
import javax.print.*;
import javax.print.attribute.*;
//printer = new clmprinter();
ver = doc.getDocVersions();
if(hasValue(ver))
{
iter = ver.iterator();
while(iter.hasNext())
{
member = iter.next();
document = member.getDoc();
}
}
DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
services = PrintServiceLookup.lookupPrintServices(flavor, aset);
if (services[0] != null)
{
DocPrintJob job = null;
String printer = "Printer Name";
for(int i = 0; i < services.length;i++)
{
if(services[i].getName().equalsIgnoreCase(printer))
{
job = services[i].createPrintJob(); // here we are not getting the printers on network
}
}
if(job == null)
{
job = services[0].createPrintJob();
}
InputStream b = new BufferedInputStream(new FileInputStream(document.getFileData((SessionContextIfc) session)));
Doc document = new SimpleDoc(b, flavor, null);
job.print(document, aset);
}
Is there any configurations whichneeds to be done to get the printers or any other thing missed in the coding that should be taken care.
Also any suggestions on the 1st requirement?
Regards,
Puneet Arora
Puneet,
To answer your 2 questions:
If your document is "fully" approved, meaning being in the executed phase your document should be locked except for some fields like signed document. Why would you lock the document versions, you cannot change them without creating a new version.
As this is a web based application in a browser you cannot initiate a print on the document with scripting, this is also security related (like you cannot write files on your local disk). The only way I can imagine you could do it is creating a JAR and deploying it on your server which contains these functionalities and network sharing.
Erik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.