# PDF:Writer pages landscape and portrait

**URL:** <https://www.ruby-forum.com/t/pdf-writer-pages-landscape-and-portrait/114533>\
**Category:** Ruby\
**Created:** [September 14, 2007, 10:20am UTC](https://www.ruby-forum.com/t/pdf-writer-pages-landscape-and-portrait/114533 "2007-09-14T10:20:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnnybutler7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8491ac/32.png) [@johnnybutler7](https://www.ruby-forum.com/u/johnnybutler7)\
**Post date:** [September 14, 2007, 10:20am UTC](https://www.ruby-forum.com/t/pdf-writer-pages-landscape-and-portrait/114533/1 "2007-09-14T10:20:52Z")

</div>

Hi,

Im creating a PDF report and throughout the PDF document there will be  
some pages that need to be landscape and some that need to portrait. I  
cant seem to find any documentation about inserting pages in the  
document with a different layout, it looks like the whole document needs  
to be on or the other when initialising  
pdf = PDF::Writer.new(:orientation =\> :landscape)

I currently have the seperate parts of the document rendering  
individually so one option would be to merge them altogether when  
finished and use the page numbering to tie them together.

Can anyone give some advice on the best route to take for this?

thanks

JB

---

<div class="post-metadata">

**Author:** ![johnnybutler7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8491ac/32.png) [@johnnybutler7](https://www.ruby-forum.com/u/johnnybutler7)\
**Post date:** [September 14, 2007, 12:00pm UTC](https://www.ruby-forum.com/t/pdf-writer-pages-landscape-and-portrait/114533/2 "2007-09-14T12:00:11Z")

</div>

Using a java library is not an option,

Im looking at imagemagick but that looks like its only images to PDF.

JB

---

<div class="post-metadata">

**Author:** ![johnnybutler7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8491ac/32.png) [@johnnybutler7](https://www.ruby-forum.com/u/johnnybutler7)\
**Post date:** [September 17, 2007, 1:25pm UTC](https://www.ruby-forum.com/t/pdf-writer-pages-landscape-and-portrait/114533/3 "2007-09-17T13:25:08Z")

</div>

-------- Original-Nachricht --------

> Datum: Fri, 14 Sep 2007 17:20:56 +0900  
> Von: John B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> An: removed\_email\_address@domain.invalid  
> Betreff: PDF:Writer pages landscape and portrait

> individually so one option would be to merge them altogether when  
> finished and use the page numbering to tie them together.
> 
> Can anyone give some advice on the best route to take for this?
> 
> thanks
> 
> ## JB
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

Dear John,

one option might be to convert the PDF document to postscript  
(using ghostscript [http://pages.cs.wisc.edu/~ghost/doc/AFPL/index.htm](http://pages.cs.wisc.edu/~ghost/doc/AFPL/index.htm)),

You can then select certain pages using psselect (which is part  
of psutils (ftp://ftp.dcs.ed.ac.uk/pub/ajcd/psutils.tar.gz) , which  
contains also pstops, which allows to rotate a ps file :

(assuming it started out being 8.5" wide):

pstops -w0 -h0 1:0R(0in,8.5in) input.ps \> rotated.ps

Next, you would need to output the rotated file on a landscape  
page while converting it to pdf. For a 11" W x 8.5" H page:

ps2pdf13 -g7920x6120 rotated.ps

(The units of measure are decipoints, where 720 decipoints = 1 inch)

Best regards,

Axel

---

<div class="post-metadata">

**Author:** ![johnnybutler7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8491ac/32.png) [@johnnybutler7](https://www.ruby-forum.com/u/johnnybutler7)\
**Post date:** [September 17, 2007, 1:25pm UTC](https://www.ruby-forum.com/t/pdf-writer-pages-landscape-and-portrait/114533/4 "2007-09-17T13:25:35Z")

</div>

-------- Original-Nachricht --------

> Datum: Fri, 14 Sep 2007 21:47:11 +0900  
> Von: “Axel E.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> An: removed\_email\_address@domain.invalid  
> Betreff: Re: PDF:Writer pages landscape and portrait

> > some pages that need to be landscape and some that need to portrait. I
> 
> ps2pdf13 -g7920x6120 rotated.ps
> 
> (The units of measure are decipoints, where 720 decipoints = 1 inch)
> 
> Best regards,
> 
> ## Axel
> 
> Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten  
> Browser-Versionen downloaden: [GMX Browser - verwenden Sie immer einen aktuellen Browser. Kostenloser Download.](http://www.gmx.net/de/go/browser)

Dear John,

I forgot to say how to merge postscript files before converting them:  
that’s also done by ghostscript:

gs -sDEVICE=pswrite -sOutputFile=output.ps -dNOPAUSE -dBATCH file1.ps  
file2.ps file3.ps

Best regards,

Axel
