Welcome Guest Search | Active Topics | Sign In | Register

PdfDocument.Print() method not working properly Options
Chandresh Vanker
Posted: Thursday, December 28, 2017 5:33:02 AM
Rank: Newbie
Groups: Member

Joined: 2/23/2017
Posts: 6
Hi...
I have to print the PDF file from my .net based web application.
So I have used PdfDocument.Print() menthod to print the document.
I have tried all the permutations and combinations with this method, but could not succeed.
problem i am facing is, this method is not working all the time, sometimes it prints correctly and sometimes its not.
I am using eo.2017 control version for the same.
kindly help.
eo_support
Posted: Thursday, December 28, 2017 1:24:58 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Hi,

Make sure you do not call Print in rapid succession. Internally PdfDocument.Print relies on Chromium browser engine to print the document and the browser engine has code to "slow down" and ignore print on purpose (to avoid scripted print attacks). You can follow these steps:

1. Call PdfDocument.Print to print a document;
2. Attach an OnDone handler to the returned ManualTask object;
3. Wait until your OnDone handler is called;
4. Wait for an additional one minute before you start another print again;

Please let us know if this works for you.

Thanks!
Chandresh Vanker
Posted: Friday, December 29, 2017 5:15:58 AM
Rank: Newbie
Groups: Member

Joined: 2/23/2017
Posts: 6
Thanks for your reply...
Actually I need to call Print frequently in my application.
I am attaching header/footer to PDF file, then merging them if needed, and then calling print method on final PDF file.
Kindly guide me how to release objects used in above process, and how can i run my application smoothly.
Chandresh Vanker
Posted: Friday, December 29, 2017 6:51:35 AM
Rank: Newbie
Groups: Member

Joined: 2/23/2017
Posts: 6
Moreover, when i host the application on server its not working. Print functionality is not working on the hosted application, it works in local computer. kindly suggest.
eo_support
Posted: Friday, December 29, 2017 7:36:44 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
You can not do either:

1. If you print too frequently, the browser engine will fail the print on purpose. There is no way for you to "free the object" to speed up;

2. You can not print on your server because:
2.a: Your server may not have a printer at all;
2.b: Your server may not give you permission to access the printer even if it has one;
2.c: It is impossible for your code to print from your server to a client printer;

So you are basically chasing something that's not doable. Hope this makes it clear to you.

Thanks!
Chandresh Vanker
Posted: Friday, December 29, 2017 7:41:23 AM
Rank: Newbie
Groups: Member

Joined: 2/23/2017
Posts: 6
So, are you saying that Print functionality is not possible in .net based web application ?
eo_support
Posted: Friday, December 29, 2017 7:46:01 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Any kind of client side print is not possible in any kind of web application from the server side. If you want to print to printers on the client computer, you do print on the client side (usually with JavaScript). If you want to print to the printers on the server computer, you print on the server side (with whatever server side language you use). There is no such thing as printing on the server side to the printers on the client side. It doesn't matter what platform/language you use.
Chandresh Vanker
Posted: Monday, January 1, 2018 6:10:23 AM
Rank: Newbie
Groups: Member

Joined: 2/23/2017
Posts: 6
Kindly find the below mentioned response which i have got earlier...


From: "Essential Objects, Inc."
To: chandreshvanker@torrentpharma.com
Date: 23/02/2017 07:08 PM
Subject: Re: Print PDFs without dialog box
Hello,

Yes. You can do that with this method:

https://www.essentialobjects.com/doc/eo.pdf.pdfdocument.print.aspx

The documentation include sample code of printing without showing the
dialog.

Thanks
Jack

On 2/23/2017 5:48 AM, chandreshvanker@torrentpharma.com wrote:
> From: Chandresh Vanker
> Phone: 8460799025
> IP: 219.65.58.161
> Hi,
> we, at torrent using EO.Web & EO.pdf controls for our .net based applications.
> we have one requirement of printing pdf files from asp.net application without prompting the print dialog box at client side. print should get executed at default set printer. number of pages will be provided through asp.net application.
> Kindly, let us know if your control can do this thing. Also provide some example that we can refer and same can be implemented in our applications.
>
eo_support
Posted: Monday, January 1, 2018 9:42:00 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Hi,

Sorry that we did not realize what you were trying to do is to print from the server side to the client side.

The key here is you are trying to do something on one computer and you expect the result to occur on another computer. It DOES NOT work this way. Just imagine, can I press a print button on my computer here in the United States and expect the document to be printed out on your computer in India? Obviously it won't work that way, even if both our computers are connected to the Internet. It does not work because you are expecting a "remote" action. Typical way of doing such thing is to change the "remote" action into a "local" action. For example, I can email you the file to be printed, then you can print it locally on your computer.

PdfDocument.Print is the same principle. It always print to a printer connected to the same computer. So whatever you do, the first step you need to do is to change such impossible "remote" action into a "local" action. The typical way of doing such thing in a web application is:

1. The server generate the PDF file (this is where our code runs);
2. The server sends the PDF result file to the client browser (you usually need to write code to do this);
3. The client browser print the PDF file (this has nothing to do with us);

Here usually only step 1 has to do with our product. Step 2 is usually unrelated to our product (unless you use ASPXToPDF or MVCToPDF, which has built in features to send the PDF result file to the client) however the step is trivial to achieve. Step 3 involves JavaScript programming and it has nothing to do with us.

Step 3 is what invokes the print dialog. If you use a regular browser, then there is no way for you to skip the dialog. If you use a custom client browser, then it's possible for you to achieve whatever that client supports. For example, our EO.WebBrowser product allows you to print a web page or PDF file without displaying the print dialog. So if you can implement a custom client (take a look of our TabbedBrowser sample application) and ask your users to use that custom client instead, then you will be able to truly achieve what originally wanted to achieve.

Hope this gives you enough information. Some of those are generic programming concepts (such as you can't print directly from a web server computer to the client computer) and we will only point it out to you. If you still have further questions on that, you will need to seek other resources as we are not in a position to offer support on generic programming questions. Some other issue discussed here are specifically related to our product, so if you still have questions on those, feel free to ask and we will be happy to assist you further.

Thanks!



Chandresh Vanker
Posted: Monday, January 1, 2018 11:03:06 PM
Rank: Newbie
Groups: Member

Joined: 2/23/2017
Posts: 6
That simply means PdfDocument.Print() is meant for windows applications only and not for the web application...
Kindly confirm...
eo_support
Posted: Tuesday, January 2, 2018 7:34:56 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Of course. There is no such thing as print for web application.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.