Print from command line across platforms - printing

I have an appjs application that creates images but I need to print these images. I'm aware I could write a utility app in Adobe AIR which would do the print for me but I'm sure there is a way to open the target systems default print preview utility from a command line interface.
I have Googled and found lpr for the mac but I don't seem to be able to get this to work. I've tried
lpr /path/to/my/image.jpg
But this doesn't seem to work?
On Windows I can use
print /path/to/my/image.jpg
But I haven't tested this, is there a command available on the cli on both platforms that opens the system default print preview?

Even though you're using app.js could you still not use basic JS, like window.print();

I can confirm that using node-webkit directly is both MUCH easier and printing works.

Related

HH.EXE can show HTML/JPEG files

Apparently, one can view HTML and JPEG files (possibly others, didn't try), with HH.EXE, i.e. Microsoft's CHM file viewer.
Try "HH somefile.html". It was tested on Windows XP and Windows 10. Is this documented anywhere?
As far as I know this is not documented public but it comes as little surprise.
HH.exe is the HTMLHelp executable and associated with *.CHM files. It's just a shell that uses the HTML Help API and is really just hosting a browser window. That is the reason why HTML, JPEG, GIF and animated GIF works. Microsoft Help MVP's always knew that but it's not really useful. Example:
PS D:\_temp> hh.exe -800 images\welcome_small_big-en.gif
HH.EXE is not single instance, if you open a CHM or another file three times using HH.EXE, then three help windows will appear.
Several client-side command line switches are available to help authors that are part of the HTML Help executable program (hh.exe) and therefore work when HTML Help Workshop is not set up.
For further Informationen see my site at HTMLHelp command-line.

Excellent Sample but Export to PDF doesn't work locally in Chrome

I come across this beautiful example
plnkr.co/edit/xBvc4094CIu6oGDZXZx7?p=preview
When I download (changed // to http://) and run locally export csv works fine where as export to pdf doesn't work fine.
I suspect something needs to be enabled in Chrome browser or security settings.
Any idea what might be the issue? How to make it work in Chrome? Is there any setting or configuration needs to be fixed?
Line 26 :
pdfMake.createPdf(content).open();
Replace this line with this :
pdfMake.createPdf(content).download('your_pdf_name.pdf');

Using 'dart:io' in dartium ? Any work arounds?

I am new to dart and I am trying to read data from a file and use the contents to draw something canvas. In doing so I am running into 'The built-in library 'dart:io' is not available on Dartium ' issue.
I understand Dart has limitations as Javascript in that code that is running in a browser cannot natively access the File System of the running client.
At the same time are there any tips on how to read a file and also use the contents to write it to canvas?
Thanks in advance.
What kind of application are you trying to build?
If it runs in the browser the files are usually on the server.
If it is a normal web page you can't access user files. There is a sandboxed space accessible to be used by by the code of a webpage.
If you build something like a Chrome app you have less limitations.
You definitely can't import 'dart:io' when the could should run in the browser.
The APIs available in the browser can be found in 'dart:html'.
If you want to build a Chrome app this package provides access to the extended API http://pub.dartlang.org/packages/chrome
I fixed my problem by prompting the user to choose the file. Similar approach as in
https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications but using DART.

Make Firefox read profiles.ini from other location pre-startup

I'm making a Bootstrap addon.
On Firefox pre-startup I need to make it read a profiles.ini file from a custom path. Normally, it always tries to read profiles.ini at this location: OS.Path.join(OS.Constants.Path.userApplicationDataDir, 'profiles.ini');
On Windows XP it is:"C:\Documents and Settings\Noitidart\Application Data\Mozilla\Firefox"
Is it possible to make it read from another location?
Where profiles.ini is read from isn't exactly something you can influence. Given that no profile is selected at this point, your add-on obviously isn't active yet. Also, any preferences your add-on could write aren't active either because these would be stored in the profile as well. And if you look at the actual implementation - there is indeed no configurability here, the profiles.ini file is always looked up in userApplicationDataDir. On Linux you could manipulate that value by setting the HOME environment variable differently, this approach won't work on Windows or OS X however - OS functions are used to locate the home directory there.
So what you could do is bypassing profiles.ini completely by passing in -profile c:\foo\bar command line option when you run Firefox, this will make Firefox use the specified profile directory. Other than that there isn't much you can do.

How Can I Automatically Execute A Link In Internet Explorer

I am trying to create an application to print documents over the web. I have created my document, and made a web page with a meta refresh tag, along the lines of this:
<meta http-equiv="refresh" content="3;http://example.com/download.epl2" />
I specify that the document has a content-type of application/x-epl2, and I have associated .epl2 files on my computer with a program that silently sends them to the printer.
I have put the website into my trusted sites zone.
Currently Internet Explorer pops up the "Open, Save, Cancel" dialog box with no option to automatically open the file.
Is there a setting in IE6/7/8 that I can use to have IE just open the file without prompting?
EDIT
The actual content of the file will differ based on the job, but essentially it is text that follows the Eltron Programming Language.
EDIT
I have accomplished this in both Chrome and Firefox by choosing "Automatically Open Files Of This Type From Now On"
EDIT
The machines this program will be used on will effectively be kiosks that are limited to only accessing my website from their web browsers, so I'm not worried about rogue websites sending documents to my printers.
EDIT
I am using PHP to generate the documents and HTML on the server side, though I expect the solution to be language agnostic.
I would expect that not to be possible, because then you could stumble onto a site that automatically loads and prints a 5000 page document or something, which would not be good.
If you always had a secret desire to develop a custom URL protocol (I know I do), this might be a good excuse to do it. ;-)
http://msdn.microsoft.com/en-us/library/aa767914%28VS.85%29.aspx
There are 1-2 prompts when opening such a link for the first time in IE, but you can choose to automatically open them after that.
I would use javascript to make this happen.
Javascript Window Open
EDIT
Since you have control of the windows box you could use an automate script process to interact with the print window.
autoit3: ControlClick
Write a small utility program that does nothing but send the file passed to it on the command-line to the default system printer.
Then, edit the registry under HKEY_CLASSES_ROOT to associate this program with the .epl2 filetype.
I don't have time to investigate it for You, but there were lots of exploits that could be helpful. Using ie6 without certain fixes seems helpful.
Also there should be an option called "Automatic prompting for file downloads". I use Linux nowadays so I can't chceck if it helps. I found it in some docs.
I'm on a Mac at the moment, but if this is possible in IE I would imagine this page holds the answer to it (or at least hints at it) http://support.microsoft.com/kb/883255
I believe what you're looking for is a setting in Windows, not IE:
Microsoft Support: Not Prompted to Specify Download Folder for File
Try using an older version of IE. Security was looser in the older versions and since it's a non-issue, this could be the quickest solution.

Resources