Bug 689919 - Orientation after convert from PDF to PCL
Summary: Orientation after convert from PDF to PCL
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: 8.60
Hardware: PC AIX
: P3 critical
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-24 03:03 UTC by Amanda
Modified: 2008-12-19 08:31 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Amanda 2008-06-24 03:03:18 UTC
Dear Sir/Lady,

We meet the issue as similar as Bug 687330 in gs8.60 which you announced it 
was fixed in gs8.11. 
After the converting A4 landscape PDF to PCL, the PCL format looks like A3 and 
portrait. Meanwhile, we can get some content lost on hard copy due to portrait.

I use following command line:
$ gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=ljet4 -sPAPERSIZE=letter -
sOutputFile=/tmp/pasta5206034_0.tmp -c save pop -
f /tmp/XXPO_PRINT_758094_1.PDF -dNORANGEPAGESIZE

Because I noticed file lib/gs_setpd.ps which fixed the bug, that recorded in 
URL: http://bugs.ghostscript.com/show_bug.cgi?id=687330, I did some tests. And 
you can get the details of my tests in the end. 

And the result seems the library on our OS doesn't take effects. I dont't know 
is there somewhat bug in gs8.60 on AIX due to lib disabled and then potential 
due to the issue which is 'Wrong Orientation after convert from PDF to PCL' 
described in Bug 687330 ?


################### Appendix: My Tests ###################
>>>> First of all, show our environment.
OS:  AIX 5.3.0.0
gostscript: 8.60
OS environment: 
export 
GS_LIB="/appl/gs8.60/share/ghostscript/8.60/lib:/appl/gs8.60/share/ghostscript/
8.60/Resource:/appl/gs8.60/share/ghostscript/fonts:/appl/gs8.60/share/fonts/def
ault/ghostscript:/appl/gs8.60/share/fonts/default/Type1:/appl/gs8.60/share/font
s/default/TrueType"
Installing according to 
document /appl/gs8.60/gs8.60_share/share/ghostscript/8.60/doc/Make.htm#Unix_bui
ld

>>>> Then, describe our tests and results
>>Test 1:

Step 1, I renamed the directory /appl/gs8.60/share/ghostscript/8.60/lib to 
be /appl/gs8.60/share/ghostscript/8.60/lib-BAK

Step 2, executed below command
$ gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=ljet4 -sPAPERSIZE=letter -
sOutputFile=/tmp/pasta5206034_0.tmp -c save pop -
f /tmp/XXPO_PRINT_758094_1.PDF -dNORANGEPAGESIZE

The result: the command performed successful.


>>Test 2:

Step 1, I renamed the directory /appl/gs8.60/share/ghostscript/fonts to 
be /appl/gs8.60/share/ghostscript/fonts-BAK.

Step 2, executed below command
$ gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=ljet4 -sPAPERSIZE=letter -
sOutputFile=/tmp/pasta5206034_0.tmp -c save pop -
f /tmp/XXPO_PRINT_758094_1.PDF -dNORANGEPAGESIZE

The result: the command failed due to didn't find fonts.
Comment 1 Ray Johnston 2008-06-25 00:10:53 UTC
While this may be "P1" to you, our bug tracker policy allows for the highest
"free user" bug to be P3. I'll leave the 'critical' severity since we really
don't use that field much.
Comment 2 Alex Cherepanov 2008-06-25 12:15:50 UTC
V. 8.60 is obsolete. Please try v. 8.62 .
Please attach the sample PDF file to the bug report.
Can you reproduce the problem on other devices, for instance tiffg4 ?
Can you reproduce the problem on Linux or Windows ?
Comment 3 Marcos H. Woehrmann 2008-06-25 14:37:05 UTC
Removing data from Customer: field, which is for licensed Artifex customers only.
Comment 4 Amanda 2008-06-25 20:56:55 UTC
Dear Sir/Lady,

The issue is ocurred on UNIX OS which is AIX 5.3.0.0.

I tested devices such as ljet4, laserjet and tiffg4. The result is as 
following.

1. In my tests, I can see part of the content via PCLReader after converting 
the original PDF file to PCL by devices ljet4 and laserjet. The format of the 
hard copies looks like portrait.

I used below two commands:
$ gs -q -dNOPAUSE -dBATCH -dSAFER  -dPDFDEBUG -dCCFONTDEBUG -dCFFDEBUG -
dCMAPDEBUG  -dDOCIEDEBUG -dEPSDEBUG   -dFAPIDEBUG  -dINITDEBUG  -dPDFDEBUG   -
dPDFOPTDEBUG-dPDFWRDEBUG -dSETPDDEBUG -dSTRESDEBUG -dTTFDEBUG -dVGIFDEBUG -
dVJPGDEBUG  -sDEVICE=ljet4 -sPAPERSIZE=a4 -
sOutputFile=XXPO_PRINT_739386_1.PDF.1057.ljet4.pcl -c save pop -f 
XXPO_PRINT_739386_1.PDF > XXPO_PRINT_739386_1.debug.1057.ljet4.log

