I am having big problems trying to print a PDF file in Windows using Ghostscript. The 'in Windows' argument comes from the fact that I am trying to use MS Windows default driver for this '-sDEVICE=mswinpr2'. I need all windows printers/drivers support. Also I can not use the PDF to images then to print job kind of solution. I cant use the gswin64c.exe file also, and I need that the job is done without any popups (no form of any kind). All I can do is just to send some parameters to gsdll32.dll and it to create a print job.
I am using C# wrapper
https://github.com/mephraim/ghostscriptsharp/tree/master
I am sending the following parameters: "-dBATCH -dNOPAUSE -dNOPROMPT -dDEVICEWIDTHPOINTS=612 -dDEVICEHEIGHTPOINTS=792 -dFIXEDMEDIA -dPDFFitPage -sDEVICE=mswinpr2 -dQUIET -sOutputFile=\"%printer%Epson Stylus Pro 4900\" D:\1.pdf"
And every time the printer selection dialog keeps popping up. I understand that the order the parameters are in matters .... because I changed it and it had different results.
Actual Question:
What parameters do I have to send to GhostScript dll so that I can print a PDF file using the default MS Windows printing driver.
Have you tried this using the command line version of GS instead of the DLL or C# thingy ? I'd suggest you concentrate on getting that to work first.
What is the name of the printer (as it appears in Windows) ?
What version of Ghostscript are you using ?
Try using the command line without '-dBATCH', '-dNOPAUSE', '-dNOPROMPT', '-dQUIET'. that way if Ghostscript tries to tell you something you won't just ignore it or miss it.
If the command line works then; I see you've escaped the " characters, but not the '%', you might want to escape those, or double them up. Depending how this wrapper of yours works they might be getting read as format specifiers.
The parameters used in the command line have been verified first in the command line version gswin64c.exe (64 bit operation system) and they work fine.
I am using GS version 9.10 (latest version).
I've tried different combinations of parameters, with or without some of them ... same result ... -100 exit code (general fault with no specification of the error that caused it).
It doesn't seem to be a problem with that % character... I'll try some more things.
Thanks Ken for the help
As far as the printer dialog popup is concerned, if you replace "mswinpr2" with the a compatible device name such as ljet4, the prompts would go away. My guess is that your computer must be having more than one printer installed and hence windows prompts for you to choose one from the list.
Related
This is my first try to create a c# script to print a label from a Zebra s600 printen. I have a really hard time finding a good guide on the internet about how this would work. The Zebra s600 is also a very old model. Right now I am using the SDK from Zebra:
https://www.zebra.com/gb/en/support-downloads/printer-software/link-os-multiplatform-sdk.html#text_f34a
But I found out that the s600 is not included in the support list. My script does activated a little greenlight on the printer the moment I run the script. But nothing else happens. I also have no idea how to search further for my issue. Every search is a dead end.
I did followed this tutorial because I could't find any example on the web:
https://www.youtube.com/watch?v=RvWG9_rE9rg
Seems like it still supports ZPL. Have you tried sending ~WC? Try opening a command prompt and doing echo ~WC > LPT1 or echo ~WC > COM1.
If that prints a config label, then you can either use the ZDesigner drivers to print to it as a normal windows printer. If you do not find a driver for the exact model of printer, just select one with the same DPI and PDL.
Or you can write ZPL directly to the printer. To figure out what ZPL to send, you can use ZebraDesigner. The free versions are sufficient. Avoid the XML functionality unless you find the printer to support it - it was introduced after that series, I think.
First I'd like to say that long time reader of this site! Has saved me a lot from some problems that I've run in to while learning how to develop applications (specifically in c#).
Now on to the problem I am facing. I am currently developing an application that will set the speed and the power supply unit values on the EPSON TM-T88V to the values of 13 and 3 (speed and PSU). I have been using the provided commands located here on EPSON's Site. I am able to communicate with the printer by sending simple commands such as cut paper and line feed using hex in c# (using RawPrinterHelper), So I know I am able to connect to it. When I attempt to enter the user setup by using the values provided in their website, the printer seems to just "lock up". I have to rest the printer after about 2 minutes for me to be able to use it again. Thankfully, it doesn't seem like its writing anything at all to the printer, which is probably why it hasn't failed yet.
Does anyone have any experience changing settings to POS printer (specifically EPSON) who could help me with this? Usually there's a tool that will allow you to just send a .txt file with HEX values (like TPGs), but I cannot seem to find anything like that for EPSON POS printers. Any help would be greatly appreciated! Thank You
Try to reset a printer (ESC #) before start a user settings commands. It helped for me in the same case.
I'm new to the CE environment, I'm creating an application for a mobile computer with a barcode scanne that uses Windows CE 5.0 (Motorola mc3000).
I'm using VS 2008 and I'm programming with C#.
I made a litte demo project that it runs successfully on the device. My application have a scan task so it need to use the Barcode reader: Access to the scan hardware, make it run, read the returned result and display it into a textBox!
The problem is that I don't know how to integrate the scan part into my application.
Any help on this?
Well, first step would be to look in the documentation for the Motorola MC3000. I don't know if there is one for the MC3000 but I know that in the Motorola EMDK for .Net they provide quite a few sample C# VS2008 projects and a couple of them are for barcode reading.
Kobunite has posted you the first step. So go to the download page of the Motorola EMDK an watch the examples. After that you have to reference the Symbol.dll and Symbol.Barcode.dll in your project (local copy = true). Then you can begin to write your "barcode-class" with an event-handler for the scan-event. When a barcode is scanned via the hardware-trigger the event will throw an then you can place the barcode-string in your focused textbox or do something else with it (e.g. filtering in a datagrid). Hope this helps.
Just to simply scan a barcode there is a much easier solution.
By default the barcode scanner should also output into the keyboard cache.
To test it simply open a text editor and scan a barcode. If the barcode appears then you are good. You can simply use a normal textbox and make sure focus is on it.
The problem is however that you need a terminator. The easiest solution is to append the Carriage return symbol to any scanned value. Most handheld devices have a utility somewhere where you can append characters to scan. Appending '\r' (without quotes) works for most devices.
This means that you don't have to do a single thing extra on your code. Just make sure the textbox support keyboard input and starts processing when enter is pressed.
Motorola uses the utility called DataWedge. Here is a link to it's manual (PDF file). Look at page 5 for carriage return and line feed. DataWedge Manual (old but should still help)
The main advantage is that it allows the user to also use manual input in case the barcode is damaged. The disadvantage is that you lose the barcode metadata (i.e. barcode encoding type, etc.) But this is not required 99% of the time anyway.
I wish to execute a URL in the format
mapi://{S-1-5-21-1626573300-1364474481-487586288-1001}/toto#mycompany.com($b423dcd5)/0/Inbox/가가가가곕갘객겒갨겑곓걌게겻겨곹곒갓곅갩갤가갠가 , which I got from searching via Windows Desktop Search.
On Vista with Outlook 2007, this fails to open Emails if outlook is already open. Except sometimes, when it works for mysterious reasons.
Below are some things I've tried in an attempt to get this to work:
Executing it with Process.Start, or executing it with Process.Start via cmd.exe /c start. The former froze for a minute, then did nothing, with Process.Start returning null (except when Outlook was not already open, when it worked). The latter popped up an "Unspecified Error" message box.
Open mails in outlook from java using the protocol "mapi://"
I couldn't figure out how to get this script to work. The vbs scripts I generated claimed to have found invalid characters. Also, this solution makes me sad.
http://social.msdn.microsoft.com/forums/en-US/windowsdesktopsearchdevelopment/thread/00491710-e245-452f-8b0a-56caa56277e4/
I suspect this solution will work. However, I couldn't get it working in C++ or C# due to compiler errors. This is a matter of not being sure which libraries to include or in C# how to effectively use ShellItem2 etc. with interop.
Creating application shortcut in a directory
I tried creating a shortcut and calling Process.Start on that. This also did not work, though the shortcut itself worked when I double-clicked on it.
Turns out the issue was a UAC issue. I tend to run VS as admin, since some apps need it.
Does anybody have a known reliable way to create a video from a series of image files? Before you mod me down for not searching for the answer before posting the question, and before you fire off a simple message like "use FFMPEG," read the rest of this message.
I'm trying to create a video, it doesn't matter too much what format as long as it's widely supported, from a series of images (.jpg, .bmp, etc.). My platform is Windows Server 2008, 64-bit. If I can make the video from within my C# program, that's great, but I'm not averse to writing a series of image files to a directory and then firing off an external program to make a video from those images.
The only constraints are: it must work on my Windows Server 2008 system, and be scriptable. That is, no GUI programs that require operator intervention.
I found a number of similar questions on StackOverflow, and have tried several of the solutions, all with varying degrees of frustration and none with anything like success.
FFMPEG looks like a great program. Maybe it is, on Linux. The two Windows builds I downloaded are broken. Given this command line:
ffmpeg -r 1 -f image2 -i jpeg\*.jpg video.avi
One of the builds reads the images and then crashes due to data execution prevention. The other reads the first file and then spits out an error message that says "cannot find suitable codec for file jpeg/image2.jpg". Helpful, that. In any case, FFMPEG looks like a non-starter under Windows.
One answer to a previous posting recommended Splicer . It looks like pretty good code. I compiled the samples and tried to run, but got some cryptic error message about a file not found. It looks like a COM class isn't registered. I suppose I need to install something (DirectShow, maybe, although I thought that was already installed?). Depending on what's required, I might have a difficult time justifying its installation on a server. ("What? Why do you need that on a server?")
Another answer suggested the AviFile library from Code Project. That looks simple enough: a wrapper around the Windows AviFile subsystem. Except that the AVI files the package creates appear to have all of the frames, but only the first frame shows when I play the AVI in Windows Media Player. Well, that and if you try to create a compressed video, the program throws an exception.
So, I'm left wondering if there is a good, reliable way to do what I want: on a Windows system, create an AVI or other common video file format from a series of images, either through a .NET API or using an external program. Any help?
After working with it a while and taking a look at x264 and VideoLan, I went back to Splicer. It turns out that the cryptic error message was due to an error in my code.
It looks like Splicer will do what I want: programmatically create videos from a series of images.
Thanks to all who responded.
You can use VideoLan and I'd recommend it.
I've had direct experience in a C# application with VideoLan doing these two things:
Embedding a VLC viewer in my C# application (there are 3-4 C# "wrappers" for the VLC veiwer).
Using vlc.exe in a separate Process by sending it command-line arguments.
The fact that VideoLan has a command-line interface is a great thing. And VLC supports a command-line option that disables any visual element; so the VLC GUI doesn't pop up and neither does a command-line window. Thus, in a C# application you can farm out the video-related work to the VLC client. C# has the Process class which can manage your vlc.exe instances for you. It ends up being a pretty neat solution.
The handling of video on Windows (encoding and playback) is a real quagmire. And .NET isn't going to help you at all - you're always going to be either PInvoking/COM-interoping native APIs or using a .NET wrapper that someone else has built to do the same.
Anyway, I can't say I've used it, but a good bet seems to be the x264 library that is part of the videolan project. That gives you a self-contained C library that you can PInvoke and you don't have to worry about installing and DirectShow garbage on your server. It'll generate H.264 format video which is playable in Flash as I understand it.
I've used mplayer's mencoder to create AVI (with codecs msmpeg4/mp3, readable by default with Windows Media Player) from TGA files on linux like this:
mencoder mf://*.tga -mf fps=25:type=tga \
-audiofile /tmp/test.mp3 -oac copy \
-of lavf -ovc lavc \
-lavcopts vcodec=msmpeg4v2:mbd=2:mv0:trell:cbp:last_pred=3:vbitrate=3000 \
-o /tmp/test.avi
I know mplayer does have a Windows version.
Instead of just going through all the hassle, you could coppy all the images that you want to be included in your video to the clipboard and have it imported into Windows Live Movie Maker (dynamically, of course!) and have it compile for you!
All of this CAN be done through code, but this way, you don't have to create it yourself. As you said that the platform was Windows, and ALL Windows comps have Windows Live Movie Maker installed, so it shouldn't be a problem for anyone using your application unless
a) They uninstalled Windows Live Movie Maker
b) They are using a computer running on a Windows Version more than 8 or 9 years old...