Find pages in landscape orientation
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
-
- User
- Posts: 97
- Joined: Mon May 26, 2008 8:52 am
Find pages in landscape orientation
Is there a way to quickly find landscape pages in a large document (> 700 pages) that consists for 99% of portrait pages?
Thanks in advance,
Ed
Thanks in advance,
Ed
Ed van den Bogaard
Happy PDF-XChange PRO user since 2008 (version 4)
Happy PDF-XChange PRO user since 2008 (version 4)
-
- User
- Posts: 1396
- Joined: Tue Nov 24, 2020 4:02 pm
Re: Find pages in landscape orientation
Show the Thumbnails pane, zoom out until the thumbnails are quite small, and then just navigate around the pane and you should be able to see the orientation of all pages.
All best,
FringePhil
FringePhil
-
- User
- Posts: 97
- Joined: Mon May 26, 2008 8:52 am
Re: Find pages in landscape orientation
That's exactly what I do, but because in a 700 pages document that is a bit tedious I hoped there is a quicker way using a search.
Maybe something for a feature request: searching on page dimensions (i.e. page width > 21 cm).
Anyway, cheers and thanks again.
Ed
Maybe something for a feature request: searching on page dimensions (i.e. page width > 21 cm).
Anyway, cheers and thanks again.
Ed
Ed van den Bogaard
Happy PDF-XChange PRO user since 2008 (version 4)
Happy PDF-XChange PRO user since 2008 (version 4)
-
- Site Admin
- Posts: 19868
- Joined: Mon Jan 12, 2009 8:07 am
Re: Find pages in landscape orientation
Hello evdbogaard,
Do you need to just find those pages or also rotate them?
I think there was a similar topic in the past here in the forums - and I wrote a small JS that goes through all pages and checks whether their width is larger than their height, and if it was - the script was rotating them accordingly.
Kind regards,
Stefan
Do you need to just find those pages or also rotate them?
I think there was a similar topic in the past here in the forums - and I wrote a small JS that goes through all pages and checks whether their width is larger than their height, and if it was - the script was rotating them accordingly.
Kind regards,
Stefan
-
- User
- Posts: 97
- Joined: Mon May 26, 2008 8:52 am
Re: Find pages in landscape orientation
Hi Stefan,
your guess is correct, I also want to rotate them to portrait, so I am interested in your script.
Greetings from ‘Max’-country,
Ed
your guess is correct, I also want to rotate them to portrait, so I am interested in your script.
Greetings from ‘Max’-country,
Ed
Ed van den Bogaard
Happy PDF-XChange PRO user since 2008 (version 4)
Happy PDF-XChange PRO user since 2008 (version 4)
-
- User
- Posts: 280
- Joined: Fri Apr 11, 2014 1:18 am
Re: Find pages in landscape orientation
A script below will set page rotation of landscape oriented pages to 0°. Most of the script came from https://forum.pdf-xchange.com/viewtopic.php?p=138973#p138973
Make a copy of your file before running it.
Make a copy of your file before running it.
Code: Select all
for (var i = 0; i<this.numPages; i++)
{
var pageRect = this.getPageBox("Crop",i);
var width = pageRect[2]-pageRect[0];
var height = pageRect[1]-pageRect[3];
if (width >= height)
{
setPageRotations(i, i, 0);
}
}
-
- Site Admin
- Posts: 797
- Joined: Tue Apr 14, 2009 11:33 pm
Find pages in landscape orientation

If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.
Chris Attrell
Tracker Sales & Support North America
http://www.tracker-software.com
Chris Attrell
Tracker Sales & Support North America
http://www.tracker-software.com
-
- User
- Posts: 97
- Joined: Mon May 26, 2008 8:52 am
Re: Find pages in landscape orientation
Thanks, works like a charm!
I guess there is a similar way to find (portrait oriented) pages with a width larger then 21,00 cm.
It is not necessary to automatically change anything, but in a 500 page document it would be nice to find them in an quick and easy way.
How do edit the code for that purpose?
Oops, nearly forgotten: happy new year for all of you!
Ed
I guess there is a similar way to find (portrait oriented) pages with a width larger then 21,00 cm.
It is not necessary to automatically change anything, but in a 500 page document it would be nice to find them in an quick and easy way.
How do edit the code for that purpose?
Oops, nearly forgotten: happy new year for all of you!
Ed
Ed van den Bogaard
Happy PDF-XChange PRO user since 2008 (version 4)
Happy PDF-XChange PRO user since 2008 (version 4)
-
- Site Admin
- Posts: 19868
- Joined: Mon Jan 12, 2009 8:07 am
Re: Find pages in landscape orientation
Hello Ed,
Please try this script:
When you run it - you should get a list of the pages that are wider than 210.255mm with the page width given in mm rounded to two decimal digits.
If you change the value in the if from 596 to 595.27559 you will get as close to 210mm as possible:
So if you have a mix of e.g. A4 and Letter sized pages - the script will catch all the Letter pages and skip portrait A4 ones. (Landscape A4 will be wider than our check - so such pages will still display in the output list.)
Kind regards,
Stefan
Please try this script:
Code: Select all
for (var i = 0; i<this.numPages; i++)
{
var pageRect = this.getPageBox("Crop",i);
var width = pageRect[2]-pageRect[0];
var height = pageRect[1]-pageRect[3];
if (width >= 596) //value in points - 1pt = 1/72 inch - 596pt ~= 210.256mm
{
console.println("The width of page "+ (i+1) + " is " +
Math.round((width*25.4/72)*100 )/100 + " mm");
}
}
If you change the value in the if from 596 to 595.27559 you will get as close to 210mm as possible:
So if you have a mix of e.g. A4 and Letter sized pages - the script will catch all the Letter pages and skip portrait A4 ones. (Landscape A4 will be wider than our check - so such pages will still display in the output list.)
Kind regards,
Stefan
You do not have the required permissions to view the files attached to this post.
-
- User
- Posts: 97
- Joined: Mon May 26, 2008 8:52 am
Re: Find pages in landscape orientation
Hi Stefan,
This too works like a charm, so thanks!
Kindest regards,
Ed
This too works like a charm, so thanks!
Kindest regards,
Ed
Ed van den Bogaard
Happy PDF-XChange PRO user since 2008 (version 4)
Happy PDF-XChange PRO user since 2008 (version 4)
-
- Site Admin
- Posts: 19868
- Joined: Mon Jan 12, 2009 8:07 am