Rendering Postscript data to HDC - windows

I am working on a win32 application. In this application I want to display postscript data on the window DC.
Please, can anyone suggest how to do so?

PostScript is an interpreted programming language, so you can't 'display PostScript data'. You need to execute the program by using a PostScript interpreter.
Which PostScript interpreter you use is up to you, it will depend on whether you are prepared to pay for a commercial interpreter, or can abide by the GPL open source licence.
If you are happy to use GPL software, then I suggest Ghostscript, the simple application for Windows even uses win32 API calls to do pretty much what I think you want, so you can use it as a working example.

Related

How can i make an basic GUI application in PostScript

I have searched in google regards the GUI application for postscript. I was redirected to this page https://www.whoishostingthis.com/resources/postscript/
And got some tools name which is mentioned below:
1)ImageMagick-(Installed successfully,But not working)
2)Pslib- Library
3)Gnuplot- A command-line graphics and data visualization tool
4)Cairo- Library
5)GNUEnscript-Tool which is used to convert ASCII files into PostScript files
6)GNU a2ps- Any to PostScript filter
Please Guide me from here,To make an GUI application in PostScript
Thanks in advance..
There are a few options and a lot of caveats. As Ken rightly says, PostScript has a limited scope for interacting with the operating system. There are a few technologies that extended the basic PostScript environment for GUI applications, namely NeWS (from Sun) and Display PostScript (from Adobe). While these worked somewhat differently, PostScript was primarily intended to be an output-only component of a larger application using the C API.
Some options for a similar kind of setup would be running ToastScript as part of a larger Java application. Or maybe scripting ghostscript with TCL or Python.
Without a lot of extra work, you can use ghostscript for graphical output as long as the input comes from the terminal. Eg. my Mandelbrot Set program.

Windows programmable virtual printer "device"

I have no idea how this windows service called or how should I tag it.
But I have seen around some software driven printing devices/configurations at windows, like Send to OneNote or Convert to PDF (from different pdf applications).
So I want to create one like this myself, lets say a virtual printer device that converts documents into PDF file.
How it called? Where I can find some information about it ?
Thank you.
A lot of these applications (on Windows) actually use the built-in Windows PostScript printer driver to produce a PostScript program from the application.
That is then sent to a virtual printer (in versions of Windows before Windows 10, a Port Monitor is used) which stores the program on disk. It then starts up a PostScript interpreter which is capable of creating a PDF file from a PostScript file. Notably these include Adobe Acrobat Distiller, the JAWS PostScript interpreter and Ghostscript. Because Ghostscript is open-source, it is probably the most widely used.
The alternative approach is to write a printer driver. This needs to accept OS native drawing operations (which differ according to the operating system) and then produce PDF equivalents for those drawing operations, and wrap the whole thing up as a PDF file.
The first solution is easiest, because it leverages the work other people (the OS vendor and the PostScript interpreter vendor) have done. The latter is, I think you'll find, much harder.
Of course, since Windows and MacOS can both now produce PDF files, it seems somewhat redundant to implement these now.

Writing a GUI for a Forth application

I was asked by a friend to write a simple GUI containing some charts and selections of common commands for an application he wrote in Forth. However, I have basically zero knowledge about Forth, only that you can't write a GUI in this language (at least that's what he told me).
Now I've been wondering what other programming languages you would suggest which do interact well with Forth and provide libraries (e.g. Java Swing) for interface programming?
Note: I'm still a beginner in programming, and my experiences so far are limited to Java, HTML, CSS, JavaScript, and some C#.
Win32Forth comes with complete Windows GUI and words to use all user32.dll and gdi32.dll functions. It also has a great development environment and windows form creator and editor. Very easy to create user interfaces with it.
SP-Forth allow developing applications with GUI and library WinLib: http://spf.sourceforge.net/ UI libs: http://spf.sourceforge.net/docs/devel.en.html#ui
I would suggest XHTML and Co. (i.e. CSS, JavaScript, XSLT, HTTP) to create user interface (GUI) and interact with Forth. In most general case you include an http-server into Forth system. In some special cases a Web browser object can be embedded into Forth application (for example, using COM on Windows).
Also on Windows you can use HTA (HTML Application) — quite simple solution. HTA can be started from Forth as well as Forth from HTA.
Another way is to use Qt framework (some Forth systems can have bindings).
Yet another way — just use API to underlying system (like user32.dll and gdi32.dll on Windows). Some Forth systems contain GUI-libraries that are based on underlying system API.
Also as edge case, user interface can be implemented in any language as shared library or as separate process with IPC (inter process communication) to Forth system.
In any case, usually GUI is created using special languages, libraries or APIs. GUI is not a subject of Forth as general-purpose programming language.
Bernd Paysan's MINOS may be a way to write GUI code in Forth:
https://bernd-paysan.de/theseus/minos-1.html
Adding a GUI to a program written in Forth is no different from the same problem in any language. You either have to write graphic code yourself or be able to call graphic libraries. In both cases on e.g. MS-windows you have to call functions present in DLL's and you need the documentation of those functions. Most serious Forth's allow to call DLL's. Of course libraries that are internal to a different language are less easily used, but why would you want to? You then commit to that language and are better off using that language from the get-go.
Forth being an interpreter you can couple a plot program easily via a pipe, but that is a one way street. It may be viable if the plot program has the interaction ( such as enlarge, change scale, crop, print etc.) you need.

difference between ghostscript and ghost4j

i want to repring pdf files in Java application.
I found that ghostscript has Java library - ghost4j.
Do you have any experience with it - is ghost4j is as good as ghostscript ?
Thanks
Ghostscript does not have a Java library.
Ghost4J is a wrapper around Ghostscript (written in C) which makes it accessible from Java. This is not supplied nor supported by Artifex and is not part of 'Ghostscript', its an addition by a 3rd party developer.
That said, since it actually uses Ghostscript, it is potentially 'as good as Ghostscript', but it may well not expose the entire set of functionality.

Creating GUI for linux CLI

I am a final year computer engineering student. As my final year project, I have decided to create a multimedia encoder for linux, possibly cross platform.
My question is: How can I create a GUI for ffmpeg (i.e. how can I pass command line arguments from the GUI)?
I am trying to use QT for cross platform development.
Tcl/Tk was designed to embed scripting into C programs and is probably the easiest of any language to do this with. It has several mechanisms for doing this embedding. The API makes it very easy to retrofit it to command-line C programs using argv as it has calls for converting native Tcl data structures to and from char**. It also has GUI toolkit called Tk that is somewhat basic but very easy to use and substantially more flexible than you might think.
In your case, the two mechanisms you would probably use in Tcl are the embedding where you just call main with the arguments passed from your Tcl program. The other is to fork the process with appropriate command line args and wait for it to complete. Both are fairly easy to accomplish with Tcl.
I'm not aware of any QT bindings for Tcl but it is very portable and Tk can be themed thesedays so it doesn't look like a 1990 vintage Motif app.
Se this posting for a more in-depth discussion of the topic.
Do you want to call ffmpeg from within your application? If so, look at QProcess. You can even capture the stdout and stderr streams from the ffmpeg process and use that information to (for example) drive a progress bar or display errors.
If you actually want to embed one GUI application inside another, that's a lot harder, especially to do in a platform independent manner.
The Red Hat folks use Python and pyGTK to write their CLI GUI's.
Blog posting: http://www.oreillynet.com/onlamp/blog/2008/02/red_hats_emerging_technology_g.html

Resources