$ gs -q -dNOPAUSE -dBATCH -dSAFER  -dPDFDEBUG -dCCFONTDEBUG -dCFFDEBUG -
dCMAPDEBUG  -dDOCIEDEBUG -dEPSDEBUG   -dFAPIDEBUG  -dINITDEBUG  -dPDFDEBUG   -
dPDFOPTDEBUG-dPDFWRDEBUG -dSETPDDEBUG -dSTRESDEBUG -dTTFDEBUG -dVGIFDEBUG -
dVJPGDEBUG  -sDEVICE=laserjet -sPAPERSIZE=a4 -
sOutputFile=XXPO_PRINT_739386_1.PDF.1059.laserjet.pcl -c save pop -f 
XXPO_PRINT_739386_1.PDF > XXPO_PRINT_739386_1.debug.1059.laserjet.log

1) Uploaded the original PDF file XXPO_PRINT_739386_1.PDF.
2) Uploaded the final PCL file XXPO_PRINT_739386_1.PDF.1057.ljet4.pcl and 
XXPO_PRINT_739386_1.PDF.1059.laserjet.pcl .
3) Uploaded the gostscript debug logs XXPO_PRINT_739386_1.debug.1057.ljet4.log 
and XXPO_PRINT_739386_1.debug.1059.laserjet.log
4) Uploaded the scanning copy of hardcopy of execute command 'lp -c <printer> 
XXPO_PRINT_739386_1.PDF.1057.ljet4.pcl' which named 
scan0002_hardcopy_XXPO_PRINT_739386_1.PDF.1057.ljet4.pcl.pdf

2. In the test, if I used device tiffg the PCL file which generated by gs8.60 
can not be read. I can only see some characters via PCLReader.
1) Uploaded the final PCL file XXPO_PRINT_739386_1.PDF.1054.tiffg4.pcl.


Thanks,
Amanda
Comment 5 Amanda 2008-06-25 20:59:23 UTC
Supplied above test...

The command I used for device tiffg is 
$ gs -q -dNOPAUSE -dBATCH -dSAFER  -dPDFDEBUG -dCCFONTDEBUG -dCFFDEBUG -
dCMAPDEBUG  -dDOCIEDEBUG -dEPSDEBUG   -dFAPIDEBUG  -dINITDEBUG  -dPDFDEBUG   -
dPDFOPTDEBUG-dPDFWRDEBUG -dSETPDDEBUG -dSTRESDEBUG -dTTFDEBUG -dVGIFDEBUG -
dVJPGDEBUG  -sDEVICE=laserjet -sPAPERSIZE=a4 -
sOutputFile=XXPO_PRINT_739386_1.PDF.1054.tiffg4.pcl -c save pop -f 
XXPO_PRINT_739386_1.PDF > XXPO_PRINT_739386_1.debug.1054.tiffg4.log

2) Uploaded the gostscript debug logs XXPO_PRINT_739386_1.debug.1054.tiffg4.log


Thanks,
Amanda
Comment 6 Amanda 2008-06-25 21:02:25 UTC
Created attachment 4150 [details]
XXPO_PRINT_739386_1.PDF

The target PDF file which we used to test converting PDF to PCL and landscape
origination.
Comment 7 Amanda 2008-06-25 21:06:39 UTC
Created attachment 4151 [details]
XXPO_PRINT_739386_1.PDF.1057.ljet4.pcl

The PCL file which generated by via gs8.60 using device ljet4
Comment 8 Amanda 2008-06-25 21:08:24 UTC
Created attachment 4152 [details]
XXPO_PRINT_739386_1.debug.1057.ljet4.log

The gostscript debug logs.
Comment 9 Amanda 2008-06-25 21:09:49 UTC
Created attachment 4153 [details]
scan0002_hardcopy_XXPO_PRINT_739386_1.PDF.1057.ljet4.pcl.pdf

The scanning copy of hardcopy printed via printer.
Comment 10 Amanda 2008-06-25 21:11:24 UTC
Created attachment 4154 [details]
XXPO_PRINT_739386_1.PDF.1059.laserjet.pcl

