Bug 693058 - There is no way to control many pdfwrite features in GhostPCL (eg AutoRotatePages)
Summary: There is no way to control many pdfwrite features in GhostPCL (eg AutoRotateP...
Status: RESOLVED FIXED
Alias: None
Product: GhostPCL
Classification: Unclassified
Component: PDF Writer (show other bugs)
Version: 9.05
Hardware: PC Linux
: P4 enhancement
Assignee: Ken Sharp
URL:
Keywords:
: 693065 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-05-21 16:56 UTC by Snorri Bergmann
Modified: 2016-02-09 03:33 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
A landscape PCL input file (8.72 KB, application/vnd.hp-pcl)
2012-05-21 16:56 UTC, Snorri Bergmann
Details
The resulting PDF (42.48 KB, application/pdf)
2012-05-21 16:56 UTC, Snorri Bergmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Snorri Bergmann 2012-05-21 16:56:25 UTC
Created attachment 8610 [details]
A landscape PCL input file

We are converting various PCL files to PDF, some are portrait and some are landscape. We use the command:
$ cat PCLFILE| pcl6 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=OUT.PDF -

The problem is that the resulting pdf file has always the same page size regardless of the orientation. (595.2 x 841.68 pts). This is OK for printing, but when the user opens the PDF file in acrobat (or ghostview) he has to rotate the document if the input PCL was landscape. 

We have another utility called Swiftview convert (http://swiftview.com/swiftconvert.htm) to do this, but the results with GhostPCL are better for printing. Swiftview however correctly creates the PDF document with size 841.68 x 595.2 pts if the PCL was landscape, so all viewers display it correctly without the need to rotate.
Comment 1 Snorri Bergmann 2012-05-21 16:56:57 UTC
Created attachment 8611 [details]
The resulting PDF
Comment 2 Ken Sharp 2012-05-22 07:25:47 UTC
The PCL file is *not* landscape. It specifically requests portrait media and then rotates the content by 90 degrees. This draws the landscape content on portrait media. Exactly as the PDF file shows.

So, this is not a bug, the PDF file perfectly mimics what is sent in the PCL file. Presumably the printer for which this PCL was prepared does not have a landscape feed, hence the requirement to rotate landscape content so that it fits on portrait media.

When using the PostScript interpreter there is a feature (AutoRotatePages) which can be activated and which will attempt to rotate pages so that the dominant text direction is left-to-right, top-to-bottom. Presumably Swiftview also has such a feature. However currently there is no way to activate this feature from the PCL interpreter as it requires the us of PostScript constructs.

I am altering this to an enhancement request (as there is no bug) and changing the title to reflect the actual requirement.
Comment 3 Snorri Bergmann 2012-05-22 10:31:33 UTC
The pcl commands controlling paper size and orientation are these (appear at the beginning of the pcl stream):

^[&l1x1o26a0l2e7C

The first command "1o" sets the orientation to landscape (according to our pcl manual).
The next command "26a" sets the paper size to A4.

Strictly speaking, this means that the A4 sized paper should be placed in landscape orientation in the printer. No commands were given to rotate the print direction.

In reality, on a typical printer, the paper can't be physically positioned in the feeder in landscape. The physical printer works around this problem by taking the portrait oriented paper and rotating the print direction 90 degrees. This is entirely a decision made by the printer and I would assume that a "wide" printer that could handle paper positioned in landscape mode would print the document upright on the landscape paper.

Ghostscript should be able to offer the requested paper size and orientation. The pcl stream requested A4 paper in landscape orientation, NOT "portrait media and
then rotates the content by 90 degrees".
Comment 4 Ken Sharp 2012-05-22 12:01:02 UTC
(In reply to comment #3)
 
> Ghostscript should be able to offer the requested paper size and orientation.
> The pcl stream requested A4 paper in landscape orientation, NOT "portrait media
> and
> then rotates the content by 90 degrees".

I'm not prepared to enter a debate on the action of PCL since I'm not a PCL expert. However GS when rendering produces output *exactly* the same as the PDF file. If you believe this to be incorrect you can alter the component from PDF writer to PDF interpreter and argue the interpretation of the reference manual (and real-world implementation) with someone who understands the language.

As far as I'm concerned the pdfwrite output matches the rendered output and is therefore correct. The inability to auto-rotate the page and contents to follow the text direction is a missing feature which is present in the PostScript implementation.
Comment 5 Snorri Bergmann 2012-05-22 14:34:59 UTC
(In reply to comment #4)

> As far as I'm concerned the pdfwrite output matches the rendered output and is
> therefore correct. The inability to auto-rotate the page and contents to follow
> the text direction is a missing feature which is present in the PostScript
> implementation.

OK. Is there a workaround, like creating a PostScript file first, and then convert the ps file to pdf (with gs)?
Comment 6 Ken Sharp 2012-05-22 14:48:08 UTC
(In reply to comment #5)
> (In reply to comment #4)
> 
> > As far as I'm concerned the pdfwrite output matches the rendered output and is
> > therefore correct. The inability to auto-rotate the page and contents to follow
> > the text direction is a missing feature which is present in the PostScript
> > implementation.
> 
> OK. Is there a workaround, like creating a PostScript file first, and then
> convert the ps file to pdf (with gs)?

Not with GhostPCL because it does not interpret PostScript.
Comment 7 Snorri Bergmann 2012-05-22 15:19:51 UTC
A workaround:

First, generate a postscript file from the pcl and pipe the output to ghostscript to generate the pdf.
Something like:

cat file.pcl | pcl6-905-linux_x86_64 -dNOPAUSE -dBATCH  -sDEVICE=ps2write -sOutputFile=- -|./gs-905-linux_x86_64 -dNOPAUSE -dBATCH -dAutoRotatePages=/All -sDEVICE=pdfwrite -sOutputFile=file.pdf -
Comment 8 Ken Sharp 2012-05-23 16:04:49 UTC
*** Bug 693065 has been marked as a duplicate of this bug. ***