I have a list of RTF files downloaded from the server.
I want to print all these .rtf files at a single click without any print dialogues or only one.
Please suggest how do i do it.
I am using Aspose to print rtf files.
Please find the attached below code for the same.
import java.io.File;
import javax.print.attribute.AttributeSet;
import com.aspose.words.Document;
public class DocumentPrinter {
public static void main(String ar[]) throws Exception{
File folder = new File("D:\\projects\\emrs3\\PMS\\Claim\\PaperRTF");
File[] listOfFiles = folder.listFiles();
int j =3 ;
for (int i = 0; i <j ; i++) {
if (listOfFiles[i].isFile()) {
//System.out.println("File " + listOfFiles[i].getName());
Document doc = new Document(listOfFiles[i].getAbsolutePath());
doc.print();
} else if (listOfFiles[i].isDirectory()) {
System.out.println("Directory " + listOfFiles[i].getName());
}
}
}
}
Problem attached with the above code is it's always asking for a print dialogue as I have put doc.print();
it in a for loop.
Is there any way I can make a list of Document
and print them all at a time.
Thanks.