Link to home
Start Free TrialLog in
Avatar of nesher13
nesher13Flag for Israel

asked on

Start-Process | landscape mode

Hi folks,  how I can in powershell print off the results of the following code in landscape mode:

$result | Where {!$_.Values} | Foreach {Start-Process -FilePath "s:\INVOICES\0070\$($_.Invoices).pdf"
Avatar of Qlemo
Qlemo
Flag of Germany image

Depends on what you mean with "print". Sounds as if you need to control how Acrobat Reader (or FoxIt or whatever PDF viewer you use) displays the PDF, and that usually depends on the viewer's abilities.
Start-Process itself has a -WindowStyle paramter you can feed with one of Normal, Hidden, Minimzed, Maximized, and that is always worth a try.
Avatar of nesher13

ASKER

Qlemo

Sorry, mistake, the code:

$result | Where {!$_.Values} | Foreach {Start-Process -FilePath "s:\INVOICES\0070\$($_.Invoices).pdf" –Verb Print}
The "print" verb prints out the document with the settings put into the document or the default printer's default settings. So correct way to handle this is to generate the PDFs in landscape mode - which sounds unreasonable, as invoices are of letter type most of the time.
Also, if you print out a portrait PDF in landscape mode, it will require two pages, as you can't change the PDF page layout other than by zooming.
Qlemo

it will require two pages, as you can't change the PDF page layout other than by zooming.

Landscape printing contain only 1 page. I search for programmatically solution. Maybe there is another cmdlet ?
Controlling an application is only feasible if you know the application exactly - e.g. fixing to use Acrobat Reader.
After that, you either need to access the COM application object, or simulate keystrokes. Do you really want to go that far?
Qlemo

Acrobat is the right application.
so when you double click on the pdf file, Acrobat opens the file.

After that, you either need to access the COM application object, or simulate keystrokes. Do you really want to go that far?


My knowledge of programming com objects and keystroke tend to zero. I would have preferred a more simple solution, or existing code that uses these technologies.
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial