We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Multithreaded html printing

Hello.
I am using your html controls to print html documents in IIS hosted web services. When request is arrived to web service IIS starts its work on new thread.
To reproduce this behavior I created next stub:

    Parallel.For(0, 5,
                i =>
                {
                    var control = new HTMLUIControl();
                    control.LoadFromString("<head></head><body><p>Hello world</p></body>");
                    var printDocument = new HTMLUIPrintDocument(control.Document);
                    printDocument.DocumentName = "Test print";
                    printDocument.PrinterSettings.PrinterName = "Printer name";
                    printDocument.Print();
                });

Basically, what I want to achieve is to add this printings into a queue.
This stub crashes with ArgumentNullException on var printDocument = new HTMLUIPrintDocument(control.Document); because control.Document returns null.

What can I do to fix it?
BTW how can I prevent HTMLUIControl from displaying its contents on screen while it's printing?

2 Replies

ST Saravanan T Syncfusion Team August 29, 2014 04:37 PM UTC

Hi Dmitriy,

 

Thank you for using Syncfusion products,

 

We would like to let you know that we have forwarded your query to our development team for further analysis. We will get back to you with the analyzed details before the end of September 2nd, 2014.

 

Please let us know if you need any further assistance,

 

Regards,

Saravanan T



ST Saravanan T Syncfusion Team September 2, 2014 12:42 PM UTC

Hi Dmitriy,

 

Thank you for your patience,

 

We would like to let you know that we can use the ResetText method to prevent HTMLUIControl from displaying its contents on screen while it's printing. We have prepared a sample for your requirement and it is available in the attachment. Please look into it and let us know whether it meets your requirement.

 

Code Snippet [C#]:

 

this.htmluiControl1.ResetText();

 

Please let us know if you need any further assistance,

 

Regards,

Saravanan T


Attachment: HTMLUIControl_f127657f.zip

Loader.
Up arrow icon