Bug 706207 - gpcl6: -sPAPERSIZE=a4 has no effect
Summary: gpcl6: -sPAPERSIZE=a4 has no effect
Status: RESOLVED FIXED
Alias: None
Product: GhostPCL
Classification: Unclassified
Component: PCL interpreter (show other bugs)
Version: 10.0.0
Hardware: PC Linux
: P4 normal
Assignee: Henry Stiles
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-13 17:30 UTC by TrevorBl
Modified: 2022-12-14 13:40 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
zip file with a4 test pcl file and resulting letter pdf file (23.86 KB, application/zip)
2022-12-13 17:30 UTC, TrevorBl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description TrevorBl 2022-12-13 17:30:51 UTC
Created attachment 23593 [details]
zip file with a4 test pcl file and resulting letter pdf file

paper size defaults to US letter, as title can't set paper size to a4, paper size remains as leter..

Here's the command:
gpcl6 -sOutputFile=out.pdf -r300 -sDEVICE=pdfwrite -dNOPAUSE a4test.pcl

input & output files attached.
Comment 1 Ken Sharp 2022-12-14 09:45:52 UTC
The documentation is aimed at Ghostscript, not GhostPCL, and is a mixture of device parameters and interpreter parameters, with no real distinction drawn between the two in the documentation sadly.

While all the device controls should work with any interpreter, and all the interpreter controls work as described with Ghostscript, this is not the case for all the other language interpreters.

Unfortunately the documentation for PAPERSIZE relates to Ghostscript, the PostScript interpreter, not to GhostPCL, the PCL interpreter. Or, in fact, any of the other languages.

This is because PAPERSIZE is handled in the PostScript startup code and therefore does nothing with any other interpreter.

I believe the expected way to set the media size would either be to set it in PCL or to use a PJL sequence initially:

ESC%-12345x
@PJL SET PAPERWIDTH=83
@PJL SET PAPERLENGTH=117
@PJL ENTER LANGUAGE=PCL

However I'm not an expert in either PCL or PJL so I'm assigning this to the relevant developer for more input.
Comment 2 TrevorBl 2022-12-14 10:50:08 UTC
Thinking about this some more ..  there's the closely related issue of setting the default page size.

From wikipedia, letter size is the default in United States, Canada, Chile, Colombia, Costa Rica, Mexico, Panama, Guatemala, the Dominican Republic and the Philippines, all other countries use a4.

So the startup code could set the default page size to letter for these countries, and set the default to a4 otherwise.
Comment 3 Ken Sharp 2022-12-14 11:01:57 UTC
(In reply to TrevorBl from comment #2)

> So the startup code could set the default page size to letter for these
> countries, and set the default to a4 otherwise.

Where libpaper is available (and assuming a build configuration which includes it) *Ghostscript* (but not GhosPCL) does do so. However there is no universal OS-independent means of knowing which country the user is in, so in general we do not attempt to set the default media size based on the country.

There are instructions for setting the default media size in the Ghostscript startup code, but this is for *Ghostscript* , but these don't apply to GhostPCL which doesn't have startup resources in the same way.
Comment 4 Henry Stiles 2022-12-14 12:48:17 UTC
This should work:

gpcl6.exe -J"@PJL SET PAPER=A4" -sOutputFile=out.pdf -r300 -sDEVICE=pdfwrite -dNOPAUSE a4test.pcl

But I'm out of the office and didn't test it.

PCL is not intended to be a finished product so doesn't have a configuration file.  The default for "paper" is set to "letter" in the PJL source code, pcl/pl/pjparse.c.  There is a C struct for PJL defaults.
Comment 5 Ken Sharp 2022-12-14 13:09:12 UTC
(In reply to Henry Stiles from comment #4)
> This should work:
> 
> gpcl6.exe -J"@PJL SET PAPER=A4" -sOutputFile=out.pdf -r300 -sDEVICE=pdfwrite
> -dNOPAUSE a4test.pcl
> 
> But I'm out of the office and didn't test it.

I just did and it works for me, producing an A4 MediaBox in the PDF file.
Comment 6 TrevorBl 2022-12-14 13:40:25 UTC
(In reply to Henry Stiles from comment #4)
> This should work:
> 
> gpcl6.exe -J"@PJL SET PAPER=A4" -sOutputFile=out.pdf -r300 -sDEVICE=pdfwrite
> -dNOPAUSE a4test.pcl
> 
> But I'm out of the office and didn't test it.
> 
> PCL is not intended to be a finished product so doesn't have a configuration
> file.  The default for "paper" is set to "letter" in the PJL source code,
> pcl/pl/pjparse.c.  There is a C struct for PJL defaults.

works for me too.
Thanks.