Free Support Forum - aspose.com

Printing converted documents

Hey,

I’m currently working on a silverlight application with a .NET server side.
I’m using aspose words to convert my created documents to PDF.
After that the pages should be instantly printed.

I found out aspose.words could handle printing on this page:
http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.rendering.asposewordsprintdocument.html
This looks really good as I can just use a memorystream of my document.

However since I’m trying to do the print job server side the dialogs obviously don’t show up for the client.
Is there any way to set my printer path etc and skip the dialog windows?

thanks in advance

Hi,


Thanks for your inquiry.

In order to print the document without bringing up any user interface forms, first you have to include System.Drawing.Printing namespace in ASP.Net web form then please see the following code snippet to print the document according to the specified printer settings, using the standard print controller (no User Interface):

const string printerName = @"\COMPANY\Brother MFC-885CW Printer";
Document doc = new
Document(@“C:\Rendering.doc”);

PrinterSettings printerSettings = new PrinterSettings();
// Page numbers in the .NET printing framework
are 1-based.
printerSettings.FromPage = 1;
printerSettings.ToPage = 3;
printerSettings.PrinterName = printerName;
doc.Print(printerSettings);

Moreover, you can find information about other available overloads for this Document.Print() method by visiting the following ink:

List of Print Method Overloads

I hope, this will help.

Best Regards,

Hey thanks for the quick reply.

I still have a problem with this.

Document doc = new
Document(@“C:\Rendering.pdf”);

is giving me problems now. Do you need Aspose.PDF to make a new document of a pdf?
I’m currently only using aspose.words.Document and this gives a ‘wrong file format’ error.
Pdf isn’t listed under the loadformats either so i guess you can’t do this with aspose.words?

Or am I just doing something wrong somewhere?

I’m working with a memorystream instead of a path so maybe i’m screwing something up.

thx in advance

Hi

Thanks for your request. Aspose.Words works only with Word document formats, e.g. DOC, DOCX, RTF etc.

Regarding PDF, you should use Aspose.Pdf.Kit or Aspose.Pdf to works with PDF documents.

Best regards,