You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Thorsten Schöning <ts...@am-soft.de> on 2019/02/05 17:14:28 UTC

PrintPDF doesn't support 1:1 printer name matching

Hi all,

I'm using multiple printers following some naming scheme regarding their
purpose, like the following:

* FreePDF
* FreePDF - SomeProfile
* FreePDF - SomeProfile2
* PDFCreator
* PDFCreator - ...
* ...

When using the argument "-printerName FreePDF" on the shell, one of
the printers using an additional profile is used to actually print
instead of the one I expected. The reason is that printer names are
not matched 1:1 or using some glob syntax or whatever, but using
"contains":

> if (printService[i].getName().contains(printerName))

https://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PrintPDF.java?view=markup#l157

Looking at the history of those lines, this seem to have been the case
ever since moving the project to Apache.

https://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PrintPDF.java?annotate=682412&pathrev=1852674#l125

At least I don't know of any application behaving the same way,
printer names are either matched 1:1 or, if at all, some glob syntax
or regular expression is supported optionally. The current behaviour
would force me and my customers to rename printers and in my opinion
is totally unexpected. It's not even documented that way:

> -printerName <name>             Print to specified printer.

Which is wrong, it's more or less printing to some arbitrary printer
containing the name somewhere and without any documented ordering
and stuff. :-)

So, is that considered a feature or a bug?

I vote for the latter and would like to see that fixed. If "contains"
is really needed, implementing optional support for globs or regular
expressions with proper documentation should be the way to go. Else
1:1 matching is least surprising for most users in my opinion.

Thanks!

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail: Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: PrintPDF doesn't support 1:1 printer name matching

Posted by Tilman Hausherr <TH...@t-online.de>.
Thanks,
https://issues.apache.org/jira/browse/PDFBOX-4456
created.

Tilman


Am 05.02.2019 um 18:14 schrieb Thorsten Schöning:
> Hi all,
>
> I'm using multiple printers following some naming scheme regarding their
> purpose, like the following:
>
> * FreePDF
> * FreePDF - SomeProfile
> * FreePDF - SomeProfile2
> * PDFCreator
> * PDFCreator - ...
> * ...
>
> When using the argument "-printerName FreePDF" on the shell, one of
> the printers using an additional profile is used to actually print
> instead of the one I expected. The reason is that printer names are
> not matched 1:1 or using some glob syntax or whatever, but using
> "contains":
>
>> if (printService[i].getName().contains(printerName))
> https://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PrintPDF.java?view=markup#l157
>
> Looking at the history of those lines, this seem to have been the case
> ever since moving the project to Apache.
>
> https://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PrintPDF.java?annotate=682412&pathrev=1852674#l125
>
> At least I don't know of any application behaving the same way,
> printer names are either matched 1:1 or, if at all, some glob syntax
> or regular expression is supported optionally. The current behaviour
> would force me and my customers to rename printers and in my opinion
> is totally unexpected. It's not even documented that way:
>
>> -printerName <name>             Print to specified printer.
> Which is wrong, it's more or less printing to some arbitrary printer
> containing the name somewhere and without any documented ordering
> and stuff. :-)
>
> So, is that considered a feature or a bug?
>
> I vote for the latter and would like to see that fixed. If "contains"
> is really needed, implementing optional support for globs or regular
> expressions with proper documentation should be the way to go. Else
> 1:1 matching is least surprising for most users in my opinion.
>
> Thanks!
>
> Mit freundlichen Grüßen,
>
> Thorsten Schöning
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org