PrintVisual showing save dialog in wpf c# - wpf

I am using wpf printdialog()
I want to print direct but there is showing save dialog to save in pdf first then print.
Here is my code.
PrintDialog pd = new PrintDialog();
pd.PrintVisual(grid1, lblgr.Content.ToString() + "_" + lblreceiptno.Content);

I get exact solution for your problem.
PDFCreator Installed
You are getting above problem because PDFCreator is installed on your development Machine and it is set as Default Printer in your Machine. That's why it's asking for save before printing of the document. So please go to Control Panel->View Devices and Printers and in that set your required Printer or network Printer as Default Printer and it will directly print your document and will not ask for saving it.
PDFCreator not Installed
If you have still have this issue and PDFCreator not installed on your machine then please set your required printer as Default printer and it will solves the issue.

Related

BlueStacks: A Kinemaster problem or where is my video exported to?

I've googleing for a while to fix the following problem, but without success. I'm trying to learn to use the app Kinemaster, in my computer (Windows 10) running under the BlueStack emulator.
Apparently, the video I created was successfully exported, but I cannot find it on the computer.
My question is: where is it stored/exported to?
Open your Bluestacks,,,In Home,Library; Click the System apps go to Media Manager, U can find all your exported videos there, and also u can also transfer it to window by clicking the EXPORT TO WINDOWS and Done..

Why the printing result is not matched with the actual stuff

My application is based on WPF, and it can create plot then print. The issue is: sometimes the printed result is not matched with what it looks in the application (see below image for the bar legend).
Note:
- The problem only occurs when the driver of the printer is not XPS driver. If I print it using a XPS driver on the same printer, then everything works fine.
Can anybody shed some light on this please?
After some investigation, this should be an issue for Microsoft, there is problem when printing the XPS file

My installed WPF app is crashing while trying to create a file

I have a problem with my WPF application (a simple clicker game). I've just made a deployment/created a setup project using Microsoft Visual Studio Installer Projects extension for Visual Studio. Everything seemed to work fine, setup works good (tested on other computer) and furthermore the installed application almost works correctly. The only exception is a button calling function which is creating a new txt (something like a draft of a "save" file) file in a folder where the application is installed. Clicking this button cause instant crash of the whole application. Nothing else happens, no error message, the app just turns off.
I assume that the problem lies in access rights to the folder/administrator rights.
I've added txt file with the same name in the application folder using "File System" window in setup project, deployed and installed again. Even when the file exists the problem happend again (probably because of access rights when trying to override file content).
It's may be important that everything worked while running app through VS, also using .exe works fine on any computer. The problem is only with application installed using setup.
I'm not sure where the problem is so it's hard to show some code, to be honest i'm not even sure if it's a problem with code, maybe it can be solved with setting some setup project properties?
I would like to store some data locally between two sessions, i've choosed txt file because it's light and simple even if it's not the most elegant way.
I expect that installed application will be able to create and override txt file in it's folder.
P.S. if you need any code, screenshots or information about my setup please let me know in comments section, I will provide what's necessary
At the moment you install your program you're having administrator-rights. So the folder where your application is, also was created with administrator-rigths.
If you want to store data to this folder, you'll have to run your application as administrator. (not the best idea)
Otherwise you can change your code to write your file at runtime to a different location where you don't need administrator-rights.
For example:
string path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
will give you: "C:\Users\MyUserName\AppData\Local"
string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
will give you: "C:\Users\MyUserName\AppData\Roaming"
string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
will give you: "C:\Users\MyUserName\Documents"
And some error-handling around the saving of the file would be very nice and helpful ;)
Thank you everyone for solution and knowledge, the problem was as I assumed (access to the path denied).
I was using this code to create a path:
Directory.GetCurrentDirectory() + "\\SyntyhCitySave.txt";
Creating a file in a special directory instead of application folder works, that's the solution for my problem:
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\SyntyhCitySave.txt";
Tomtom answer marked as accepted.

Issue adding a Access File as a Data Source in Visual Studio

Good evening,
I seem to be having an issue with adding a Access Database as a Data Source in my Visual Studio project. When I launch the New Data Source wizard and go through the first two steps I land at the 'Choose Your Data Connection' window, where I have to choose 'New Connection...'. Once this window has opened I choose the first option which is 'Microsoft Access Database File' and this is where I'm having my issue. It seems the way that it is supposed to work, and how it works for everyone I know, is that it is supposed to open a New Connection window similar to this:
(This is a screenshot I grabbed off Google as I cannot actually get to this step, I realize it's an old photo but this is generally what I'm supposed to see)
First Screenshot
What I actually get is this:
Second Screenshot
And that's where I'm stuck. Any ideas?
Any help is appreciated. Thanks.
Andrew
If anyone else has this issue, running the Windows System File Checker tool seems to repair it. To run, open a command prompt as administrator and type:
sfc /scannow
Once that completes (it may take a while), reboot and you should be good to go.

Customizing Print to File in WIndows

I have a requirement where my client want to install a custom "Print to File" printer (apparently MS has an SDK for this?). They want to be able to install this as a kind of "application" so that if someone chooses to print to this printer, they have to answer a few questions, and the file gets "printed" to a path of our choosing. (we will then do some other things with the file such as rename it and SFTP it)
I have tried googling, looking for things such as "customize print to file" and I have found nothing. Does anyone have any experience with this and can give me a kick in the right direction?
EDIT: I would rather have a c# oriented solution but I am willing to take anything right now.
Edit 2: The idea is for this "custom print driver" is for a document imaging company to provide an easy method for their customers to store/archive documents. The idea, is that the customer, if they want to store/archive a document, they would print, from standard windows applications such as Word, Excell, Acrobat Reader, Web Pages, etc., to the "company X" printer driver. When doing so, the document would get "printed" to a file in a specific location that another application (which has a filewatcher service on it, which would rename it and send it to the SFTP server), knows to watch. The document that is printed to the file, should ideally also be able to come out on paper (AKA just like normal). When printing to the "Custom print driver", we also need to have a form filled in which would provide meta-tags for the archiving system, which would also be uploaded to the document imaging system.
I am not looking to recreate a printing application, nor am I looking to add "printing" into a custom application. This needs to work at the Windows level.
I have no problems with the SFTP, FileWatcher, Alchemy integration (the document archiving application) or the document renaming portion. It's the "custom print driver" that I am having issues with. This is all compounded by the fact that when installing the application, I need to automatically install the "custom print driver", and configure it during the install process. Essentially the solution needs to be installed as a printer available under "My Printers" and should be available for any type of document, Word, Excell, PDF, etc. Oh, and it needs to be availabe for XP, Vista, and Windows 7 . . . . :(
Thanks in advance for everyones help. I have a feeling that this one is going to be a doozy :(
Hah! I knew I'd seen at least one...
ActMask Virtual Printer Driver
Can't make a recommendation of any sort not having tried this particular toolkit - but it would appear to me to bear a strong resemblence to the sort of solution you're after.
What kind of customization you are talking about? Can't you use the .Net inbuilt one?

Resources