Problem Overview
The Siemens WinCC Report System provides the RPTJobPrint call to print a configured report job, but the function only passes a job name to the underlying print spooler. When the configured Windows printer is CutePDF Writer, qvPDF, or another PostScript-based PDF writer configured with a FILE:-style port, the spooler intercepts the job and immediately pops a Save As dialog requesting a destination file and an explicit operator confirmation.
That prompt silently breaks four common use cases:
- Unattended night-shift production reports triggered from a scheduled WinCC action
- Batch report jobs fired from Siemens WinCC alarm or tag-event handlers
- Loop-driven archive back-up scripts that print the same job dozens of times per shift
- HMI button hand-off to operators who expect zero manual steps
The dialog cannot be bypassed from VBScript inside WinCC. RPTJobPrint does not accept an output filename argument and never has; the dialog is generated by the printer driver, not by the WinCC runtime. The correct fix is to replace the default PDF writer with one that accepts a programmatic output path (or to upgrade the existing writer to a Developer/Pro edition). Six strategies are detailed below.
WinCC Report Printing Architecture
Understanding the data flow is essential before selecting a fix. A WinCC report job traverses this pipeline:
WinCC Runtime
-> Report Designer Job Definition
-> RPTJobPrint API call (VBScript / C / Global Action)
-> WinCC internal print spooler
-> Microsoft Windows Print Spooler
-> Configured Windows Printer (PostScript pass-through)
-> PDF Writer UI shim <-- "Save As" dialog blocks here
-> Disk file (.pdf)
The output file is created by the printer's rendering layer. Native Microsoft Print to PDF (a built-in component of Windows 10+) and every third-party PDF writer (CutePDF Writer, Bullzip, PDFCreator, qvPDF) all share the same architecture: a Windows printer, a virtual port, and a UI shim that asks for the target file.
RPTJobPrint never sees the filename. Its signature is fixed and there is no overload for an output path, no environment variable hook, and no optional DEVMODE override. The WinCC internal print spooler hands the job to the OS spooler using the configured printer's default settings, which means no programmatic destination substitution is possible at the WinCC layer.
RPTJobPrint Function Reference
The RPTJobPrint function originates from the WinCC Report Designer API and is callable from:
- VBScript inside Graphics Designer events (Button "Click", Mouse "Action")
- Global Scripts under the Graphics and Actions folders
- C scripts in legacy projects (WinCC V6.x and earlier) via the function pointer import
- Connectivity Pack alarm triggers that route into scripts via OPC
Syntax patterns encountered across versions:
' WinCC V7.x modern call (VBScript)
Dim ret
ret = HMIRuntime.PrintReport("DailyBatchReport")
' Legacy RPT function (older projects, still supported)
Dim ret
ret = RPTJobPrint("DailyBatchReport")
Error-handling convention: WinCC writes diagnostic entries to the diagnose folder. Inspect C:\Program Files (x86)\Siemens\Automation\WinCC\Diagnose\WinCC_Sys_<server>.log and search for "RPT" lines whenever a job silently fails to produce a PDF.
Why the Save As Dialog Appears
The dialog is generated by the PDF printer's UI module. Three conditions force its appearance:
- The printer class is set to
FILE:output or an equivalent virtual port. - The print job arrives without a destination string in the
DEVMODEstructure. - The PDF driver has no programmatic hook to receive a path before the writer starts.
PostScript printers traditionally wrote to FILE:, and modern Windows PDF writers wrap that handler with a Save As dialog so the user picks a folder. CutePDF does this specifically because its underlying PostScript interpreter (Ghostscript) must hand off to a writer that creates the PDF, and that handoff is delayed until the user supplies a path.
A small number of writers let you set the destination in advance. Configuring the printer's Properties → Advanced → Printing defaults → Save settings to an autosave folder is supported by Bullzip PDF Printer, qvPDF, and PDFCreator free/pro. The free edition of CutePDF Writer does not expose the autosave option; only CutePDF Developer Edition does.
SendKeys as a workaround. The Save As dialog owner is the spooler, not WinCC, and SendKeys fails under UAC elevation, on localized keyboards, and across Windows builds. Treat it as a development-only fall-back.Solution Strategies
Six proven strategies exist. Pick by deployment constraints and budget:
- Replace the Windows PDF writer with one that supports an automatic-output setting (Bullzip PDF Printer, qvPDF, PDFCreator, Win2PDF Pro). These suppress the dialog once configured.
- Purchase CutePDF Developer Edition and use its COM API for direct programmatic output.
- Redirect the job to Microsoft Print to PDF via a SumatraPDF command-line intercept that writes a fixed output filename.
- Forward the print job to a Microsoft PDF print queue hosted on a server share and use Windows print routing.
- Use a custom file-redirection shim that registers as a printer and writes directly to disk. Only justified for highly regulated, audit-bound environments.
- Use a name pipe at the WinCC station's Printer Properties → Ports → Add Port → Local Port to bypass GUI entirely.
The first two options cover ninety percent of real installations. The remainder are reserved for edge cases that still need to be acknowledged.
Solution A: Bullzip PDF Printer (Recommended for Free Deployment)
Bullzip PDF Printer is licensed free for commercial use and installs a printer named "Bullzip PDF Printer" with a persistent settings dialog that supports silent output.
Capabilities directly relevant to WinCC automation:
-
settings.inifile with full output control, applied per user-profile - Run-time override via command-line argument
-o "filename.pdf" - COM interface for advanced scripting
- PDF profile support (one named configuration per report job)
Step-by-step configuration is covered in Section 10 below. For pure automation without any VBScript wrapper, drop a settings.ini in the WinCC service account's documents folder:
[General]
Output=D:\Reports\
[PDF]
ShowSettings=never
ShowPDF=no
Applysettings=default
UseTitleAndSubject=false
[Watermark]
WatermarkText=
WatermarkPosition=diagonal
The ShowSettings=never entry suppresses the dialog entirely. The default output folder becomes the destination; filename generation falls back to the job name with a .pdf extension, with collision handling governed by the FileOverwrite flag.
Solution B: CutePDF Developer Edition
The free CutePDF Writer is what creates the Save As dialog by default. CutePDF Developer Edition is a paid upgrade that exposes the same underlying writer to a programmatic COM interface and removes the mandatory Save As prompt when an output path is supplied. The upgrade is binary backward compatible at the print-spooler layer; existing WinCC jobs that referenced "CutePDF" continue to print without recompilation.
Implementation in WinCC uses the included COM wrapper:
' WinCC VBScript wrapper around CutePDF Developer COM
Dim pdf
Set pdf = CreateObject("CutePDF.Document")
Dim outputPath
outputPath = "D:\Reports\DailyReport_" & _
Replace(Date, "/", "-") & ".pdf"
pdf.SaveAs outputPath
pdf.SaveSettings
pdf.Close
HMIRuntime.PrintReport "DailyBatchReport"
Per the manufacturer FAQ (https://www.cutepdf.com/support/faq.asp) on bypassing the Save As dialog with unattended installation: the Developer Edition must be registered on the deployment station once via regsvr32 using the install package's Register shortcut.
Solution C: SumatraPDF as Print-to-PDF Translator
SumatraPDF is a small open-source PDF reader that also operates as a command-line print-to-PDF utility. In a two-step workflow it supplies a fixed output path even when the underlying Windows printer would normally pop a dialog.
Workflow:
WinCC RPTJobPrint
-> Microsoft Print to PDF (normally pops dialog; we never reach this dialog)
-> SumatraPDF intercepts via Ghostscript pipe
-> Writes fixed filename on disk
Command-line pattern from the SumatraPDF manual:
SumatraPDF.exe -print-to "Microsoft Print to PDF" -print-settings "11x17" input.pdf
Configure SumatraPDF's "Printer" to Microsoft Print to PDF and "Output file" to a templated path that resolves at run time. For tag-driven substitution, drive SumatraPDF with an input file whose name encodes the tag values and let the Output template write the final result.
This option is attractive when WinCC is locked to a specific printer and the WinCC station's default cannot be changed. The intermediate folder must exist and be writable by the WinCC runtime service account.
Solution D: PDFCreator (Free, Open Source)
PDFCreator ships with a documented COM interface that accepts an output filename programmatically:
Dim job
Set job = CreateObject("PDFCreator.Job")
job.OutputFilename = "D:\Reports\DailyReport.pdf"
job.Run "NoSaveDialog"
Full COM documentation is at PDFCreator COM reference. The free edition is sufficient for filename automation; the paid edition adds PDF/A validation and digital signatures which are not required for raw filename substitution.
Configure PDFCreator as the WinCC destination printer, then drive it from a thin VBScript wrapper that sets OutputFilename before invoking RPTJobPrint.
Step-by-Step: Bullzip with Tag-Driven Filenames
This procedure assumes WinCC V7.x, Windows Server 2019 or later, and a project with at least one report job defined in the Report Designer.
- Acquire Bullzip PDF Printer from the Bullzip download page and run the installer on the WinCC runtime station. Pick the 64-bit variant on modern Windows.
- Launch Bullzip PDF Printer → Settings → Advanced. Toggle Show Settings dialog off and set Default output folder to a path the WinCC runtime service account can write to, e.g.
D:\Reports\. - Under PDF Settings → Output, tick Always overwrite if exists for deterministic archive behaviour, or Rename automatically if you want history preserved.
- In WinCC Configuration Studio or WinCC Explorer, open the Report Designer and edit the report job's printer property. Change it from "CutePDF Writer" to "Bullzip PDF Printer".
- Add a Global Script action that wraps the print call and renames the default output using tag values. Place under Global Script → VBS-Editor → New Action. Use the body shown in the next section.
- Test the configuration by triggering the Global Script manually from WinCC Explorer's diagnostics tools before attaching it to a scheduled event.
- Wire the action to the desired trigger — a tag change on a "ReportRequested" tag, an alarm-based trigger from the Connectivity Pack, or a scheduled task via the WinCC scheduler.
Sample VBScript: Tag-Driven Filename Composition
A production-grade wrapper covers archive tags, retry logic, and PDF file size stability. The script below is suitable for direct paste into a WinCC Global Script or a Button "Click" event:
Option Explicit
Const REPORT_FOLDER = "D:\Reports\"
Const BULLZIP_OUTPUT = "D:\Reports\BullzipOutput.pdf"
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim shell : Set shell = CreateObject("WScript.Shell")
Dim strBatchID : strBatchID = HMIRuntime.Tags("ProcessTags\BatchID").Read
Dim strLine : strLine = HMIRuntime.Tags("ProcessTags\LineCode").Read
Dim strTimestamp : strTimestamp = FormatDateTime(Now, vbGeneralDate)
Dim strFile
strFile = "Report_" & strLine & "_" & strBatchID & "_" & _
Replace(Replace(strTimestamp, "/", "-"), " ", "_") & ".pdf"
Dim strTarget : strTarget = REPORT_FOLDER & strFile
If Not fso.FolderExists(REPORT_FOLDER) Then
fso.CreateFolder REPORT_FOLDER
End If
' Clear any leftover Bullzip default file from previous run
If fso.FileExists(BULLZIP_OUTPUT) Then
fso.DeleteFile BULLZIP_OUTPUT
End If
' Trigger print
HMIRuntime.PrintReport "DailyBatchReport"
' Wait for file size to stabilize (15 s ceiling)
Dim lastSize, currentSize
lastSize = -1
Dim i
For i = 1 To 30
WScript.Sleep 1000
If fso.FileExists(BULLZIP_OUTPUT) Then
currentSize = fso.GetFile(BULLZIP_OUTPUT).Size
If currentSize > 0 And currentSize = lastSize Then
Exit For
End If
lastSize = currentSize
End If
Next
' Rename to tag-derived filename
If fso.FileExists(BULLZIP_OUTPUT) Then
On Error Resume Next
If fso.FileExists(strTarget) Then
' Collision policy: append timestamp suffix
strTarget = REPORT_FOLDER & _
Left(strFile, Len(strFile) - 4) & "_" & _
FormatDateTime(Now, vbShortTime) & ".pdf"
strTarget = Replace(strTarget, ":", "")
End If
fso.MoveFile BULLZIP_OUTPUT, strTarget
If Err.Number <> 0 Then
HMIRuntime.Trace "Rename failed: " & Err.Description & vbNewLine
Err.Clear
End If
On Error Goto 0
End If
HMIRuntime.Trace "Report generated: " & strTarget & vbNewLine
Notes on the script:
-
Replace(..., "/", "-")sanitises filesystem-unsafe characters from tag values. - The two-step size check (
lastSize = currentSizeon consecutive ticks) detects the writer's flush event reliably without depending on a vendor-specific notification. -
On Error Resume Nextaround theMoveFilecall prevents one corrupted file from aborting the next iteration in a loop.
Verification Procedures
-
Manual trigger. Click the HMI button or run the Global Action; confirm no dialog appears and the file lands in
D:\Reports\with the expected name. - Tag substitution. Change a tag used in filename composition, print again, confirm the new filename reflects the new value.
- Folder permissions. Confirm the WinCC runtime service account (typically CCAdmin or a custom service user) has Modify rights on the output folder.
-
High-volume run. Trigger 50 prints in a row; confirm no orphan
BullzipOutput.pdfremains at the end of the loop. - Cold-boot. Reboot the runtime station, restart WinCC Runtime, fire a print, confirm success on first attempt.
- Spooler resilience. Pause the print spooler mid-print, resume, confirm WinCC recovers and the file is written cleanly.
- Archive tie-back. Confirm the final filename matches the archive tag time slice actually contained in the PDF (subject to spooler delay).
Troubleshooting Matrix
| Symptom | Likely Cause | Verification | Fix |
|---|---|---|---|
| Save As dialog still appears | Printer default not changed in WinCC report job | Open Report Designer → job → Printer property | Update printer in Report Designer |
| BullzipOutput.pdf stuck in folder | Rename loop lost race against the writer | Compare timestamp of orphan file to last print attempt | Increase wait; switch to file-size polling |
| Empty PDF generated | Tags referenced by report were offline at print time | Open PDF, inspect pages and tables | Add pre-print tag health check; defer print until tags valid |
| Access denied on move | Folder permission on output path wrong | Test write with same service account interactively | Grant Modify on the folder to the runtime service account |
| PostScript overflow / page not found | Report too large for spooler buffer | Inspect spooler %systemroot%\System32\spool\PRINTERS
|
Paginate the report; reduce per-job page count |
| Auto-print fails after reboot | Spooler service start mode wrong | sc qc Spooler | Set spooler start mode to Automatic (Delayed Start) |
| Filename contains invalid characters | Tag value carries :, /, or Unicode |
Print a known-bad tag value, capture filename | Sanitise filename input before MoveFile |
| File never appears | Bullzip version incompatibility after OS update | Event Viewer → Application → Bullzip errors | Reinstall Bullzip after major Windows feature updates |
| COM error: CutePDF.Document not registered | CutePDF Developer not registered post-install | regedit → search "CutePDF.Document" | Run installer's Register shortcut as Administrator |
| Two files written for one job | Job retriggered by script fail-safe | WinCC syslog for repeated RPTJobPrint calls | Add 30 s re-trigger suppression guard |
| PDF readable but no data | Wrong archive window selected in report job | Open PDF, inspect timestamps | Verify TimeFilter settings on the report job |
| Spooler queue stalls | Multiple simultaneous jobs from one station | spooler panel → queue depth | Queue jobs in VBScript or assign per-job printer instances |
Operational Notes and Field Caveats
- File-size polling is more reliable than fixed sleeps. A PDF being written grows in stages; two consecutive identical, non-zero readings signal a closed file. Expect 1 to 3 seconds of quiet time for the writer to flush.
-
The Bullzip "Show settings" UI is per-user. The WinCC service account's profile must have the dialog suppressed, not just the interactive account that ran the installer. Validate via
psexec -i -u <svcaccount> notepadon the runtime station, then re-open the printer settings. - Antivirus and the freshly written PDF. Some AV products lock or quarantine a brand-new PDF for cloud inspection, breaking the rename step. Add an exclusion for the output folder when production PDFs vanish mid-write.
-
WinCC V8 (TIA Portal). The print architecture changed.
HMIRuntime.PrintReportkeeps the same name but spooler behaviour is different. Bullzip and PDFCreator flows generally continue to work; CutePDF Developer requires re-verification. - Path length. Windows MAX_PATH is 260 characters. Plan for unlimited output, log on first 256 chars, allow redirect to a deeper share if batch IDs are long.
- UTC vs local time. Tags carrying UTC strings will produce filenames that do not match local-archive-name conventions. Strip the timezone before composing if downstream tooling expects local.
- Two printers, two folders. If you operate two Bullzip instances with different settings, configure each via its own named profile under Bullzip → Settings → Profiles, not by swapping the default output path.
- Cold-start residuals. After a WinCC Runtime restart, the spooler queue may carry over old jobs. Drain the queue before the first scheduled job runs to avoid filename collisions on the first day.
Why does WinCC RPTJobPrint always pop a Save As dialog?
RPTJobPrint routes the report to the configured Windows printer. CutePDF Writer, qvPDF, and most PostScript-based PDF writers ship with an interactive Save As UI that activates when the print job arrives without a destination in DEVMODE. Configure a PDF writer that supports automatic output (Bullzip, PDFCreator) or upgrade to CutePDF Developer Edition to bypass the prompt programmatically.
Can I auto-fill the Save As filename from VBScript with SendKeys?
SendKeys works in some quick-test scenarios but is locale-dependent, fails under UAC elevation, and breaks across Windows feature updates. For production, use a PDF writer with a programmatic output setting (Bullzip autoini, PDFCreator COM, CutePDF Developer COM) instead of relying on synthetic keystrokes.
Does Bullzip PDF Printer support dynamic filenames based on WinCC tag values?
Not directly. Bullzip cannot read WinCC runtime tags. Use a wrapper script that prints via RPTJobPrint and renames the default output file based on tag values after the writer has finished. See the sample code above for a working pattern.
Is Bullzip PDF Printer really free for commercial use?
Yes. Bullzip PDF Printer is licensed free for commercial use and ships as a signed installer. Limitations versus paid alternatives include a watermark in the unregistered free mode; the registered free mode removes it.
What is the recommended wait time between RPTJobPrint and the file rename?
Fixed waits (e.g., 1.5 seconds) work in low-volume contexts but race the writer under load. Use file-size polling: read the file's size every 500 to 1000 ms and treat two identical, non-zero readings as the signal that the file has been closed. Cap the poll loop at 30 seconds before raising an alarm.