Manage Size of Print Queue Files & Printing Speed using C# or Java | Convert Word Document to PostScript PS | DOCX to PCL

We are testing out Aspose.Words 10.5 to print a document on a Windows 2008 Server running JBoss 5.1 with JDK 1.6.22. We have a two page document that simulates an Explanation Of Benefits document. The PDF is around 97 Kb (see attached file EOB.pdf). When we go to print it the file size in the Windows Print Queue is 92.1 Mb in size (see attached PrintQueue.jpg). It also seems to be printing very slowly, about 15 documents a minute compared to PDF which was doing around 900 per minute.

Hi
Scott,


Thanks for your inquiry. I would suggest you please upgrade to the latest version of Aspose.Words i.e. v11.1.0 and then let us know how it goes on your side.

I hope, this will help.

Best Regards,

I tried that and the print queue document size was 1.64 MB, the only problem is that 11.1 mangles the document badly when it prints making it unuseable as a solution. See <A href=".

I ran a quick speed test with 11.1 just to see if it was any faster and it is printing about 25 documents a minute as opposed to 10.5 which was doing about 15 per minute. We are currently using OpenOffice as our rendering system for creating PDF and printing and OpenOffice is printing at about 55 documents a minute for the same document. We were so impressed with the speed and accuracy of the convert to PDF we were ready to hit the GO button when we started the print tests and that just brought everything to a screeching halt. We need speeds at least as good as OpenOffice, preferably better. Since this is a trial for us we are not as intimately familiar with the Aspose.Words API and could be doing something very wrong. Here is a sample of the code we are using to print. In the code if they have selected defaults for everythign then we just call document.print(printername) else we fill in an Attribute set and print that way. If there is a better way to doing this please let me know.

Sample Code:

document.updateFields();

if(paperOrientation.equalsIgnoreCase("DOCUMENT_DEFAULT") && paperFormat.equalsIgnoreCase("DOCUMENT_DEFAULT") && copyCount < 1)

{

document.print(printerName1);

}

else

{

// Initialize the Print Dialog with the number of pages in the document.

AttributeSet attributes = new HashAttributeSet();

attributes.add(new PrinterName(printerName1, Locale.getDefault()));

if(paperOrientation.equalsIgnoreCase("DOCUMENT_DEFAULT") || paperOrientation.equalsIgnoreCase("PORTRAIT"))

{

attributes.add(OrientationRequested.PORTRAIT);

}

else if(paperOrientation.equalsIgnoreCase("LANDSCAPE"))

{

attributes.add(OrientationRequested.LANDSCAPE);

}

if(paperFormat.equalsIgnoreCase("DOCUMENT_DEFAULT") || paperFormat.equalsIgnoreCase(NIPaperFormat._LETTER))

{

attributes.add(MediaSizeName.NA_LETTER);

attributes.add(MediaSize.NA.LETTER);

}

else if(paperFormat.equalsIgnoreCase(NIPaperFormat._LEGAL))

{

attributes.add(MediaSizeName.NA_LEGAL);

attributes.add(MediaSize.NA.LEGAL);

}

else if(paperFormat.equalsIgnoreCase(NIPaperFormat._A3))

{

attributes.add(MediaSizeName.ISO_A3);

attributes.add(MediaSize.ISO.A3);

}

else if(paperFormat.equalsIgnoreCase(NIPaperFormat._B4))

{

attributes.add(MediaSizeName.ISO_B4);

attributes.add(MediaSize.ISO.B4);

}

else if(paperFormat.equalsIgnoreCase(NIPaperFormat._TABLOID))

{

attributes.add(MediaSizeName.TABLOID);

attributes.add(MediaSize.Other.TABLOID);

}

//Removed most of the checks for the different paper formats to save space.

attributes.add(new Copies(copyCount));

attributes.add((collate?SheetCollate.COLLATED : SheetCollate.UNCOLLATED));

attributes.add(PrintQuality.HIGH);

if(document.getOriginalFileName() != null)

{

attributes.add(new DocumentName(document.getOriginalFileName(), Locale.getDefault()));

}

document.print(attributes);

}

I downloaded a trial of the Aspose.Words .NET to see how it compared with the Aspose.Words Java and the printing is very different. The same document printed is only 320 KB in the print queue and it is printing around 30 documents a minute. The print is scaled correctly and looks like it down when Word prints it. I have included a screen print of the print queue with the document printed using Aspose.Words for .NET.

