The new CUPS-DDK-generated PPDs do not contain lines to handle custom page sizes any more

Bug #264727 reported by Till Kamppeter
6
Affects Status Importance Assigned to Milestone
HPLIP
Fix Released
Undecided
Unassigned
cupsddk (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

To allow the user to use custom page sizes via

lpr -P <perinter> -o PageSize=Custom.15x20cm <file>

The PPD must contain the follwing lines:

----------------------------------------------------------------
*HWMargins: 18 36 18 9
*VariablePaperSize: True
*MaxMediaWidth: 100000
*MaxMediaHeight: 100000
*NonUIOrderDependency: 105 AnySetup *CustomPageSize
*CustomPageSize True: "pop pop pop pop pop
%% FoomaticRIPOptionSetting: PageSize=Custom"
*End
*FoomaticRIPOptionSetting PageSize=Custom: " -dDEVICEWIDTHPOINTS=0 -dD&&
EVICEHEIGHTPOINTS=0"
*End
*ParamCustomPageSize Width: 1 points 36 100000
*ParamCustomPageSize Height: 2 points 36 100000
*ParamCustomPageSize Orientation: 3 int 0 0
*ParamCustomPageSize WidthOffset: 4 points 0 0
*ParamCustomPageSize HeightOffset: 5 points 0 0
----------------------------------------------------------------

They were in the PPD when they were still generated by Foomatic. The new PPDs generated by CUPS DDK do not contain these lines any more and so the support for custom page sizes got lost. This is a regression.

Revision history for this message
David Suffield (david-suffield) wrote :

Till, I do agree with you not all "custom page size" attributes in the foomatic generated PPDs are in the DRV generated PPDs.

This may be a issue but, your "lpr -P <perinter> -o PageSize=Custom.15x20cm <file>" command example does work OK with DRV generated PPDs.

For example the following command printed ok on FC9. Both old foomatic and new DRV PPDs gave the same results.

lpr -P psc750 -o PageSize=Custom.4x7in 4x7.ps

-dave

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

The backend/server side does not really need these lines. foomatic-rip already recognizes the availability of a custom page size by a choice named "Custom" in the "PageSize" option and uses the command line snippet of this choice as the template.

But please add these lines anyway, as applications or printing dialogs will need them to recognize the availability of a custom page size, the margins for custom page sizes, and the range in which the custom size can be selected.

Revision history for this message
David Suffield (david-suffield) wrote :

The CUPSDDK can create the following PPD attributes, but not with the foomatic-rip CustomPageSize specific attribute.

*MaxMediaWidth: "612.00"
*MaxMediaHeight: "3168.00"
*HWMargins: 18.00 36.00 18.00 36.00
*CustomPageSize True: "pop pop pop <</PageSize[5 -2 roll]/ImagingBBox null>>setpagedevice"
*ParamCustomPageSize Width: 1 points 72.00 612.00
*ParamCustomPageSize Height: 2 points 288.00 3168.00
*ParamCustomPageSize WidthOffset: 3 points 0 0
*ParamCustomPageSize HeightOffset: 4 points 0 0
*ParamCustomPageSize Orientation: 5 int 0 0

I would be happy to add the above lines, but unfortunately foomatic-rip does not like the CustomPageSize attribute that is not foomatic-rip specific.

-dave

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Is it not possible in CUPS DDK to inject any constant lines into the PPD, like

*HWMargins: 18 36 18 9
*VariablePaperSize: True
*MaxMediaWidth: 100000
*MaxMediaHeight: 100000
*NonUIOrderDependency: 105 AnySetup *CustomPageSize
*CustomPageSize True: "pop pop pop pop pop
%% FoomaticRIPOptionSetting: PageSize=Custom"
*End
*FoomaticRIPOptionSetting PageSize=Custom: " -dDEVICEWIDTHPOINTS=0 -dD&&
EVICEHEIGHTPOINTS=0"
*End
*ParamCustomPageSize Width: 1 points 36 100000
*ParamCustomPageSize Height: 2 points 36 100000
*ParamCustomPageSize Orientation: 3 int 0 0
*ParamCustomPageSize WidthOffset: 4 points 0 0
*ParamCustomPageSize HeightOffset: 5 points 0 0

or perhaps even constant lines with some parameters, like margins and min/max paper dimensions?

Revision history for this message
David Suffield (david-suffield) wrote :

It seems with CUPSDDK there are only two ways to implement custom page size:

*HWMargins: "18 36 18 9"
*CustomPageSize True: "pop pop pop pop pop
%% FoomaticRIPOptionSetting: PageSize=Custom"
*End
*FoomaticRIPOptionSetting PageSize=Custom: " -dDEVICEWIDTHPOINTS=0 -dD&&
EVICEHEIGHTPOINTS=0"
*End

or

*MaxMediaWidth: "612.00"
*MaxMediaHeight: "3168.00"
*HWMargins: 18.00 36.00 18.00 36.00
*CustomPageSize True: "pop pop pop <</PageSize[5 -2 roll]/ImagingBBox null>>setpagedevice"
*ParamCustomPageSize Width: 1 points 72.00 612.00
*ParamCustomPageSize Height: 2 points 288.00 3168.00
*ParamCustomPageSize WidthOffset: 3 points 0 0
*ParamCustomPageSize HeightOffset: 4 points 0 0
*ParamCustomPageSize Orientation: 5 int 0 0

I cannot mix these two choices. It's either one or the other. CUPSDDK will not allow me to set MaxMediaWidth, MaxMediaHeight and ParamCustomPageSize manually.

For foomatic-rip based PPDs I assume only the first choice is valid. I can add the extra two lines if you want (ie: HWMargins and CustomPageSize).

-dave

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

I had a look into the source code of the PPD generator of CUPS DDK, and the PPD generator actively blocks out certain keywords from being manually introduced with the "Attribute" directive in the .drv file. One of these blacklisted cases is all keywords beginning with "*ParamCustom". See the file ppdc/ppdc-driver.cxx, function ppdcDriver::write_ppd_file(), lines 515-536 in the CUPS DDK package.

So it is absolutely impossible to create a custom page size section as we had generated with Foomatic. To have "*ParamCustomPageSize" keywords one is forced to have the

*CustomPageSize True: "pop pop pop <</PageSize[5 -2 roll]/ImagingBBox null>>setpagedevice"

line.

If one looks into ppdc/ppdc-driver.cxx, function ppdcDriver::write_ppd_file(), lines 862-874 one gets the impression that one can define the "*CustomPageSize True: ..." line in the .drv file, but there is no directive available for .drv files which populates the variable custom_size_code. The method to populate the variable, ppdcDriver::set_custom_size_code() is never called in the whole source code of CUPS DDK. This is a bug in CUPS DDK which prevents its suitability for providing custom page size functionality for arbitrary drivers, especially for drivers which are flexible in taking PostScript or PDF as input.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

In CUPS 1.4.x the PPD generator ppdc will be part of CUPS and the separate CUPS DDK will be discontinued. The PPD generator there will allow "*ParamCustom..." keywords to be introduced by Attribute directives in the .drv files, but the the bug of the missing directive for the "*CustomPageSize True: ..." code is still present.

It would be very simple and elegant to define custom page size support in the .drv file with

  VariablePaperSize yes
  MinSize 72.00 288.00
  MaxSize 612.00 3168.00
  CustomSizeCode "pop pop pop pop pop
%% FoomaticRIPOptionSetting: PageSize=Custom"

but the "CustomSizeCode" directive does not exist (yet).

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

The mentioned CUPS DDK bug can be easily fixed by applying the attached patch to CUPS DDK. Then the above-mentioned lines indeed produce the desired lines in the PPD file:

*MaxMediaWidth: "612.00"
*MaxMediaHeight: "3168.00"
*HWMargins: 0.00 0.00 0.00 0.00
*CustomPageSize True: "pop pop pop pop pop
%% FoomaticRIPOptionSetting: PageSize=Custom"
*End
*ParamCustomPageSize Width: 1 points 72.00 612.00
*ParamCustomPageSize Height: 2 points 288.00 3168.00
*ParamCustomPageSize WidthOffset: 3 points 0 0
*ParamCustomPageSize HeightOffset: 4 points 0 0
*ParamCustomPageSize Orientation: 5 int 0 0

(To define non-zero default margins a line like "HWMargins 18 36 18 36" needs to be added to the .drv file)

To fix this in Ubuntu we could apply the patch to CUPS DDK and apply also a patch to HPLIP to define custom page size support as I described, but we must assure that this fix will also get applied upstream, so that HPLIP will work with all distributions.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Reported to CUPS DDK upstream:

http://www.cups.org/str.php?L2941

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Problem solved: See anser to the upstream bug report:

-----------------------------
he following will do what you want:

    Attribute CustomPageSize True "pop pop pop pop pop
%% Option Setting: PageSize=Custom"

In general, this works for any attribute/keyword you want to override in
the generated PPD file - ppdc/drv only provides its own version if you
don't.
-----------------------------

So the lines

  VariablePaperSize yes
  MinSize 72.00 288.00
  MaxSize 612.00 3168.00
  Attribute CustomPageSize True "pop pop pop pop pop
%% FoomaticRIPOptionSetting: PageSize=Custom"

will lead to the desired result.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Can you supply a patch which makes thes lines to be used in the .drv files for all device classes and with the correct minimum and maximum paper size values for each class? Thank you.

Changed in cupsddk:
status: New → Invalid
Revision history for this message
David Suffield (david-suffield) wrote :

I'm not sure the problem is solved with the above update. Now there are two "CustomPageSize True" attributes in the PPD. See the attached test.drv.

Run

ppdc test.drv

Then look at the PPD file result.

-dave

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Found it also and informed Mike Sweet. He tells that he did a lot of fixes on the ppdc after CUPS DDK 1.2.3, which means that they get released with CUPS 1.4. WDYT, should I backport the CUPS DDK fixes for Intrepid then? But this would mean that one gets only correct HPLIP PPDs with CUPS 1.4 for non-Intrepid distros ...

Revision history for this message
David Suffield (david-suffield) wrote :

I don't want to make changes to hpijs.drv that only work on CUPS 1.4. This would be problematic supporting older distros.

There are two possible options for CustomPageSize attribute.

1. *CustomPageSize True: "pop pop pop pop pop FoomaticRIPOptionSetting: PageSize=Custom"

2. *CustomPageSize True: "pop pop pop <</PageSize[5 -2 roll]/ImagingBBox null>>setpagedevice"

Since #1 is not needed by foomatic-rip, what apps currently need option #1?

Is not option #2 more standard?

-dave

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

The #2 does not break anything. If the input stream is PostScript and if it gets inserted into the input data stream it does not break anything. It sets the requested paper size by means of PostScript and Ghostscript understnds this and in our case (HPIJS) we feed the input stream directly into Ghostscript.

foomatic-rip should ignore the code of this line if "PageSize" is not a PostScript type option (for HPIJS "PageSize" is command line type). In general, foomatic-rip should prioritize the "*PageSize Custom: ..." and "*FoomaticRIPOption PageSize=Custom: ..." lines in the PPD file if present.

Please check with foomatic-rip 3.x (all distros except Ubuntu Intrepid) and foomatic-rip 4.x (Ubuntu Intrepid). In foomatic-rip 4.x I have already found a problem, http://bugs.linux-foundation.org/show_bug.cgi?id=171, Lars Uebernickel will fix it before Intrepid release, most probably next week.

Revision history for this message
David Suffield (david-suffield) wrote :

I want to verify our custom page size solution. I will add option #2 to the hpijs.drv. I have attached test2.drv which is an example of the fix. This example works with the foomatic-rip 3.x version we distribute with hplip. WDYT?

-dave

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

.drv file looks OK for me. If it works with foomatic-rip 3.x but not with 4.x, 4.x has most probably a bug. I will test next week and Lars will fix possible bugs in foomatic-rip 4.x.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

foomatic-rip 4.0 is fixed now (http://bugs.linux-foundation.org/show_bug.cgi?id=171) and uploaded to Intrepid. So testing of the fix of this bug is possible with Intrepid and the PDF workflow now. I have done a short test and it works for me.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

foomatic-filters needs to be at least 4.0.0~bzr167-0ubuntu1.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Applied patch to fix this bug in hplip 2.8.7-0ubuntu3. Please test.

Revision history for this message
neo (tkolodziejski) wrote :

I had submitted a question before reading this topic - https://answers.launchpad.net/hplip/+question/46428

After upgrading to Intrepid and downloading hplip 2.8.7-0ubuntu3 and foomatic-filters 4.0.0~bzr171-0ubuntu1 (from repo) the printer doesn't work as expected. Nothing changed.

Command:
lpr -P Photosmart-Pro-B8300-series -o PageSize=Custom.642x206mm -o scaling=100 -o landscape test.pdf

Produces only a4 print but I desperately need 1200mm long documents to be printed.

Changed in hplip:
assignee: nobody → kalosaurusrex
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.