Illustrator CS: determine print orientation of opened PDF?


I’ve created multiple PDFs by printing to PDF from Excel on a Windows box, some are “portrait” print orientation, and some are “landscape”. When I open the PDFs in Preview or Acrobat on the Mac, the PDFs display “right-side-up”, meaning lanscape-oriented PDFs display wider than tall, and the baseline of my type is horizontal.

However, when I open in Illustrator, the landscape-oriented PDFs are rotated 90 degrees counter-clockwise (they display taller than wide). The portrait-oriented PDFs open “right-side-up”, because they’re tall to begin with.

Any thoughts on how to test for what print orientation that the PDFs should have? Something on opening, or even after opening, then I can just rotate the whole doc?



Are you thinking of a test like the following:

tell application "Illustrator CS"
	tell document 1
		set h to height
		set w to width
		if w > h then
			-- print landscape
			-- print portriat
		end if
	end tell
end tell

There is no way to adjust the print orientation necessarily but you can adjust the ‘print area’ property of the ‘job options’ class. It always defaults to the artboard bounds though, so this shouldn’t be an issue however the PDFs open in AI. Is this test for printing or just for orienting the artwork the correct way? Would you need to compare width/height of the document in Acrobat as well as AI? In Acrobat, you can get the page dimensions with something like the following:

tell application "Acrobat 6.0.1 Professional"
	set {l, t, r, b} to bounds of page 1 of document 1
	set h to t - b
	set w to r - l
	if w > h then
		set orientation to "landscape"
		set orientation to "portrait"
	end if
end tell