Hi Scott,


Thanks for your inquiry.

We have an existing issue to try and improve printing speed in Aspose.Words compared to automation and VBA macro. This is a similar request to OpenOffice so I have linked your request to issue. We will inform you as soon as there are any developments. I’m afraid at the moment analysis into this issue is postponed so there most likely will not be any resolution any time soon.

In the mean time there are a few ideas you can try:

  • Try implementing your own print class using Document.RenderToScale. This way you can see if your own class is faster in any way, or if you can speed up parts of it yourself. See an example of how to set up your own custom printing class here: http://docs.aspose.com/display/wordsnet/How+to++Print+Multiple+Pages+on+One+Sheet
  • Secondly you can try doing the above but with just printing a simple image or text without using Aspose.Words. This way you can see how fast native printing is in .NET/Java and if there are any problems on your side with printing in either of these platforms (perhaps printer specific).
  • In relation to above the following thread might be useful: http://bytes.com/topic/net/answers/556599-printdocument-speed-slow

If we can help with anything else, please feel free to ask.

Thanks,

Hi Scott,


Also we would love to hear any feedback you may have regarding this. This will help us improve printing speed in future version of Aspose.Words.

Thanks,

Sorry it took so long to get back to you, I have been busy trying other solutions for print. It looks like the Java Print system is just slow. One thing we looked in to and are working on is the fact that most newer printers will accept PDF directly. We have used iText in the past to slam a bunch of PDFs in to one giant PDF for a client and then sent the one giant document to the printer, this resulted in huge time savings. I noticed that Aspose.Words has the ability to append documents but I have not played with that yet.

Many of the high volume players simply export directly to the printer data type (PCL, PostScript, AFP, MetaCode, etc.), it shouldn't be that hard to export the document to a printer data type, I know that PDF and PostScript are very similar in structure. If Aspose.Words could export as PCL or something like that, you could just stream the bytes directly to the printer which should be a lot faster then trying to use the Java Print system. It would also allow you to just save the bytes to the hard drive and have a native program stream it directly to the printer if Java can't get the bytes through fast enough.

Just my thoughts on printing.

Hi Scott,


Thanks for getting back to us, we appreciate your feedback.

1) Yes you can join many Word documents in memory using Aspose.Words and then render them at once to PDF. Alternatively you can join many PDFs together using Aspose.Pdf, you may want to find which technique suits you.

2) We have existing requests to support rendering documents to “printer formats” such as PCL and Postscript. I have linked your requests to these issues. We will inform you as soon as there are any developments with them.

Thanks,

The issues you have found earlier (filed as WORDSJAVA-450) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(5)

Just run this 11.6 update on the test app submitted in my query yesterday; "Massive speed issue when printing between version 11.5 of Words and version 10.2"and it is even slower taking 1:24 to print a simple 3 page doc compared to 44 secs previously! :frowning:

Hi Scott,


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,

Hi Jon,


Thanks for your inquiry. I have answered your query on your other thread.

Thanks,

The issues you have found earlier (filed as WORDSNET-3798) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(3)

The issues you have found earlier (filed as WORDSNET-3995) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(17)

@sherter, @jbaggaley,

It is to inform you that you can now use the latest versions of Aspose.Words for .NET and Aspose.Words for Java APIs to convert Word documents directly to PostScript (PS) and Printer Command Language (PCL) file formats.

For example, the following Java code will create a book fold in the PostScript format.

Document doc = new Document("Paragraphs.docx");

// Configure both page setup and PsSaveOptions to create a book fold
for (Section s : (Iterable<Section>) doc.getSections()) {
    s.getPageSetup().setMultiplePages(MultiplePagesType.BOOK_FOLD_PRINTING);
}

PsSaveOptions saveOptions = new PsSaveOptions();
{
    saveOptions.setSaveFormat(SaveFormat.PS);
    saveOptions.setUseBookFoldPrintingSettings(true);
}

// In order to make a booklet, we will need to print this document, stack the pages
// in the order they come out of the printer and then fold down the middle
doc.save("PsSaveOptions.UseBookFoldPrintingSettings.ps", saveOptions);

The PsSaveOptions Java Class can be used to specify additional options when saving a Word document into the PostScript (PS) format. Please also take a look at different options provided by the PclSaveOptions Java Class.