• Skip to content
  • Skip to link menu
KDEPrint Homepage
  • KDEPrint Homepage / Overview / Command Builder
 
 

Command Builder

by Kurt Pfeifle, Network Printing Consultant, Danka Deutschland GmbH, <kpfeifle@danka.de>

"Filter Command Editor" -- using enscript & Co.

A first introduction and hints about its usage

A very versatile feature of the new version of KDEPrint is its new Filter Command Editor. This dialog allows an experienced power-user or a curious and daring newbie to setup any outside print-file filter for convenient use through a kprinter dialog. To provide you a kickstart in usage of those filters, KDEPrint ships with a sample of the most important filter configurations, prepared through the Filter Command Editor.

If you come up with other useful filters, or if you extend the basic features of our shipped configurations -- tell us, we are glad to include your good ideas into the KDEPrint filters!

Working for all print sub-systems

The KDE-shipped or your self-styled filter configurations work with all of the supported print subsystems -- regardless wether you use CUPS, RLPR, LPRng or standard LPD. Every one of the filters may be hooked to a certain or to several individual printers (or in the case of CUPS, to printer instance). The configurations may be saved for future automatic usage, or changed at any time. With CUPS, you can also create "instances" of a printer, which have a certain filter permanently attached to it. This way you have a far more convenient usage, as you just need to pick the instance and have everything set already..

NOTE: KDE does not ship the filters themselves, which are configured through the Filter Command Editor. It rather expects them to be present on your system. It offers a GUI confuguration frontend for them.

Purpose of filters

Any meaningful "filter" may be set up through the Filter Command Editor to run with kprinter for any printjob.

A print-filter is a program that takes any type of file and works on it to produced from the given input a modified output that is better fit (or preferred by you) for further print-processing. This could consist of scaling the pages, converting file formats, selecting specific areas to print, or extracting printable info from otherwise non-printable files (like MP3-tags from *.mp3-files). All what is needed is any input file format with an output that is feasible to print.

These filters are used at the first stage of KDEPrint job processing. Therefore we also call them "pre-filters".

Filter Command Editor: configuring enscript filter

Filter Command Editor resulting enscriptfilter

GUI frontend to commandline filters

In the case of the filter's actual presence in your system (its initiating command must be in your $PATH), KDE's pre-configuration leads to a convenient access of the most important filter options (if available) through a dialog. KDEPrint can plugin any of those filters into its first stage of printfile processing.

This construction allows you to easily integrate every single third-party-filter -- past, present of future -- into KDEPrint's framework. Imagine a filter appears somewhere in the Internet, which automatically converts MS Word files into a clean PostScript print file (yes, there are projects on the way to get there!): this could be used to print, through kprinter and its pre-filter mechanism, this sort of files without a need to open them in an application first...

How to use pre-filtering in KDEPrint

To call a pre-configured filter from kprinter (the KDEPrint printing dialog), just click on the "Properties..." button and select the "Filter" tab. An "empty" tab means, that there is no filter active. To activate a filter click on the top "funnel" icon. Now you can select one of "Enscript", "Pamphlet", "Imge to PostScript Converter", "Page Selection/Ordering", "PDF Writer" or "Multiple Pages per Sheet". Should you construct and save any of your own filters with the help of the Filter Command Editor, it will automatically appear in the list.

XML file holding the settings

Under the hood of the Filter Command Editor lies an XML file which is written from the configuration dialog. It holds the filter settings in a "tagged" datta structure, which in turn serves to create the user interface for the control of the filter when called via the "kprinter" --> "Properties..." --> "Filter" dialog.

The shipped configuration for the enscript filter may be found on your system at $KDEDIR/share/apps/kdeprint/filters/enscript.xml. As enscript is able to do a lot more than what is configured with the KDEPrint Filter Command Editor, we are encouraging you to send in a more complete enscript.xml file for future enclosure in KDE.

All other filter configurations are held in the same directory, $KDEDIR/share/apps/kdeprint/filters/. Look at them to find out more about how theywork. [There might be some other files in your $HOME/.kde3/share/apps/kdeprint/filters/ -- these are your personal copies, made when you edited the original ones; settings contained there override the system wide files].

Configure your own favorite filter

