Hi,
I’ve been using the AsposeWordsPrintDocument class to print documents for a few days. There were some issues with formatting but these have mostly been resolved in the latest version. The one issue I have remaining is that if I try to print a document which has a page orientation of “landscape” then aspose prints it on a portrait page and clips the right hand side of the document off.
This can be seen by printing a document which is entirely formatted in landscape or by printing a document which has a section in landscape (the portrait secions are fine).
My Code for printing the test document is shown here:
import java.awt.print.PrinterJob;
import java.io.File;
import java.io.FileInputStream;
import javax.print.PrintService;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import com.aspose.words.AsposeWordsPrintDocument;
import com.aspose.words.Document;
import com.aspose.words.License;
/
*
*/
/
* @author cwarren
*
*/
public class TestAsposePrint {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
Document doc = new Document(“C:\test.doc”);
String printerName = “\\server\printer_1”;
PrinterJob pj = PrinterJob.getPrinterJob();
PrintService[] service = PrinterJob.lookupPrintServices();
for (PrintService printService : service) {
if(printService.getName().contains(printerName)){
pj.setPrintService(printService);
break;
}
}
// Create the Aspose.Words’ implementation of the Java Pageable interface.
AsposeWordsPrintDocument awPrintDoc = new AsposeWordsPrintDocument(doc);
// Pass the document to the printer.
pj.setPageable(awPrintDoc);
// Print the document with the user specified print settings.
pj.print();
}
}
My Test Document is attached, but you could test it with any document which has a landscape page orientation.
I downloaded a new copy yesterday but somehow only got 11.7.
I’ve now downloaded 11.9 amd replaced the version in my test code.
I still have the same problem, page 3 of my test document is printed in portrait not landscape. You cannot see the ‘>’ at the right hand side of the page.
Are you sure this has been resolved?
Hi Craig,
Document doc = new Document(“C:\Temp\TestDoc.doc”);String printerName = “Microsoft XPS Document Writer”;
PrinterJob pj = PrinterJob.getPrinterJob();
PrintService[] service = PrinterJob.lookupPrintServices();
for (PrintService printService : service) {
if (printService.getName().contains(printerName)) {
pj.setPrintService(printService);
break;
}
}// Create the Aspose.Words’ implementation of the Java Pageable interface.
AsposeWordsPrintDocument awPrintDoc = new AsposeWordsPrintDocument(doc);// Pass the document to the printer.
pj.setPageable(awPrintDoc);// Print the document with the user specified print settings.
pj.print();
I have just tried it with the Microsoft XPS Document Writer and you are correct that it appears to work.
However it doesn’t work with a Physical printer. Have you tried with a real printer?
Hi Craig,
If I print the document from Microsoft Word it works fine.
I’ve tried with multiple machines and printers all have the same issue when using Aspose.
Will you be able to try with a real printer at any point?
Hi Craig,
Thanks Adam,
do you have a bug reference number or something which I can use to refer to the issue in future communications?
Actually Adam,
I just saw the Jira Number at the top message.
Do you have any idea how long bug resolution will take on this issue?
Craig
Hi Craig,
The issues you have found earlier (filed as WORDSJAVA-652) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.