I want to print webpage using C# without showing Printer Dialog box. I want to provide the url and it should print the page as displayed. Currently my code is printing HTML code. Please guide me to do so.
Print Web Page without showing Print Dialog
785 Views Asked by Adeel Kamran At
2
There are 2 best solutions below
0
Adeel Kamran
On
I successfully do this by these lines. But the issue is that this only prints to default printer. I know to set the default printer but I am looking for solution where I pass printer name and it print the webpage without setting it to default printer first.
ie.Navigate(URL, ref missing, ref missing, ref missing, ref missing);
while (!documentLoaded && ie.QueryStatusWB(OLECMDID.OLECMDID_PRINT) != OLECMDF.OLECMDF_ENABLED)
ie.ExecWB(OLECMDID.OLECMDID_PRINT, OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, ref missing, ref missing);
Related Questions in C#
- How to call a C language function from x86 assembly code?
- What does: "char *argv[]" mean?
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- How to crop a BMP image in half using C
- How can I get the difference in minutes between two dates and hours?
- Why will this code compile although it defines two variables with the same name?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Why can't I use the file pointer after the first read attempt fails?
- #include Header files in C with definition too
- OpenCV2 on CLion
- What is causing the store latency in this program?
- How to refer to the filepath of test data in test sourcecode?
- 9 Digit Addresses in Hexadecimal System in MacOS
- My server TCP doesn't receive messages from the client in C
- Printing the characters obtained from the array s using printf?
Related Questions in PRINTING
- Why does print(list.sort()) result in None?
- How do I print a JTable in the form: Image + header + table in a single page (Java Swing)
- Neptune 3 Pro, Prusa slicer won't stick on plate
- Disable the -n for pyexiftool such that fields like LensID are formatted for human reading
- Why am I not receiving Internet from my Wi-Fi unless I connect to a VPN?
- how check if printing content on new page
- Android PrintManager: process gets killed, print outputs file of zero bytes length
- Print The Receipt Only Using PHP or JS
- How do you make the pop up appear and print a sentence in the main/side panel?
- GDI - Why the printing StartPage() function works in 32 bit but raises an exception in 64 bit?
- Mobile printing PT200 tru Bluetooth opened in web app
- How to keep tqdm progress bar on the bottom of the terminal?
- PlatformException(connect_errd or timeout)
- Chrome PDF print image aspect ratio incorrect - very apparent with small images - is there a workaround?
- Map to fit postersize using Cartopy
Related Questions in HTML
- How to store a date/time in sqlite (or something similar to a date)
- How to use custom font during html to pdf conversion?
- Storing the preferred font-size in localStorage
- mp4 embedded videos within github pages website not loading
- Scrimba tutorial was working, suddenly stopped even trying the default
- Is there any way to glow this bulb image like a real light bulb
- With non-graphical maps in Leaflet, zoomDelta doesn't work
- What can I do to improve my coding on both html and css
- Uncaught TypeError: google.maps.LatLng is not a constructor at init (script.js:7:13)
- Bootstrap modal not showing at the desired position on a web page when the screen size is smaller
- Displaying a Movie List on a Website Using Jinja2 and Bootstrap
- How to redirect to thank you page after submitting a Google form embedded into a Google Site?
- Storing selected language in localStorage
- Fences (parenthesis, braces) in HTML and MathML
- Understanding Scroll Anchoring Behavoir
Related Questions in SYSTEM.PRINTING
- PrintSystemJobInfo.JobStream deletes the job from the printer once the stream is closed and before printing anything
- C# Printing with PrintTicket and Locked Printing
- Setting the media type on a printer in windows using C#
- Is there a way to print a Java model in InteliJ prompt?
- New PrintServer object fails, "printer name is invalid"
- How to install .PRI printer definitions on SAP?
- Print Web Page without showing Print Dialog
- How do I make my array print repetitions of an input once? (JAVA)
- Why is my 2D Array Maze not printing what is generated?
- Check Physical Print Job Success
- c# System.Printing AddJob() generates exception on windows server 2012 r2
- Unable to get number of copies of a print job in c# using PrintJobInfoCollection
- Modify a printTicket
- Specify a different inputbin when printing with System.Printing (printQueue.AddJob)
- System.Printing namespace set printer page source
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
This sounds trickier than it is (most probably). My understanding is that you would need some sort of an engine in order to translate all webpage's styles, layout and paintings. and just after that render whatever is the final result. Keeping this in mind one things pops up immediately: browser automation and in particular - selenium could do the job. Since you asked without showing Printer Dialog box, you can run in headless mode Still I think your best bet is to have a Print Preview page loaded via
js.ExecuteScript("setTimeout(window.print, 5);");(reference) and then carefully locate the print button with waiting handlers.PS. I don't believe this is the cleanest and easiest solutions out there, however it's the only one I can currently think of.