Skip to Content
Author's profile photo Former Member

Printing Crystal Reports with Powershell

Hi all,

I was working on a way to export a report to pdf and then print it out on a printer. Since searching for articles didn’t return any results, I figured it out myself and decided to post it myself. The following script makes use of the .net assemblies, so it requires you to have Crystal Reports for Visual Studio installed.

#load the assemblies




$ReportLocation = “C:\YourReportPath\report.rpt”

$ReportDestination = “C:\DestinationPath\report.pdf”

$PrinterName = “printer0001”

#setup Crystal Document object

$Report = New-Object CrystalDecisions.CrystalReports.Engine.ReportDocument

#load the Crystal Report


#if your report requires a database connection. Otherwise you can delete this line.


#run report and export to pdf


#create the required printer and page settings

$PrintOptions = New-Object System.Drawing.Printing.PrinterSettings

$PageOptions = New-Object System.Drawing.Printing.PageSettings

#add the desired printer or it will print to the default printer

$PrintOptions.PrinterName = $PrinterName

$PrintOptions.Copies = 1


$Report.PrintToPrinter($PrintOptions, $PageOptions, $false)


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Manuel Dias
      Manuel Dias

      Hi Zach,

      That seems cool!

      Can you explain better how to activate this function at SAP Business One level?

      Or we need to call the powershell script from the "Launch Application" SBO menu option?



      Author's profile photo Gabriel Schroedter
      Gabriel Schroedter

      Does this require Crystal Server, or can it just work with Crystal Reports and the SDK from the Crystal Reports for Visual Studio page on SCN?