Aspose Words (Java) AsposeWordsPrintDocument doesn't respect page orientation

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();

}

}

Hi Craig,

Thanks for your inquiry. Could you please attach your input Word document here for testing? I will investigate the issue on my side and provide you more information.

Best regards,

My Test Document is attached, but you could test it with any document which has a landscape page orientation.

Hi Craig,

Thanks for your inquiry. Perhaps you're using an older version of Aspose.Words; as with Aspose.Words for Java v11.9.0, I was unable to reproduce this issue on my side. I would suggest you please upgrade to the latest version of Aspose.Words i.e. v11.9.0. You can download it from the following link:
http://www.aspose.com/community/files/72/java-components/aspose.words-for-java/default.aspx

I hope, this helps.

Best regards,

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,


Thanks for your inquiry. Well, I used different soft printers on my side and all produced the output as expected. I have attached a sample output Xps document here for your reference. I have printed your Doc to this Xps file by using the following code:
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();


Please let me know if I can be of any further assistance.

Best regards,

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,


Unfortunately, at the moment, a physical printer is not available on my side. Could you please check if the same issue also occurs when printing from Microsoft Word? Have you tried printing on a different machine/printer to try discover if this issue is related to a specific printer or to Aspose.Words?

Thanks for your cooperation.

Best regards,

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 for your clarification.

I tested this out on my side using a physical printer and was able to reproduce the issue. This doesn’t occur when using the .NET version of Aspose.Words so this must be a bug localized to the Java version. I have logged this bug in our system and the developer responsible will analyse it shortly.

We will let you know as soon as there are any developments.

Thanks,

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,


Thanks for your inquiry. Our development team is currently doing analysis of your issue (WORDSJAVA-652); so, we can’t provide you any reliable estimate at the moment. Once the issue is analyzed, we will then be able to provide you more information on the ETA. Sorry for the inconvenience.

Best regards,

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.