[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: AW: [Kde-print-devel] Status of KDEprint in 4.0, and offer of help
From:       Kurt Pfeifle <k1pfeifle () gmx ! net>
Date:       2007-09-07 0:14:50
Message-ID: 46E097FA.8030404 () gmx ! net
[Download RAW message or body]

*ping* *ping* *ping* DavidFaure    (whose wife forces him to know
                                   stuff about Windows too :-)  )


Ralf Habacker wrote:
> One missing point:
>
> KPrintDialogPage does not now anything about windows printer, so
> people may think that using QPrintDialog would help.
> This helps to be able to select windows printers and all the other
> stuff like page selecting, page format and so on, but does not support
> application specific printer dialog extending (like umbrello does for
> diagram selecting) because QPrintDialog on win32 uses the native
> Printing Dialog  (PRINTDLG Api function).

You should also consider/investigate this alternative:

 ===========================================================
   Let KDE output PostScript (or PDF)
   Let kprinter "use external program" for printing
   (Add feature to let kprinter act without any GUI popup)
   Use Ghostscript to print to the Windows printer
 ===========================================================


Here is a high level implementation outline:

 * Ghostscript is also available on Windows (as we all know). And we all
   know that Ghostscript can consume PostScript and PDF as its input file
   formats... one (or both) of which KDE4 applications can generate easi-
   ly.

 * Ghostscript for Windows has an 'output device' (this is how they name
   in Ghostscript what elsewhere is called a "driver" or a "filter")
   that is named "mswinpr2" (a selected GS device determines which of
   the available GS output formats to produce).

 * mswinpr2 however does not work independently to create the output --
   it uses the original MS Windows printer drivers. It is supposed
   to work with any printer that has device-independent bitmap (DIB)
   raster capabilities.

 * if you do not name a target printer when printing, Ghostscript will
   invoke the standard Print Setup dialog to prompt the user for the
   desired printer.

 * if you want to set the printername directly, you have to use a syn-
   tax like '-sOutputFile="%printer%Apple LaserWriter II NT"'

 * mswinpr2 supports another parameter, "-dNOCANCEL". If that is used,
   the standard progress/Cancel dialog is hidden (it shows percent of
   document already processed. "-dNOCANCEL" is useful to let GS print
   pages in the background without any user intervention/bothering).


Therefore, it appears to me that one feasible plan to make KDE apps
print on Windows is this:

 * compile KDEprint without CUPS support; such a support is useless
   in any case because there are no CUPS libs on Windows  (hmm...
   possibly you *can't* support it even if you wanted -- because it
   wouldn't build if you told it to link to a nonexistent library).

 * set kprinter to "Print Through an External Program", and specify
   as the print command then:

   gs -sDEVICE=mswinpr2 \
      -dNOCANCE \
      -sOutputFile="%printer%The Full Printer Name" \
      inputfile-originating-from-kdeapp.ps

   where "The Full Printer Name" must be typed exactly as displayed in
   the Windows control panel (Note, the "gs" executable may be named
   differently on Windows).

 * alternatively, you can use as the print command:

   gs setup.ps inputfile.ps

   where "setup.ps" is a special file containing the equivalent of
   above commandline parameters (see Ghostscript documentation for
   details), and then some more (see below).

It is left to the ingenuity of our KDE@Windows developers to find a
way for reading The Full Printer Name from the OS, somehow.


One step further (but not a big one) is this:
---------------------------------------------

 * add a little feature to KDEPrint that is on my personal wishlist
   already since 2002: ability to print without any dialog (it would
   use simply the "last known settings"). Would be useful for other
   purposes on Un*x platforms too...

 * the usefulness of this feature on Windows would be this:

    - 'last setting' would be to "Print Through an External Program"

    - commandline would be "gs setup.ps inputfile"

    - (setup.ps may be generated dynamically as needed)

    - setup.ps would have these contents:
      "
      mark
        /NoCancel          true      % don't show the cancel dialog
        /BitsPerPixel      4         % force 4 bits/pixel
        % alternative: /BitsPerPixel 1
                                     % 4 bpp is: CMYK w. screening by GS
                                     % 1 bpp is: monochrome
        % /OutputFile       The Full Printer Name
        /UserSettings
          <<
            /DocumentName 
            (KDE Printjob via Ghostscript)
                                     % name for Windows spooler to display
            /MaxResolution 600       % maximum document resolution allowed
          >>
       (mswinpr2) finddevice         % find required Windows device driver
       putdeviceprops
      setdevice
      "

      Notes: (1)
             since /OutputFile is commented out, Ghostscript will prompt
             the user for a Windows printer using the standard Print Setup
             dialog. After printer is chosen, that driver is used.

             (2)
             you could add the following lines too:
                /QueryUser 3          % silently uses default Win printer
                /QueryUser 2          % shows the printer setup dialog
                /QueryUser 1          % shows dialog for default Win printer
             inside "/UserSettings" you can also use:
                /DocumentRange [a b]  % define pagerange contained in doc
                /SelectedRange [c d]  % define pagerange to be printed
                                      % displayed in GUI; user-changeable

             (3)
             If the target Win printer supports duplexing, here's how
             to do it (put line into setup.ps):
                <</Duplex true /Tumble false>> setpagedevice
                <</Duplex true /Tumble true>>  setpagedevice

Letting Ghostscript/Windrivers create raster images for printing can
produce huuuuge jobfiles. Therefor the above /MaxResolution is quite use-
ful. With it, you can limit the jobsizes to a degree, even if the final
output device supports 1200 dpi or more...



P.S.: How are (the few) Gtk/Gnome programs that run on Windows handling
      their printing needs there?

-- 
Kurt Pfeifle
System & Network Printing Consultant ---- Linux/Unix/Windows/Samba/CUPS
Infotec Deutschland GmbH  .....................  Hedelfinger Strasse 58
A RICOH Company  ...........................  D-70327 Stuttgart/Germany

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic