I faced one situation in which it was recommended to implement the mechanism for scheduled printing of a PDF file which is captured through the SSRS Windows share subscription.
Below is the ticket description -
1. Open
Task Scheduler by clicking the Startbutton,
clicking Control Panel,
clicking System and Security,
clicking Administrative Tools, and
then double-clicking Task Scheduler.if
you're prompted for an administrator password or confirmation, type the
password or provide confirmation.
2. Click the Action menu, and then click Create Basic Task.
3. Do one of the following:
Below is the ticket description -
Ticket Description: Create the
mechanism to schedule the printing of the SSRS reports in PDF format.
Understanding: As per the above description we have
to propose/find out an approach to print the SSRS report in pdf format on
schedule basis.
Resolution: The requested functionality will be
implemented by using the batch file
and Windows Task Scheduler/SQL Server Agent.
Batch file sample code:
/*Take to the root*/
CD/
/*Get to the installed adobe reader driver, this location may differ based
on the configuration*/
CD Program Files (x86)\Adobe\Reader 11.0\Reader
/*execute the adobe drive file and follow up with the printer properties*/
AcroRd32.exe /t "C:\Users\vipul.sachan\Desktop\Vipul\pdf-sample.pdf"
"HP LaserJet 3055 PCL6 Class Driver" "HP LaserJet 3055 PCL6
Class Driver" "IP_172.16.16.103"
Assumption:
1. The
above requirement has been analyzed on 32 bit Microsoft windows operating
system.
2. There
is only one pdf file, above methodology will not be supporting in case of multiple pdf files.
Mandatory items: There are following items must be
available into the respective computer system.
1.
Adobe
reader must be installed to read the PDF file.
2.
Printer
must be configured into the source laptop to capture the print command.
Input Required:
1.
Adobe
reader exe location (Example- C:\Program
Files (x86)\Adobe\Reader 11.0\Reader>AcroRd32.exe )
2.
Subscribed
SSRS pdf report location which is required to print on scheduled basis.
3.
Printer
name, Printer driver, Printer Port
Process flow:
1.
Get
the deployed SSRS report into PDF format using report subscription
functionality
2.
Print
the same SSRS pdf report using command line utility which is a batch file
3.
Schedule
the batch file execution using Windows
Task Scheduler or SQL Job Agent.
Windows Task
Scheduler - Scheduled printing on single SSRS PDF file
Follow the below steps to configure the Windows Task
Scheduler
2. Click the Action menu, and then click Create Basic Task.
3. Do one of the following:
a.
To select a
schedule based on the calendar, click Daily, Weekly, Monthly, or One time,
click Next; specify the
schedule you want to use, and then click Next.
b.
To select a
schedule based on common recurring events, click When the computer starts or When I log on, and then click Next.
c.
To select a
schedule based on specific events, click When a specific event is logged, click Next; specify the event log and other information using the
drop-down lists, and then click Next.
4. To schedule a program to start automatically, click Start a program, and then click Next.
5. Click Browse to find the program
you want to start, and then click Next.
6. Click Finish.
SQL Server Agent - Scheduled
printing on single SSRS PDF file using
Follow the below steps to configure the SQL Server Agent –
1.
Go
to SQL Server Agent from SQL Management Studio and explore the Job-
2.
Right
click to the jobs and Select new job.
3.
In
general tab, named the job and select the category as uncategorized (local).
1. Select steps
tab and select new steps. Then
name the step name, select type as Operating
system (CmdExe). In the command open the batch file or write the command.
2.
Then
select OK and job is ready.
See also:
Complete the Scheduled printing of PDF file using VBScript file
See also:
Complete the Scheduled printing of PDF file using VBScript file
0 Comments