We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com


Im finding that the Print method is taking an absolute age to complete.
Im creating a sample document (<100Kb) and then running the following line of code

Dim doc as Document=getMySampleDoc()
Dim settings as New System.Drawing.Printing.PrinterSettings()

The doc does eventually appear on the print queue but anything up to an hour later!

If I change the printer to a local printer then it appears on the queue immediately

If I send a document to printer from notepad or word directly, the doc appears on print queue immediately

Any help appreciated


Thanks for your inquiry. It would be great if you please share following information for investigation purposes.

What environment are you running on?

  • OS (Windows Version or Linux Version)
  • Architecture (32 / 64 bit)
  • Please supply us with the input document that is causing the issue
  • Are you facing this issue will all document or only with specific document?

As soon as you get these pieces of information to us we’ll start our investigation into your issue.

This is happening to all documents. Code for sample is provided below.
In th staging server environment, the document never gets to the print queue. From the logging I have added to app, I can see that execution does not move beyond the Doc.Print line…

In the dev environment, the doc does get to the print queue after a 5/10 min delay

Dev Machine
Win 7 Enterprise SP1
64 Bit

Staging Server
Win 2008 Server R2 Datacenter


Sub PrintSampleDoc(PrinterName As String)
    Dim doc As Document = GetSampleDoc()
    Dim settings As New System.Drawing.Printing.PrinterSettings
    settings.PrinterName = PrinterName
    doc.Print(settings, "CustomDocName")

End Sub

Private Function GetSampleDoc() As Document 
    Dim l As License = New License()
    Dim doc As New Document()

    'Once the builder is created, its cursor is positioned at the beginning of the document.
    Dim builder As New DocumentBuilder(doc)

    'Specify font formatting before adding text.
    builder.Font.Size = 16
    builder.Font.Bold = True
    builder.Font.Color = System.Drawing.Color.Blue
    builder.Font.Name = "Arial"
    builder.Underline = Underline.Dash
    builder.Write("This text")
    builder.Underline = Underline.None
    builder.Write(" is inserted at the beginning of the document and demonstrates ")

    'Set shading and border around a run of text, then clear the border.
    builder.Font.Shading.ForegroundPatternColor = System.Drawing.Color.Cyan
    builder.Font.Shading.Texture = TextureIndex.TextureSolid
    builder.Write("various font")
    builder.Font.Border.LineStyle = LineStyle.Single
    builder.Write(" formatting ")

    'Specify paragraph formatting before calling InsertParagraph or Writeln.
    builder.ParagraphFormat.Borders.LineStyle = LineStyle.Single
    builder.ParagraphFormat.Borders.LineWidth = 1.5
    builder.ParagraphFormat.Alignment = ParagraphAlignment.Center
    builder.ParagraphFormat.Shading.ForegroundPatternColor = System.Drawing.Color.LightBlue
    builder.ParagraphFormat.Shading.Texture = TextureIndex.TextureSolid
    builder.ParagraphFormat.LeftIndent = ConvertUtil.InchToPoint(0.3)
    builder.ParagraphFormat.SpaceBefore = 12
    builder.ParagraphFormat.SpaceAfter = 12
    builder.Font.Name = "Arial"
    builder.Font.Size = 12
    builder.Write("This fragment demonstrates use of paragraph formatting to specify ")
    builder.Writeln("alignment, spacing, borders and shading.")

    'Insert another section and demonstrate page setup properties.
    builder.Font.Size = 12
    builder.PageSetup.PaperSize = Aspose.Words.PaperSize.A5
    builder.PageSetup.Orientation = Orientation.Landscape
    builder.Writeln("This text is in a section with different page size and orientation.")
    builder.Writeln("Insert an image into the document here.")

    'Move to a position in the header.
    builder.Font.Italic = True
    builder.Write("This text is inserted into the header.")

    Return doc
End Function


Thanks for sharing the detail. Please note that the Aspose.Words Print method uses System.Drawing and standard .NET printing classes.

Please try following code snippet for testing at your end. This code does not use Aspose.Words at all. So if it will not work, the problem is somewhere on your side.

PrintDocument doc = new PrintDocument();
doc.PrinterSettings.PrinterName = @"\\hp LaserJet 1010 Series Driver";
doc.PrintPage += Doc_PrintPage;


private void Doc_PrintPage(object sender, PrintPageEventArgs e)
    e.Graphics.DrawImage(Image.FromFile(@"Common\test.jpg"), e.MarginBounds.Left, e.MarginBounds.Top);

This code just prints an image. Please let us know if you have any more queries.

The code below took 8 secs to run

Dim ts As DateTime = Now
Dim doc As PrintDocument = New PrintDocument()
doc.PrinterSettings.PrinterName = txtPrinter.Text
AddHandler doc.PrintPage, AddressOf Doc_PrintPage
Dim dur As TimeSpan = Now.Subtract(ts)
MsgBox(dur.TotalSeconds) '8 secs

My original code takes 110 secs today


Thanks for your feedback. I have tested the scenario (with your code share here) at following environment and have not found the shared issue while using latest version of Aspose.Words for .NET.

Windows 7 (64 bit)
Windows Server 2008 R2 (printer is installed at this machine)

Please test this scenario at some other machines and let us know if you still face problem. I would suggest you please upgrade to the latest version (v13.2.0) from here and let us know how it goes on your side.