[Poppler-bugs] [Bug 79936] Add support for printing to a Windows printer from pdftocairo

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Sep 16 07:09:49 PDT 2014


https://bugs.freedesktop.org/show_bug.cgi?id=79936

--- Comment #21 from rodrigo <rodrigorivascosta at gmail.com> ---
In reply to comment #20)
> (In reply to comment #18)
> > Interesting... I really don't what is this last call for. Maybe it is for
> > user selection validation, or something like that.  But that could easily
> > been done at `CreateDC()`...
> 
> I found another interesting example:
> 
> http://support.microsoft.com/kb/167345/en-us
> 
> I suggest we use this as a template for modifying the print settings.

>From the linked article, in a comment to the 3rd call to DocumentProperties():

    This gives the driver an opportunity to update any private
    portions of the DevMode structure.

So it is probably wise to call it. Anyway, I don't see nothing else
particularly interesting, except the use of `dmFields` to check for supported
functionality that directly contradicts the documentation:

    NOTE: A flag in a DEVMODE's dmFields member is only an indication that
    a printer uses the associated structure member. [...] To determine the
    supported settings of a DEVMODE's field, applications should use
    DeviceCapabilities().

Although information from (the old parts of) MSDN is usually accurate, the
sample code pieces
are not top quality. I would not trust them too much.

And I wouldn't bother using `DeviceCapabilities()`. If the user selects an
unsuported feature of the printer, it will either fail or print without that
feature. If we checked it, we would do more or less the same, so what's the
point? Being a CLI utility, not a GUI, I think that the uses is expected to
know what they are doing.

> > But now that we are into it, would it make sense to add a CLI option to show
> > the printer property sheet? That is, to call `DocumentProperties()` with the
> > `DM_IN_PROMPT` flag. I think that it could be done easily. Add the call from
> > step 5 of the reference doc, but just add the `DM_IN_PROMPT` flag iff the
> > `-prnproperties` (or whatever) option is used.
>  
> Interesting. But I would take it one step further and display the print
> dialog. Then the user can select the printer as well as change the print
> settings. eg -printdlg opens the print dialog.

Yeah, "-printdlg" would replace "-printer <printername>" but "-printproperties"
would be
a different option. It does not make sense to use "-print -printdlg
-printproperties" because the "Select Printer" dialog has a button to configure
the selected printer. But it does make sense to use "-print -printer "My
Printer" -printproperties" to show the "Properties" dialog of the given
printer, doesn't it?

> One problem would be the page size selection. On the command line not
> specifying the paper size means use whatever page size is in the PDF. This
> also supports printing PDFs with different page sizes (assuming the printer
> also has the different paper sizes available). Using the print dialog would
> require adding an extra option to the dialog to specify "select paper size
> using PDF page size".

AFAIK, adding an extra option to the properties dialog is next to impossible.
This dialog is created by the printer driver, so it is different for each model
of printer. There is no template to modify, as in `OpenFileDialog`. You could
use a dummy paper size as a flag, but that would be a horrible hack and I have
the impression that the printer driver will overwrite it anyway.

It will be much easier to add an option to the CLI: something along the lines
of `-prnignoresizefromdlg`. Or if you prefer the opposite `-prnusesizefromdlg`.

Alternatively, you could use the size from the dialog only if there is a paper
size in the command line. The option in the dlg would be initialized to the
value from the CL. If no paper size in the CL, then the paper size from the dlg
is ignored. Hackish, but I kind of like it.

I've just checked what MS-Word 2013 does: it ignores the selection of the paper
size in the Printer Properties Dialog and it uses whatever paper size is
configured in the document. But then, it does not have scale or cropping
options either...

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/poppler-bugs/attachments/20140916/6531fbd8/attachment-0001.html>


More information about the Poppler-bugs mailing list