Command Line Printing - Adobe Reader and GhostScript - reporting-services

I am trying to use command line printing for some of my reports created using SSRS to a network printer.
Not able to get any successful results, after some testing on Windows command prompt. Without any error message given, I have no idea whether I am heading the right way or not.
Using Adobe Reader
Not working
C:\>"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" /t "e:\temp\1.pdf" \\printserver\myprinter
but when I try to use Adobe, open the file and print manually, it works.
Using GhostScript
Not working
C:\>"C:\Program Files\gs\gs9.18\bin\gswin64.exe" -dPrinted -dBatch -sOutputFile="\\\printserver\myprinter" "e:\temp\1.pdf"
Do I need to install network printer driver on my server ? or my command line is incorrect ?
Thanks ...

Related

How to view a CSV file in a windows command prompt itself?

The linux command for viewing csv file in terminal is:
cat filename.csv
What i use in a windows command prompt for the same thing
I can open the csv file in excel through cmd but i can't view it in the cmd.
I searched a lot and couldn't get..
For simply viewing a file, use the more command for better control, and it works on both Linux and Windows.
In Windows, in the command prompt you can simply use the type syntax to display the csv file content:
c:\>type [filename.csv]

How to run a program from Files, coded using MonoDevelop, Gtk#, Ubuntu

I wrote my HelloWorld.cs using MonoDevelop, and Gtk# 2.0. It runs fine in the debugger, and it builds HelloWorld.exe. When I run from a terminal window "mono ./HelloWorld.exe" then the program runs as expected so I know it is coded as expected. However when I attempt to run it by double clicking on it from Files (Linux version of Windows Explorer) it opens Archive Manager with an error "An error occurred while loading the archive".
I am using Ubuntu 18.04.02 LTS, if that makes a difference.
I tried creating a link "ln -s ./HelloWorld.exe ./meow", and double clicked on meow, however that also opens Archive Manager with the same error.
I don't want my end product to require the user to open a Terminal window to run my program, what do I do so that the user can double click on my program from Files to run?
EDIT: [18FEB2019]
Thanks Some programmer dude, I like the bundle idea as I may port this project to a different flavor of linux and I hope this gives me a path to get there.
However, I got error:
Failure to load i18n assemblies, the following directories were searched for the assemblies:
Path: .
In Custom mode, you need to provide the directory to lookup assemblies from using -L
ERROR: Couldn't load one or more of the i18n assemblies: Failed to load I18N.dll
I searched and found
https://www.mono-project.com/docs/tools+libraries/tools/mkbundle/
I followed those directions and got stuck at this part
mkbundle -o CacheServer --cross mono-5.8.0-ubuntu-16.04-x64 CacheServer.exe --machine-config /etc/mono/4.5/machine.config
my error is
ERROR: Unable to load assembly `gtk-sharp' referenced by `/home/amccombs/Projects/HelloWorld/HelloWorld/bin/Debug/HelloWorld.exe'
I tried
mkbundle --fetch-target gtk-sharp
with result
Failure to download the specified runtime from https://download.mono-project.com/runtimes/raw/gtk-sharp
I then tried
sudo apt-get install gtk-sharp
with result
E: Unable to locate package gtk-sharp
Files is detecting the .exe extension as an archive, and therefore it opens it with File Roller or similar.
Just right-click the file HelloWorld.exe and select "Open With Other Application", click on "Find New Applications", and then type "mono" and press ENTER. The app will open.
Another possibility is to create a .desktopfile, and place it under ~/.local/share/applications, with this contents:
[Desktop Entry]
Exec=mono %F
MimeType=application/x-ms-dos-executable;
Name=mono
NoDisplay=true
Type=Application
MKBundle creates a native app from a mono application. The downside is that you have to compile both the app and all its dependencies, which can be tricky. In any case, the package you are looking for is gtk-sharp2.
An alternative to MKBundle is to include a text file, say HelloWorld.sh with the contents:
mono HelloWorld.exe
And then make it executable with:
chmod +x HelloWorld.sh
You can then pack both files together (use a .tar.gz target, which preserves attributes such as the executable one), and probably with a README file explaining to double-click HelloWorld.sh.
Or maybe you can pack the .exe with the .desktop file, and explain in the README file where it must be placed.
There are tons of possibilities.

Unable to download json data table

I'm trying to get/download data, seen on this page:
https://80.95.112.246/aplikace/monras/tabulky/svz.json?id=1159
using linux command line tools (ubuntu server, no display, no gui, remote ssh connection only). I've tried every possible tool without success (including PhantomJS). The only way I was able to get the numbers from the table was Firefox "save complete page" on a Windows PC.
Can someone help me with this? I need to store the table data in a text file on the server.
If your goal is simply to save the file onto the machine, run:
curl https://80.95.112.246/aplikace/monras/tabulky/svz.json?id=1159 -o svz.json
The downloaded file will be saved as svz.json in the current directory.

InstallShield 2014, Custom Actions and executing sql files into MySQL

I am building an installer for our product which works well. I've managed to build custom actions to install our services including a MySQL server.
The problem I have is executing a sql file to build the schema structures.
I have a custom action which uses mysql.exe and the command line arguments:
--port=### --user=### --password=### < "[INSTALLDIR]db\EmptyStruct.sql"
It tries to execute this ok but the cmd window which pops up, during the install, just runs through the mysql.exe command line options, which says to me that the command line it gets passed is not correct. However if I run the command manually after the install, it works perfectly.
Does anyone has any ideas please.
I'm making a few assumptions here:
You have a Windows Installer exe custom action that specifies mysql.exe and a command line as you showed
You are expecting the contents of [INSTALLDIR]db\EmptyStruct.sql to be redirected to mysql.exe's standard input
This will not happen. Behind the scenes, Windows Installer's exe custom action support uses the CreateProcess API and this API will interpret command lines literally. However the redirect < needs special handling to actually perform redirection.
To get that behavior, you must use a layer of indirection. For example, you could run cmd.exe as the exe, and give it a command line that will make it interpret and run the command line mysql.exe --port= ... < "[INSTALLDIR]...". However, if you didn't already have a command prompt showing, this would cause one to show up. If you want to avoid that, you could write a custom wrapper that performs the redirection for you, either as a C++ DLL or, say, InstallScript action.
Alternately, if there is a parameter that tells mysql.exe to run a script from a file, you could pass that instead of using redirection. I wasn't able to find evidence of such a parameter in a quick web search.
Thanks for your comments Michael and I used cmd.exe /k AddStruct.bat to accomplish the task!

CUPS printing of PDF files

How can I tell the lpr command (CUPS) that my file is actually a PDF?
lpr file.pdf
won't print anything.
Is this really the CUPS-based lpr, or is it a remnant of another spooling system which was not removed before installing CUPS?
Check it by running ldd $(which lpr) and see if there is any reference to libcups.
Also, the complete command should be:
lpr -P printername file.pdf
For a correctly and completely installed CUPS you'd not need to tell it the file type you send to print. It will "auto-type" the input, and apply the right conversion filters to make it digestable by the target printer.