How to print something in WPF without using controls? [closed] - c#

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm newbie in WPF and I'm trying to print student's exam papers using WPF and I'm creating exam papers using System.Drawing.Graphics and now I want to print them.
But it seems every printable thing in WPF is somehow a control. I have two problems:
I don't know how can I print something that I've created via Graphics Like WinForms PrintDocument (that has it's own problems)
I don't know how to create my exampaper in WPF like what I did with graphics.
would you help me with any of theses questions?

You can utilize the utilize the PrintDocument class, which is not WPF specific. This class allows you to send output to a printer. The PrintPage event should be handled, where you utilize the PrintPageEventArgs to obtain a Graphics context; which is used to draw the exam to the printer output. This is considered the Winforms way of printing.
WPF has enhanced printing support, provided by the System.Printing namespace. These printing services are used to manage print jobs, and to discover print queues, and configured printers. Printing in WPF is usually performed by generating an XPS document, by utilizing the XpsDocumentWriter class & methods. However, GDI printing is available as well, which is what you'd likely need, because of the use of System.Drawing.Graphics. Refer to the GDI Print Path section, here.

Related

How to save WPF as PNG? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 days ago.
Improve this question
how can I save my WPF project to PNG? Need to save this picture input with text on it in PNG.
enter image description here
The main idea of the project is to make adjustable broadcast graphics. So I have presets and can change font size/style, background photo, or color. Need to make 4 presets:
Title
Background for picture-in-picture
Namge graphics
Different backgrounds with generic titles.
May be any ideas or tutorials for how to optimize broadcast graphics. I already have all visuals. Need for TV conference broadcasting. Also up to use any other coding languages. Looking for options

"Reading" the information from picture in C# [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am trying to develop code to read out positional data from a picture thats been loaded into the program.
F.E. : Imagine a picture with houses (red squares) connected with lines.
Now what i would need are the posotions of the houses and the lines in such a way that i can use that data and do more with it.
So : - Load Jpg (f.e) into the programm
- Read the picture and save postions
- Be able to work with the saved positional data.
My issue is that i struggle to find the right way to google this. Is it's as difficult as machine learing or is there a more simple way to solve this?
No need to get it explained, but more a place where i can start research this myself would be awesome!
If you want to find contours, you will be interested in Hough Transformation. Check the image on the bottom.
I recommeng getting a hang on OpenCV image processing library (more specifically the EmguCV which is a C# wrapper of OpenCV). It has a fairly big community and it's a project working for ages.
Generally contour recognition and line recognition algorithm are a good shot. You could add opencv to the search phrase.
If you want to detect lines, Canny edge detection would be a nice shot. Once again I recommend OpenCV for this task.

Automating Photoshop through ASP.NET or PHP [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to start a web project in which:
User first signs up.
Uploads his desired favorite image to website.
Selects which action, filter, plugin or even photo editing feature he wants to be applied to the image and the solution came to my mind is automating Photoshop, I mean user submits his request to the server and server opens up Photoshop and automatically applies the desired operation through Photoshop to the image uploaded by user and saves and returns back the result to the user.
Now the problem is that how can i do so and automate Photoshop through ASP.NET or PHP.
Any solutions appreciated.
The very first thing you need to check out is Adobe's licensing on using Photoshop in this fashion.
Once you've addressed any licensing concerns, it would be fairly straightforward to automate. You need to write the actual photoshop automation part using Adobe's ExtendScript (a flavor of javascript) to do the image manipulation you want. If you include the line '#target Photoshop' at the top of this script that should take care of making sure Photoshop is automatically launched when you execute your script from ASP.NET or PHP.
Chances are you'll want to pass parameters to your scripts - and the only way I am aware to do this would be to write them to a parameters.xml file in a predefined location so that the script can read them in from there. I do not think you can supply them directly when you call your script.
You won't have a good way to tell when Adobe is finished with the image. The best thought I can come up with off the top of my head is to predefine an image drop location and have ASP.NET/PHP poll for the resulting image occasionally. Depending on what you are doing, and what size images the manipulation could take a significant amount of time - you may want to come up with an alternative solution.
ETA: From .NET you can also automate photoshop more directly via its COM interface. You'll need to do a bit more research to get it working, but this link should get you pointed in the right direction.

How to draw Windows-style folder icons that preview the contents [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have a C#/WPF application that displays collections of components. I want to know how to create an image that is styled like the Windows 7 folder icon, where one or two of the content thumbnails are enclosed by a yellow leaf folder. (The collections I have aren't real Windows folders, and their contents aren't real Windows files)
Google Approach
I have spent a fair amount of time searching for code samples on how to do this, or anything even remotely similar. I can't find a single example of anyone doing this, which has truly surprised me. It tells me one of two things:
I can't find the right keywords to search on (combinations of: thumbnail, windows, c#, wpf, icon, folder)
Nobody else has ever wanted to do this, and that's because there is a better way of doing what I want to do.
Coding Approach
I can see that there might be a back image drawn first, and then skew transforms applied to each content thumbnail, overlaid, and then finally the front image. I've seen some code examples that show how to skew images, etc. There are some very subtle effects being drawn here too (shadows), though they could be "canned". I'm not sure how to separate the example images below into a front and back portion, though I could give it a try in Photoshop.
Windows API Approach
The closest approach I've been able to find without coding this from the ground up is to write a component's thumbnail to a real Windows .PNG file, inside a real folder, and then use Windows.Storage.StorageFolder.GetThumbnailAsync() to get Windows to do it for me. Obviously this makes me die a little inside, but it might be the quickest way to do this.
Can anyone help me? Ideally I am looking for a library or existing code sample that could show me how to generate these. Otherwise, I will attempt to code this myself using the coding approach outlined above. I'm not looking for someone to write this code for me, but I would appreciate any pointers.
Thank you!

What printer can I use for On-Demand industrial Printing with a .Net application? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am developing a software system for a plastics factory. My aim is to have 10 barcode labelling printers, one printer for each plastics extruding machine. I do not want these printers to be very intelligent. Each printer will have an ID (1-10) and when a print button is pressed on the printer, a signal is sent via the network to a .Net application which will be listening and therefore send back a label to print depending on the ID of the printer.
This is not the sort of question I would normally ask on here, but I cannot find a printer that will suit my needs... or more accurately do not know what sort of terminology to use when searching.
Any help is appreciated.
I'm unaware of any barcode printers that have buttons that fire an event like this.
I would suggest using a series of USB buttons and programatically mapping them to specific printers.
http://www.thegoodlifeoncampus.com/Dream-Cheeky-Big-Red-Button-USB-gadget-p/dc1014.htm
You'd have make a button and glue it on to the printer as far I'm aware and then wire it up to something.
Last time I worked in this area we just used product tracking and when it detected the product approaching the labelling station, it printed the label so it was ready. Lot of stuff already in place to do that though. Then some poor git could stand there for hours just hanging them on it as it went past.

Categories

Resources