Test2: The PCL file which generated by via gs8.60 using device laserjet.
Comment 11 Amanda 2008-06-25 21:12:09 UTC
Created attachment 4155 [details]
XXPO_PRINT_739386_1.debug.1059.laserjet.log

Test2: The gostscript debug logs.
Comment 12 Amanda 2008-06-25 21:12:54 UTC
Created attachment 4156 [details]
XXPO_PRINT_739386_1.PDF.1054.tiffg4.pcl

Test3: The PCL file which generated by via gs8.60 using device tiffg4
Comment 13 Amanda 2008-06-25 21:13:21 UTC
Created attachment 4157 [details]
XXPO_PRINT_739386_1.debug.1054.tiffg4.log

Test3: The gostscript debug logs.
Comment 14 Amanda 2008-06-26 02:13:09 UTC
Dear Sir/Lady,

I also tested below commands referring 
http://bugs.ghostscript.com/show_bug.cgi?id=629335, but the issue still exists.

Following are my test commands:
$ gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=laserjet -sPAPERSIZE=a4 -
sOutputFile=XXPO_PRINT_739386_1.PDF.laserjet.595.842.0.pcl -
c "<< /InputAttributes << 0 << /PageSize [ 595 842 ] >> >> >> setpagedevice " 
save pop -f XXPO_PRINT_739386_1.PDF

$ gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=laserjet -sPAPERSIZE=a4 -
sOutputFile=XXPO_PRINT_739386_1.PDF.laserjet.595.842.90.pcl -
c "<< /InputAttributes << 90 << /PageSize [ 595 842 ] >> >> >> setpagedevice " 
save pop -f XXPO_PRINT_739386_1.PDF

$ gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=laserjet -sPAPERSIZE=a4 -
sOutputFile=XXPO_PRINT_739386_1.PDF.laserjet.842.595.0.pcl -
c "<< /InputAttributes << 0 << /PageSize [ 842 595 ] >> >> >> setpagedevice " 
save pop -f XXPO_PRINT_739386_1.PDF

$ gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=laserjet -sPAPERSIZE=a4 -
sOutputFile=XXPO_PRINT_739386_1.PDF.laserjet.842.595.90.pcl -
c "<< /InputAttributes << 90 << /PageSize [ 842 595 ] >> >> >> setpagedevice " 
save pop -f XXPO_PRINT_739386_1.PDF


Thanks,
Amanda
Comment 15 Amanda 2008-06-26 07:50:01 UTC
Comment on attachment 4152 [details]
XXPO_PRINT_739386_1.debug.1057.ljet4.log

This file must have high security.
Comment 16 Amanda 2008-06-26 07:51:17 UTC
Comment on attachment 4153 [details]
scan0002_hardcopy_XXPO_PRINT_739386_1.PDF.1057.ljet4.pcl.pdf

This file must have high security. It cannot be shared on the internet.
Comment 17 Amanda 2008-06-26 08:00:56 UTC
Dear Sir/Laday,

I also tested following commands, but landscape orientation always can not 
get. 

$ gs -q -dNOPAUSE -dBATCH -dSAFER  -sDEVICE=laserjet -sPAPERSIZE=a4 -
sOutputFile=XXPO_PRINT_739386_1.PDF.laserjet.Orientation.3.pcl -
c "<</Orientation 3>> setpagedevice" save pop -f XXPO_PRINT_739386_1.PDF


Thanks,
Comment 18 Alex Cherepanov 2008-06-26 19:32:02 UTC
This is not a bug but a configuration issue.
By default Ghostscript is configured to support any paper size i.e. behaves
as a roll-feed device with a very wide media. This works fine for device-
independent file generation but is not compatible with real devices.

To activate auto-rotation we need to take away the choices of output media
Ghostscript has. When Ghostscript deals with a number of predefined
media sizes it employs media matching policies as they are documented in the
PLRN. Media matching includes auto-rotation,

Please execute the following program before running your file.

<< /InputAttributes <<
     currentpagedevice /InputAttributes get {
       pop null
     } forall
   >>
%  dup 1 << /PageSize [ 612 792 ] >> put % uncomment if needed
   dup 0 << /PageSize [ 595 842 ] >> put
>> setpagedevice
 
Comment 19 Amanda 2008-06-26 21:12:49 UTC
Dear Sir/Lady,

Would you please kindly give some hint at how to execute this program?
I really don't know how to perform it.

>>>>>>>>Qoute:
>>  Please execute the following program before running your file.
>>  << /InputAttributes <<
>>      currentpagedevice /InputAttributes get {
>>        pop null
>>      } forall
>>    >>
>>  %  dup 1 << /PageSize [ 612 792 ] >> put % uncomment if needed
>>    dup 0 << /PageSize [ 595 842 ] >> put
>>  >> setpagedevice

