• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 481
  • Last Modified:

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"
0
nesher13
Asked:
nesher13
  • 4
  • 3
1 Solution
 
QlemoC++ DeveloperCommented:
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.
0
 
nesher13Author Commented:
Qlemo

Sorry, mistake, the code:

$result | Where {!$_.Values} | Foreach {Start-Process -FilePath "s:\INVOICES\0070\$($_.Invoices).pdf" –Verb Print}
0
 
QlemoC++ DeveloperCommented:
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.
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
nesher13Author Commented:
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 ?
0
 
QlemoC++ DeveloperCommented:
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?
0
 
nesher13Author Commented:
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.
0
 
QlemoC++ DeveloperCommented:
The only "easy" way I can see is to preset a landscape printer, and start the PDF with
    AcroRd32.exe /N /T PdfFile PrinterName
Some examples for commandline paramters, and some pointers to documentation, can be found at http://www.robvanderwoude.com/commandlineswitches.php#Acrobat.
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now