Configuring CreateScreenshot on SIMATIC WinCC Unified MTP1500
The CreateScreenshot system function on the SIMATIC HMI MTP1500 Unified Comfort Panel captures the current screen content and writes it to a file. On Comfort Panels (V15.1 and earlier, WinCC Comfort/Advanced) the function was tightly coupled with the panel's print system, and a "Print to PDF" device was often added in a single configuration step. On WinCC Unified V17/V18/V19/V20, the function behaves differently: it writes a raster file (PNG or JPG) to a Linux-style path, and PDF export is not built in. The runtime does not contain a system print function; PDF generation must be assembled from a CUPS printer, a JavaScript trigger, and a StartProgram call that invokes lp or lpr. The path that the function writes to must be a complete Linux path, not a Windows-style UNC or relative path, and it must point at a mount that the runtime user can write to. This reference describes the exact path conventions, CUPS configuration, and script wiring required to make CreateScreenshot on an MTP1500 produce a usable screenshot on a USB stick, and optionally convert that screenshot into a PDF.
MTP1500 Unified Comfort Hardware and Runtime
The MTP1500 is part of the SIMATIC HMI Unified Comfort family introduced with TIA Portal V17 and expanded through V18, V19, and V20. It runs a Linux-based runtime (based on the SIEMENS Industrial Edge / Yocto distribution) and exposes a configurable set of storage interfaces that the WinCC Unified runtime can write to. The relevant hardware features for screenshot export are summarized below.
| Feature | MTP1500 Specification |
|---|---|
| Display | 15.6" TFT, 1366 x 768, 16:9, multi-touch (capacitive) |
| Processor | ARM-based SoC, 4-core |
| Memory | 4 GB RAM, 32 GB internal storage (varies by model suffix) |
| External interfaces | 2 x USB 2.0 (X60, X61), 2 x Ethernet (X1, X2), 1 x RS-422/485 (X3) |
| Front USB (X61) | Used for service, image update, and runtime data export; mounted at /media/simatic/X61/
|
| Supported file systems on USB | FAT32, exFAT, ext3, ext4 (NTFS read-only on early firmware, read/write on V18+) |
| Minimum TIA Portal version | V17 Update 3 or later; V18 / V19 / V20 recommended for full feature parity |
| Minimum panel firmware | V17.0.0.3 for stable CreateScreenshot; V18.0.0.1 or later for parameter validation |
Output formats supported by CreateScreenshot
|
PNG, JPG, BMP (set by file extension) |
CreateScreenshot system function is only available for WinCC Unified Comfort Panels. Per Siemens KB entry 109828368, the compiler emits a warning if the function is used on a WinCC Unified PC Runtime (RT Unified) target. The PC RT equivalent is the WinCC Unified "ScreenShot" scripting method invoked from a C/C++ or C# runtime, not the panel-side system function. Always confirm the device type in the TIA Portal project tree before troubleshooting.
CreateScreenshot Function Reference
The system function CreateScreenshot is documented in the official WinCC Unified system functions reference. Per the TIA Portal V20 online help entry "CreateScreenshot (RT Unified)":
- Syntax:
CreateScreenshot(StoragePath : String) : Void - Parameter:
StoragePath– complete, fully qualified path including filename and extension. - Output format is determined by the file extension (e.g.
.png,.jpg,.bmp). - If a file already exists at the target path, it is overwritten without prompt.
- If the target path cannot be accessed (mount missing, permissions, or non-existent directory), an error is reported in the runtime diagnostics and the function returns without writing a file.
- The function is synchronous in V17/V18 and asynchronous in V19/V20 (returns immediately; file appears within 200-500 ms typically).
The official KB "CreateScreenshot – SIMATIC HMI WinCC Unified V19" (ID 109828368) explicitly states: "The system function 'CreateScreenshot' is only available for WinCC Unified Comfort Panel. The system outputs a compiler warning if the function is used on a non-Comfort target."
Problem Symptoms on the MTP1500
Three failure modes are observed in the field:
- No file is written. The runtime triggers the function on a button press, the HMI does not report an error, and the USB stick contains no new file. Existing alarm logs and trend exports on the same stick work, ruling out a general USB issue.
-
Runtime error in the diagnostics viewer.
StoragePathis rejected with a generic "path cannot be accessed" message (HMI event log ID 13100 - 13110 range, depending on firmware). - PNG is written, but PDF export is missing. The image is on the USB stick, but the user wanted a PDF (as was trivially possible on Comfort V15 panels by adding a PDF printer).
Root Cause Analysis
The Comfort V15 print system and the Unified runtime print system are completely different. On V15, a "PDF Drucker" was registered through the panel control panel and a system print function was invoked from the project. On Unified:
- There is no system print function in the runtime. The print subsystem is CUPS, and the project has no native hook into it.
- The
Printer Configurationentry in the "Apps" menu opens a browser pointing at the embedded CUPS web interface. The page only loads configuration options if the URL is the privileged/admin/path, not the default/path. - JavaScript on the panel can call
HMIRuntime.Screens.System.CreateScreenshot(path), but cannot directly invoke a print job. A print job must be issued throughStartProgramwith the CUPSlpclient. - USB mount points on Unified follow the Linux convention
/media/simatic/<interface>/, not the Windows-style/usb/orUSB:\used in legacy Comfort projects.
StoragePath parameter with a relative path, a Windows path, or a path that does not include the trailing slash on the mount point. The runtime will not normalize the path; it is passed verbatim to the Linux fopen call and silently fails if the parent directory is not present.
Storage Path Mapping
The mount points used by the WinCC Unified runtime on the MTP1500 are fixed. Use the values below verbatim.
| Interface | Linux Mount Point | Typical Use |
|---|---|---|
| Front USB (X61) | /media/simatic/X61/ |
Service, USB export, removable media |
| Rear USB (X60) | /media/simatic/X60/ |
Service on some MTP models; absent on MTP1500 in default configuration |
| Internal user storage | /home/simatic/ |
Non-removable; for testing only; not retained across image restore |
| SD card slot (if equipped) | /media/simatic/SD/ |
MTP1500 base model does not have SD; check hardware variant |
| Network share (CIFS) | /mnt/net/<name>/ |
Available if configured in TIA Portal under "Network drives" |
For a USB stick plugged into the X61 (front) port, a valid full path is:
/media/simatic/X61/screenshot.jpg
Do not include a Windows drive letter, do not use a UNC path, and do not rely on the runtime to create the directory tree. The directory /media/simatic/X61/ is created by the runtime when the USB stick is mounted.
Prerequisites
- SIMATIC HMI MTP1500 Unified Comfort Panel with firmware V17.0.0.3 or later (V18+ recommended).
- TIA Portal V18, V19, or V20 with WinCC Unified option installed.
- Project compiled for the MTP1500 device type (verify in the Devices & Networks editor; the panel must show "Unified Comfort" in the device classification).
- USB stick, FAT32 or ext4, with at least 32 MB free.
- Engineering access to the panel's CUPS admin interface (no separate password on early V17 firmware; V19+ may require the panel's service user).
Configuring the USB Storage Path
- Insert the USB stick in the front X61 port. Wait for the panel's "USB device connected" notification.
- On the engineering station, in TIA Portal, open the HMI project for the MTP1500.
- Open the screen that will host the screenshot button (e.g.
Screen_1). - Add a button. In the Properties pane, go to Events > Press.
- From the system function list, select CreateScreenshot.
- Set the
StoragePathparameter to/media/simatic/X61/screenshot.jpg(or.pngfor lossless). - Compile the project and download to the panel.
- Test the button. The file should appear in the USB root within one second. If it does not, check the runtime event log on the panel under Diagnostics > System Events.
Verifying the Mount on the Panel
If the path is rejected, open the panel's service shell (Settings > Apps > Service) and verify the mount:
ls -la /media/simatic/X61/
mount | grep X61
If the directory is empty or does not exist, the USB stick was not auto-mounted. Re-seat the stick, or check the file system: exFAT on a stick larger than 32 GB may require a firmware >= V18 Update 2 to mount reliably.
CUPS PDF Printer Configuration
The Unified runtime ships with CUPS installed. The default printer list is empty. To add a "Print to PDF" device, the privileged CUPS admin URL must be opened.
- On the panel, tap Apps on the launcher bar.
- Open the Printer Configuration tile. The default landing page is the public CUPS root.
- Change the URL in the browser address bar to
http://localhost:631/admin/. The administrative page will load. (The default root URLhttp://localhost:631/is read-only; the/admin/path is the only one that exposes the "Add Printer" form on the panel.) - Tap Add Printer. If prompted, supply the panel's service credentials. On firmware V17 / V18 the service user is
adminwith the password set during initial panel commissioning. - Choose Local Printers: CUPS-PDF (Virtual PDF Printer) as the device.
- Name the printer
Virtual_PDF_Printer(or any string that your script can reference). Avoid spaces in the name; thelpcommand may require quoting if spaces are used. - Make: Generic. Model: Generic Color PDF (en) or the equivalent locale variant.
- Confirm. The printer appears in the CUPS home page and in the panel's Printer Configuration tile.
http://localhost:631/admin/ is the supported configuration path. The default CUPS port (631) is bound to localhost only and is not reachable from the engineering network; the printer is intended for on-panel print jobs invoked by the runtime, not for printing from external clients.
Scripting PDF Conversion with StartProgram
After the PDF printer is registered, the runtime can convert a screenshot to PDF by invoking lp against the saved PNG. The cleanest approach is to combine CreateScreenshot with a JavaScript function that calls StartProgram with the CUPS command line.
JavaScript on the Button Press
// Function called by the button's "Press" event
export function SaveScreenshotAsPdf() {
const path = "/media/simatic/X61/screenshot.png";
HMIRuntime.Screens.System.CreateScreenshot(path);
// Wait briefly for the file to flush, then submit the print job.
// The delay is necessary because CreateScreenshot is async on V19/V20.
setTimeout(function() {
HMIRuntime.Systems.StartProgram(
"lp",
"-d",
"Virtual_PDF_Printer",
"-o",
"output-format=PDF",
"-o",
"print-color-mode=color",
"-o",
"fit-to-page",
path
);
}, 500);
}
Configuring the Button
- In TIA Portal, on the button's Press event, choose Add new function > Script and paste the function body above.
- Compile and download.
- Test: press the button, wait ~1.5 s, then verify that
screenshot.pdfappears in the CUPS spool directory (mounted by default under/var/spool/cups-pdf/<user>/and on some firmware versions written back to/media/simatic/X61/).
CUPS Spool to USB Directly
By default, cups-pdf writes its output to a spool directory that may not be on the USB stick. To force the PDF to land on the USB, edit /etc/cups/cups-pdf.conf on the panel:
Out /media/simatic/X61
AnonUserName simatic
After editing, restart CUPS:
systemctl restart cups
Verify with a manual test job from the panel shell:
lp -d Virtual_PDF_Printer -o output-format=PDF /media/simatic/X61/screenshot.png
ls -la /media/simatic/X61/
If the PDF is empty or zero bytes, the cups-pdf backend cannot write to the destination. Check directory ownership and the SELinux-equivalent AppArmor profile on the runtime (V19+ enforces a strict AppArmor profile for the CUPS backend; the /media/simatic/X61/ path is whitelisted, but custom paths are not).
Firmware and TIA Portal Compatibility
| TIA Portal Version | Panel Firmware | CreateScreenshot Behavior | Notes |
|---|---|---|---|
| V17 (initial) | V17.0.0.0 - V17.0.0.2 | Limited; some paths not validated | Update to V17.0.0.3 or later |
| V17 Update 3+ | V17.0.0.3+ | Reliable PNG export | PDF requires manual CUPS setup |
| V18 | V18.0.0.1+ | Path validation; better error reporting | Improved exFAT support |
| V19 | V19.0.0.x | Async execution; KB 109828368 published | Recommendation: update to latest V19 HSP |
| V20 | V20.0.0.x | Current; documented at TIA Portal V20 docs | Use the V20 online help as the reference |
Verification Procedure
- Insert a freshly formatted FAT32 USB stick in X61.
- Press the configured button on the MTP1500.
- Within 1 second, verify
screenshot.jpgexists on the USB root. File size for a 1366x768 capture is typically 200-600 kB for JPG, 1.5-3 MB for PNG. - If a PDF step is configured, wait an additional 1-2 seconds and verify
screenshot.pdfappears. - Open the file on a PC and confirm the screen content is correctly captured. Watch for the system time bar to confirm recency.
- Verify a second press overwrites the file (no prompt). If the file is not overwritten, check that the runtime user has write permission on the existing file (CUPS will fail to overwrite read-only files).
Troubleshooting Matrix
| Symptom | Likely Cause | Diagnostic Step | Resolution |
|---|---|---|---|
| No file written, no error in event log | Path is relative or uses Windows conventions | Inspect the configured StoragePath string in TIA Portal |
Use /media/simatic/X61/<file>.<ext>
|
| Event log: "Path cannot be accessed" (HMI event 13102) | USB not mounted or wrong interface | Check mount | grep simatic on panel shell |
Re-seat USB stick; confirm interface is X61 |
| Function not available in TIA Portal | Project is configured for PC RT, not Comfort Panel | Devices & Networks > check device type | Re-target project to MTP1500 Unified Comfort |
| Printer Configuration tile shows no printers | CUPS admin page not opened | Check URL in browser | Navigate to http://localhost:631/admin/
|
| CUPS shows "Add Printer" disabled | Service user not authenticated | Try a different admin URL or check service password | Reset panel service password; re-login |
| PDF written but zero bytes | CUPS-PDF cannot write to spool directory | Check /var/spool/cups-pdf/ permissions |
Set Out /media/simatic/X61 in cups-pdf.conf
|
| PDF written but on internal storage | CUPS-PDF Out path is default |
Inspect /etc/cups/cups-pdf.conf
|
Edit Out directive, restart CUPS |
| Script returns but PDF never appears |
StartProgram requires shell=true |
Check StartProgram configuration in TIA | Set WaitForCompletion = false, enable Execute in shell |
| Alarm logs write to USB but screenshot does not | Alarm logging uses a different mount path | Compare the configured paths in TIA Portal | Use the same /media/simatic/X61/ prefix as the alarms |
| exFAT stick not mounted | Early V17 firmware lacks exFAT support | Check dmesg on panel shell |
Update firmware to V18+ or reformat to FAT32 |
| NTFS stick not writable | NTFS write support is partial | Check mount -t ntfs result |
Reformat to exFAT or ext4 |
| File overwritten on each press with old content | CUPS-PDF cache returns stale file | Inspect /var/cache/cups/
|
Clear CUPS cache and use unique filenames per press |
Common Error Codes
| Event Log ID | Message | Cause |
|---|---|---|
| 13100 | CreateScreenshot: invalid parameter | Empty or null StoragePath |
| 13101 | CreateScreenshot: file system error | Generic I/O error on the path |
| 13102 | CreateScreenshot: path cannot be accessed | Mount missing, wrong interface, or permission denied |
| 13103 | CreateScreenshot: out of memory | Screen capture buffer exceeded; reduce color depth if custom |
| 13104 | CreateScreenshot: function not supported on this device | Project is PC RT, not Comfort Panel |
| 13105 | CreateScreenshot: image encoding failed | Unsupported extension or corrupt runtime |
On the CUPS side, the relevant log is at /var/log/cups/error_log on the panel. Look for entries containing Virtual_PDF_Printer and the timestamp of the last print job. A failed job will leave a client-error-document-format-not-supported or client-error-bad-request entry.
Alternative Export Methods
If the CUPS PDF route is too fragile, three alternatives are available without third-party tools:
-
Save as PNG only. Skip the PDF step. PNG is the native
CreateScreenshotoutput and is lossless. The MTP1500 captures at full 1366x768, which is sufficient for documentation purposes. -
Save with timestamped filename. Use a script to build the filename with
Date.now()to avoid overwriting:const ts = new Date().toISOString().replace(/[:.]/g, '-'); const path = "/media/simatic/X61/" + "shot_" + ts + ".png"; HMIRuntime.Screens.System.CreateScreenshot(path); -
Network drive export. Configure a network share in TIA Portal under Runtime settings > Network drives.
CreateScreenshotwill then accept a UNC-equivalent path like/mnt/net/archives/screenshot.pngand write the file to a CIFS share. This is the cleanest approach for unattended documentation collection.
Performance and Storage Considerations
A single full-screen capture on the MTP1500 at 1366x768 takes 200-500 ms (V18/V19 runtime; V20 is faster). PNG output is typically 1.5-3 MB; JPG quality-90 is 300-700 kB. The runtime does not delete old screenshots; if the button is pressed repeatedly, the USB stick will fill up. Implement a retention policy in the project (a separate scheduled task that prunes files older than N days from /media/simatic/X61/) for production deployments.
Security Notes
- The CUPS admin interface is bound to
localhost:631and is not externally accessible. Do not change the listen address in/etc/cups/cupsd.confwithout considering the operational security impact. - The service shell that gives access to
cups-pdf.confand the CUPS admin page is protected by the panel's service user password. Keep that password different from the runtime user password. - Screenshots may contain operator credentials or process values. Treat the contents as confidential and do not export to unencrypted shares.
Best-Practice Checklist
- Use
/media/simatic/X61/for the front USB port, not a relative path. - Add a 300-500 ms delay between
CreateScreenshotand any subsequent file operation to absorb the async write. - Configure a unique PDF printer name in CUPS; the future default name from Siemens may differ, so hard-coding the name in the script is acceptable as long as the script is reviewed on firmware upgrades.
- Test on the same firmware build that will run in production. Behavior of
CreateScreenshotchanged between V17 and V20. - Always test with the same USB stick model that will be used in the field; some sticks with proprietary controllers do not mount reliably on the MTP1500.
Why does my screenshot not appear on the USB stick even though the button works?
The StoragePath parameter in CreateScreenshot must be a complete Linux path. For the front USB port on the MTP1500 use exactly /media/simatic/X61/<filename>.<ext>. Relative paths and Windows-style paths are not normalized and result in a silent failure.
Can CreateScreenshot on Unified write a PDF directly?
No. The function writes a raster image (PNG, JPG, or BMP) determined by the file extension. PDF export must be added separately through a CUPS PDF printer and a StartProgram call to lp, as described in the Siemens KB entry 109828368.
How do I open the CUPS admin page on the panel?
From the panel's Apps menu, launch the Printer Configuration tile and change the browser URL to http://localhost:631/admin/. The default / path is read-only; only the /admin/ path exposes the "Add Printer" form on the MTP1500.
Why does the compiler warn about CreateScreenshot even though my device is a Comfort Panel?
The warning is emitted when the project is configured for a PC-based WinCC Unified Runtime rather than a Comfort Panel. Open Devices & Networks, confirm the device is a "SIMATIC HMI MTP1500 Unified Comfort", recompile, and the warning will disappear.
What file system should I use on the USB stick for the MTP1500?
FAT32 is supported on every Unified firmware version and is the safest choice. exFAT is supported on V18 Update 2 and later for sticks larger than 32 GB. NTFS is read-only on V17 and read/write on V18+ but has been observed to occasionally fail to mount on specific stick-controller combinations; prefer exFAT or ext4 when in doubt.
Is the CUPS PDF printer name going to change in a future Unified release?
Siemens has indicated that a default PDF printer will be bundled with a future runtime update. The exact name has not been published; configure your script to read the printer name from a tag or HMI variable so that the project can be updated by changing one string instead of recompiling every script.