Thanks a lot,
Comment 20 Alex Cherepanov 2008-06-27 04:04:53 UTC
You can stuff the file into a string and execute it from -c
option in the same way as you do now.

Alternatively, save the file somewhere in the file system and
run it before your print job.

$ gs ... -sPAPERSIZE=a4 ... -f prefix.ps XXPO_PRINT_739386_1.PDF
Comment 21 Ray Johnston 2008-06-27 07:46:38 UTC
Thanks for handling this Alex. I'm going ahead and closing this. If there are any
other questions from this fairly inexperienced user, I'll handle them.
Comment 22 Amanda 2008-07-04 01:26:54 UTC
Dear Alex,

According to your advice, the PCL printer can print PDF and landscape format 
now. Thank you very much.

But there has a minor defect, that is as more as about 1 cm  the left margin 
size in .PCL file than in .PDF file. So some content lost on the righ of 
the .PCL file.
Would you please kindly give me some hints about this issue?
Need I open a new bug about left-margin issue?

Thanks,


 
Comment 23 Alex Cherepanov 2008-07-04 04:26:50 UTC
Please try to narrow the issue.
- Does this happen with every PS file ? Try to run the following file. The file
  draws a diagonal lines on A4 paper in portrait orientation. The lines may
  not reach the corners because of the hardware margins but should point to
  the corners.
  %!
  <</PageSize [ 595 842 ]>> setpagedevice
  0 0 moveto 595 842 lineto 595 0 moveto 0 842 lineto
  stroke showpage

- Try to do the same with the landscape file and the prefix.
  %!
  <</PageSize [ 842 595 ]>> setpagedevice
  0 0 moveto 842 595 lineto 0 595 moveto 842 0 lineto
  stroke showpage

- Does this happen with every PDF file ? Convert the above programs to PDF
  using ps2pdf and print.
Comment 24 Amanda 2008-07-29 19:33:57 UTC
Dear Alex,

I'd like to explain that when we use pdf2ps to print the .PDF formated 
landscape on HP Laserjet printer, I get correct hard copies. More, I never 
need to change the gs command in the pdf2ps, it always works fine.
But when I use pdf2pcl, at previously, I can only get portriat hard copies 
even when the .PDF file is landscape. Then, very thanks for your advices that 
make me can get landscape hard copies. But the data position on the hard 
copies move about one centimeter right comparing with the copies printed by 
pdf2ps. And the data position right moving cause some content in the right 
lost on the hard copies, so we have to move data 1 centimeter to the left. I 
guess while data moving one centimeter back to the left, PCL can print as same 
hard copies as PS, but that haven't come true.

Then, answer your questions.
1. %!
  <</PageSize [ 595 842 ]>> setpagedevice

This printed hard copies formated landscape via PCL, but the data on the hard 
copies moves right about one centimeter. 
It happens with every PDF and PCL file. 
Below is my test command:
#### test command 1 : #####
gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=laserjet -sOutputFile=A.pcl -
c "<< /InputAttributes <<     currentpagedevice /InputAttributes get {       
pop null     } forall   >>  dup 0 << /PageSize [ 595 842 ] >> put >> 
setpagedevice" save pop -f A.PDF
#### test command 2 : #####
gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=laserjet -sOutputFile=A.pcl -
c "<< /InputAttributes <<     currentpagedevice /InputAttributes get {       
pop null     } forall   >>  dup 0 %! << /PageSize [ 595 842 ] >> put >> 
setpagedevice" save pop -f A.PDF
Using command 2, Gostscript return 'Unrecoverable error, exit code 1'

2. %!
  <</PageSize [ 842 595 ]>> setpagedevice

This printed hard copies formated portrait via PCL, but the data on the hard 
copies moves right about one centimeter. 
It happens with every PDF and PCL file. 
Below is my test command:
########
gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=laserjet -sOutputFile=A.pcl -
c "<< /InputAttributes <<     currentpagedevice /InputAttributes get {       
pop null     } forall   >>  dup 0 << /PageSize [ 842 595 ] >> put >> 
setpagedevice" save pop -f A.PDF

3. In my test, if printed PDF via PS, below command can print both landscape 
and portrait format. Never needs to change.
It happens with every PDF and PS file. 
########
gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pswrite -sOutputFile=A.ps -c save 
pop -f A.PDF

4. Above testing results happen with every PDF and PCL file. 

Best Regards,
Comment 25 Amanda 2008-07-29 22:02:22 UTC
Dear Alex,

The issue is fixed now. I'd like to close this issue.
Thanks for your strong support.

Best Regards,