The "Filter Command Editor" principally works with any sensible external program. This program must be working from a command line and able to serve as a pre-filter to KDEPrint . Then the Filter Command Editor builds a GUI around it which can be plugged into KDEPrint. Instead of the usual commandline mode for such tools and utilities, with their various options, which would only be used separately from KDEPrint, with the help of the Filter Command Editor they can be made to work as a plugin into KDEPrint, with a seamless integration!

The Filter Command Editor allows you to modify or extend the shipped versions of KDEPrint filters on a per-user basis. Every user can construct his own filters, or have his own settings for the system-wide installed ones, without bothering other users.

commandeditor: creating a complete bogus magic filter...

kprinter: showing kurts magic filter as Special Printer

Putting "Filter Command" into "Special Printers"

A command build with the help of the Filter Command Editor can be made to appear amongst the "Special Printers" in the kprinter drop-down list of availble devices too.

For this to happen, go to the Print Manager (f.e. via "print:/manager/" as a konqueror URL), click on the "Add special (pseudo) printer" icon (the second from the left in the menu bar), tick the checkbox "Use command" and proceed to add your new command or select an existing filter from the drop-down list. Don't forget to fill in the name, description and location fields.

Ready-to-use filters shipping with KDE 3

Some fully working example filters (in fact, the most useful and commonly used) for usage in KDEPrint are shipping pre-configured in the KDE-3 release packages.

The enscript frontend provides a GUI for the well-known ASCII-to-PostScript filter. This filter's options are normally specified on the commandline. Enscript produces PostScript page description output from otherwise unformatted ASCII text input. It commands options to determine page size, portrait or landscape mode, page frames, pretty headers and footers, font sizes and much more. The enscript filter is pre-configured to be run commanded through a dialog which controls some of its basic features. The output of this filter can then be run through another filter (for example the pamphlet filter) or send to the print subsystem, accompanied by the general KDEPrint job options.

The pamphlet filter enables a user to produce this advanced output even from simplex-only printers. It does so by re-arranging and imposing individual pages in a different order automatically, selecting odd and even pages to print in two separate passes through the simplex-only printer, flipping the paper in between the pases.. Another version of this filter can be used with a duplex-capable printer: here one just needs to select the duplex option that flips the page along its short edge and the pamphlets just need to be folded when the printer ejects them. The pamphlet filter relies on and combines the functions of "psbook" and "psnup" for its purpose. Most users will find the usage of these two utilities on the commandline too difficult. Using them through the KDEPrint "pamphlet filter" interface is a snap...

How to use

The configured filters (the ones you create yourself as well as the pre-built ones shipping with KDE 3) are accessible when printing with kprinter. Click on "Properties...", then on the "Filter" tab, and select a filter by clicking on the "funnel" icon. Some filters show a GUI to setup their options by highlighting them and then clicking on the "hammer and wrench" icon at the bottom.

Other items shown are:

  • Name: the name of the filter as chosen in the "Filter Command Editor";
  • Requirements: a hint about the external filter program used for it to work;
  • Input: a list of all MIME-types the filter is taking as input;
  • Output: a MIME-type the filter is spawning as output.

Filter chains

Filters may be concatenated. The only condition is, that the ouput MIME-type of any filter will satisfy the MIME-type requirements of the next filter in the chain. You can construct a filter chain "enscript --> pamphlet" which produces a pamphlet printout from any input text. It works because enscript takes text and produces a straight series of PostScript pages, which are taken by the pamphlet filter to impose and scale those pages to make up the final product (PostScript) that can be printed by any duplex-capable device.

You can even construct a chain "enscript --> page selection --> pamphlet". This chain you to print from a long text document only selected pages, but layed out as a pamphlet.

[ Edit ]

Inform

Skip menu "Inform"
  • Home
  • KDE Home
  • News
  • Information
  • People
  • Mailing Lists
  • In The Media
  • Get Involved

KDEPrint

Skip menu "KDEPrint"
  • Overview
    • Command Builder
    • KJobViewer
    • KPrinter
  • Screenshots
  • Hacks

Documentation

Skip menu "Documentation"
  • FAQ
  • KDEPrint Handbook
  • Tutorials
  • User Contributions

Downloads

Skip menu "Downloads"
  • Downloads

Develop

Skip menu "Develop"
  • Developer Resources
  • Work plan

Global navigation links

  • KDE Home
  • KDE Accessibility Home
  • Description of Access Keys
  • Back to content
  • Back to menu

Search:


Maintained by printing.kde.org Webmaster
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal