Overview
Siemens WinCC operators frequently need to archive runtime process values, fault code text, and alarm summaries as portable, read-only documents. The native WinCC Report Designer outputs to a hardcopy spool, CSV, or RTF, but projects that produce HTML reports (typically via custom VBScript that joins the WinCC SQL archive with status tag dictionaries) cannot print directly to PDF through the standard layout designer. This article documents four production-proven paths for converting a WinCC-generated HTML file to PDF:
- Native WinCC 7.4 SP1+ text-tag logging + Report Designer layout (no scripting required).
- Report Designer with an ODBC dynamic object pointing at the archive database.
- VBScript automation of the Adobe Acrobat
AcroExch.AppActiveX interface (Acrobat full version, not Reader). - SQL Server Reporting Services / Business Intelligence export pipeline.
Each method has different hardware, licensing, and runtime-impact constraints. The decision matrix in Method Comparison below should be read first.
AcroExch.App) requires a fully licensed installation of Adobe Acrobat (Standard, Pro, or DC). The free Adobe Reader does not register the AcroExch COM class and will return the runtime error "ActiveX component can't create object: 'AcroExch.App'" even after a clean install. This is the most common field error and is addressed in the troubleshooting matrix.Prerequisites
| Requirement | Specification | Notes |
|---|---|---|
| WinCC version | 7.4 SP1 or later (preferred for text logging) | WinCC 7.4 base behaves differently; see Method 1. |
| SQL Server | 2008 R2 / 2012 / 2014 / 2016 / 2019 | WinCC archives ship as SQL DB; the same instance hosts the dynamic ODBC query. |
| OS | Windows 7 SP1 / Server 2008 R2 / Windows 10 / Server 2016/2019 | WinCC 7.4 SP1 compatibility list applies. |
| Adobe Acrobat (full) | XI / DC (2015+) recommended | Reader does not expose AcroExch.App. Demo/trial is sufficient for proof of concept. |
| VBScript runtime | Built-in (cscript.exe / wscript.exe) | WinCC schedules via WinCC Explorer > Computer > Startup or triggers via button event. |
| ODBC 32-bit | Configured SQL Server Native Client or SQL Server driver | WinCC Runtime is 32-bit; the ODBC data source must be 32-bit (%windir%\SysWOW64\odbcad32.exe). |
Method Comparison
| Method | License Cost | External Tooling | Output Quality | Runtime Overhead | Maintenance Burden | Best Use Case |
|---|---|---|---|---|---|---|
| 1. WinCC 7.4 SP1 text tags + Report Designer | 0 € (bundled) | None | High (vector, searchable) | Low | Low | Greenfield projects on supported WinCC build |
| 2. Report Designer + ODBC dynamic | 0 € (bundled) | None | High | Low | Medium (SQL knowledge) | Existing custom DB-driven reports |
| 3. Adobe Acrobat VBScript | Acrobat license | Adobe Acrobat full | Pixel-exact HTML render | Medium (process spawn) | Low (script once) | Custom HTML layouts from VBScript |
| 4. SQL Server BI / SSRS | SQL Std license | SSRS / SSDT | High | Low (scheduled job) | Medium-High | Multi-site reporting, web portal delivery |
Method 1 — Native Text in WinCC TagLogging (7.4 SP1+)
Prior to WinCC 7.4 SP1, the Tag Logging archive could only persist numeric values. Any attempt to log a string tag (e.g., 1 = Running, 2 = Stopped, 3 = Fault Code, 4 = Unavailable) failed silently or returned datatype mismatch. Starting with WinCC 7.4 SP1, string-tag logging became officially supported. The decision path for ambiguous "WinCC 7.4" references is to verify the exact installed build in SIMATIC WinCC Explorer > Help > About: only 7.4.0.1 and later reliably expose this feature.
Steps to migrate an existing project:
- Open Tag Logging editor.
- Add a new archive tag, datatype
String(8-bit) orText(16-bit, double-byte). Length up to 256 characters. - Map your status dictionary (1=Running, etc.) via a derived text tag or Tag Conversion on the PLC side using a function block that writes both the integer code and the human-readable string.
- Use the standard Report Designer > Alarm Logging Report or Tag Logging Report layout, choosing PDF as the printer destination directly — no HTML intermediate required.
This eliminates the entire HTML-to-PDF conversion chain for new projects.
Method 2 — Report Designer with ODBC Dynamic Database Object
When the HTML report is generated because the layout references fields the standard report templates cannot reach (e.g., computed columns, custom joins, or string translations), you can keep using your VBScript + SQL pipeline but route the result through the Report Designer via the Dynamic Database Object:
- Open Report Designer.
- Insert a Dynamic Object > ODBC Database into a page layout.
- Configure the connection to the same SQL instance holding the WinCC archive. The Connection string uses the same ODBC 32-bit DSN defined under
SysWOW64\odbcad32.exe. - Paste your SQL query. Example for the status dictionary joined with the TagLogging archive:
SELECT a.Timestamp, a.TagName, a.RealtimeValue, b.TextValue, b.Description FROM dbo.Archive a LEFT JOIN dbo.StatusLookup b ON a.TagName = b.TagName AND a.RealtimeValue = b.IntCode WHERE a.Timestamp BETWEEN '2024-01-01' AND '2024-01-02' ORDER BY a.Timestamp DESC; - Set the print destination to PDF file in the report's Properties > Print Job.
This is the cleanest path when you already have the SQL knowledge: you keep the report server-side, version-controlled in the WinCC project, and the resulting PDF is generated by WinCC's own spooler with no VBScript error surface.
Method 3 — VBScript Automation of Adobe Acrobat
Use this path when the HTML report is already produced by an existing VBScript routine and you want a drop-in PDF conversion step at the end of that script.
3.1 Install and Verify Acrobat ActiveX
- Install full Adobe Acrobat (not Reader). A 30-day trial is acceptable for commissioning.
- Verify the COM class is registered:
Expected result: a message box showing the Acrobat version (e.g., "19.010.20098"). If it fails with Error 429, the install is Reader-only or the COM class was unregistered.cscript //nologo -e:vbscript "MsgBox CreateObject(""AcroExch.App"").Version" - Re-register the class manually if needed:
regsvr32 "C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\acrobat.tlb"
3.2 Conversion Subroutine
' WinCC_VBS - HtmlToPdf.vbs
' Requires: Adobe Acrobat (full), not Reader.
Option Explicit
Const g_sHtmlPath = "C:\WinCC_Reports\DailyReport.html"
Const g_sPdfPath = "C:\WinCC_Reports\DailyReport.pdf"
Sub HtmlToPdf_Acrobat(sHtml As String, sPdf As String)
Dim oApp, oAvDoc, oPDDoc, oJSObject
Dim sTmpPdf As String
On Error GoTo EH
Set oApp = CreateObject("AcroExch.App")
oApp.Hide ' silent run
Set oPDDoc = CreateObject("AcroExch.PDDoc")
' Step 1: open the HTML as a PDF via the Internet Explorer PDFMaker hook
' (Acrobat converts HTML to PDF internally before display)
If Not oPDDoc.Open(sHtml) Then
Err.Raise vbObjectError + 1001, , "Open HTML failed: " & sHtml
End If
' Step 2: save to the target path
sTmpPdf = Replace(sHtml, ".html", "_tmp.pdf")
If Not oPDDoc.Save(1, sTmpPdf) Then ' 1 = PDSaveFull
Err.Raise vbObjectError + 1002, , "Save PDF failed"
End If
oPDDoc.Close
Set oPDDoc = Nothing
oApp.Exit
Set oApp = Nothing
' Step 3: rename / move to final destination
Dim oFSO: Set oFSO = CreateObject("Scripting.FileSystemObject")
If oFSO.FileExists(sPdf) Then oFSO.DeleteFile sPdf, True
oFSO.MoveFile sTmpPdf, sPdf
Set oFSO = Nothing
Exit Sub
EH:
If Not oPDDoc Is Nothing Then oPDDoc.Close
If Not oApp Is Nothing Then oApp.Exit
Err.Raise Err.Number, Err.Source, Err.Description
End Sub
' --- driver: invoke from a WinCC button or scheduled task ---
Call HtmlToPdf_Acrobat(g_sHtmlPath, g_sPdfPath)
3.3 Alternative: Convert HTML String to PDF Directly
When the HTML payload lives in memory (a VBScript string built from Recordset.GetString), write it to a temp .htm first, then convert. The same AcroExch.PDDoc.Open method accepts both file paths and rendered strings via the AcroExch.HTMLControl plugin — but the file-based path is the most stable across Acrobat XI, DC 2015, and DC 2024.
Method 4 — SQL Server Business Intelligence / SSRS
For multi-site or web-delivered reporting, the highest-density path is:
- Build a Reporting Services (SSRS) report that queries the WinCC archive DB (linked server or direct).
- Schedule the report with a subscription set to delivery type: File Share, file format PDF, and a recurring schedule (e.g., 23:55 daily).
- Alternative free path: SQL Server Data Tools + a Report Builder report, executed by a SQL Server Agent job that runs a PowerShell
Export-RsReportcall.
Output formats supported by SSRS subscriptions include CSV, HTML, PDF, Word, Excel, XML, MHTML, and image (TIFF/PNG). This list is the same set returned by SSRS RenderFormat enumeration.
Field-Commissioned Procedure (End-to-End)
- Confirm the HTML file exists and is well-formed. Validate with a quick
cscript //nologo HtmlToPdf.vbsfrom a command line first; isolate HTML-generation errors from PDF-conversion errors. - Confirm
CreateObject("AcroExch.App")succeeds before scheduling anything. A failed create here is the root cause of 80% of "works on my machine, fails on SCADA server" reports. - Schedule the script via Windows Task Scheduler with the credential of the WinCC Runtime user. The script must run in a session where Acrobat is allowed to spawn a child process; do not run as
SYSTEM. - From within WinCC, trigger the script by adding a button event:
Wait parameterSub OnClick(ByVal Item) Dim oShell: Set oShell = CreateObject("WScript.Shell") oShell.Run "cscript //nologo C:\Scripts\HtmlToPdf.vbs", 0, True Set oShell = Nothing End SubTrueblocks the WinCC thread until the PDF is ready, preventing concurrent overwrites of the output file. - Add a post-step that copies the PDF to a network share or sends it via SMTP. Many sites use blat or a PowerShell
Send-MailMessagecall for emailing daily reports.
Troubleshooting Matrix
| Symptom | Root Cause | Verification | Fix |
|---|---|---|---|
| ActiveX component can't create object: 'AcroExch.App' | Adobe Reader is installed, or Acrobat COM is unregistered | Check Programs and Features for "Adobe Acrobat", not "Reader" | Install Acrobat full version, or run regsvr32 on acrobat.tlb
|
| PDF generated but file is 0 bytes | Source HTML references external CSS/images via http:// that Acrobat cannot resolve | Open the HTML in a browser; verify images load | Inline CSS and base64-embed images, or copy to a local path |
| Error 429 (ActiveX cannot create object) on startup | WinCC service account lacks Desktop permissions for Acrobat | Check DCOM Config > Adobe Acrobat launch permissions | Grant Local Launch and Activation to the WinCC runtime account |
| VBScript runs but WinCC screen freezes | Synchronous call blocks UI thread | Inspect oShell.Run — must be ,0,True with hidden window |
Use cscript //nologo + 0,True and confirm windowstyle is hidden |
| PDF has Cyrillic / Asian glyphs as boxes | Acrobat's font fallback path doesn't include the language pack | Open PDF on a non-SCADA PC | Install the relevant Acrobat Language Pack or embed fonts in the HTML |
| Report Designer ODBC dynamic returns empty result set | 32-bit vs 64-bit DSN mismatch (WinCC is 32-bit) | Verify DSN in %windir%\SysWOW64\odbcad32.exe
|
Create the DSN in 32-bit ODBC, not 64-bit |
| WinCC 7.4 reports datatype error when string tag is logged | Build is pre-SP1 | Check Help > About | Upgrade to WinCC 7.4 SP1+ or use a derived numeric tag + dictionary join |
Performance and Sizing Notes
A single Acrobat PDFMaker pass over a 200-row HTML table takes approximately 1.5-3.5 s on a WinCC 7.4 SCADA server (Xeon E3-1270, SATA SSD, 16 GB RAM). For batch runs exceeding 50 reports, prefer SSRS subscription batching over a serial VBScript loop — Acrobat is a heavy COM client and does not benefit from in-process parallelism. If a single WinCC project must generate hourly reports, consider a 1-minute out-of-phase stagger per report to keep CPU below 30% on the runtime server.
Security Hardening
- Restrict the HTML source directory with an NTFS ACL that grants Modify only to the WinCC runtime account; the script should not accept arbitrary paths from operator input.
- If the script reads from a user-supplied query, parameterize the SQL inside Method 2 to prevent injection — the Report Designer ODBC object supports bound parameters via
?placeholders. - Disable Acrobat's protected mode exceptions for the WinCC bin path; conversely, do not run Acrobat with Full Trust on a non-isolated DMZ SCADA server.
Verification Checklist
-
CreateObject("AcroExch.App")returns a valid object from a command prompt under the WinCC runtime user. - A known-good HTML file produces a non-zero, non-locked PDF of correct page count within 5 s.
- The PDF opens in both Acrobat and Reader without security warnings.
- Special characters, status dictionary text, and timestamp formats are searchable in the resulting PDF (i.e., they are real text, not rasterized).
- Triggering the script from a WinCC button returns control to the operator within the expected window and the PDF is accessible from the configured network share.
- Two consecutive runs do not collide on the output file (file-locking is correctly handled via
FSO.DeleteFilebefore the secondMoveFile).
FAQ
Why does AcroExch.App fail with "ActiveX component can't create object" even after installing Acrobat Reader?
Adobe Reader does not expose the AcroExch COM automation interface. Only a fully licensed Adobe Acrobat (Standard, Pro, DC) registers the AcroExch.App, AcroExch.PDDoc, and AcroExch.AVDoc classes. Install full Acrobat, then verify with cscript -e:vbscript "MsgBox CreateObject("AcroExch.App").Version" — it should return a version string like 19.010.20098.
Can I log string values directly to the WinCC Tag Logging archive?
Yes, on WinCC 7.4 SP1 and later. Add an archive tag of datatype String (8-bit, up to 256 characters) or Text (16-bit, double-byte). On WinCC 7.4 base the feature is not reliably available — verify the exact build in WinCC Explorer > Help > About before committing to this path, and use Method 2 or 3 as a fallback.
Does the Report Designer support a direct query to the archive database?
Yes. Insert a Dynamic Object > ODBC Database into the report layout and bind it to a 32-bit ODBC DSN pointing at the same SQL Server instance that hosts the WinCC archive. Free-form SQL is accepted, and parameter binding via ? placeholders prevents injection. Configure the print job's destination to PDF for direct file output.
What alternative avoids Adobe Acrobat entirely?
Use SQL Server Reporting Services (SSRS) with a subscription configured to deliver the report as a PDF file share. SSRS supports CSV, HTML, PDF, Word, Excel, XML, MHTML, and image (TIFF/PNG) output formats. This path requires no third-party COM automation and is the recommended route for multi-site deployments.
How do I trigger the VBScript from a WinCC button without freezing the operator screen?
Use WScript.Shell.Run "cscript //nologo C:\Scripts\HtmlToPdf.vbs", 0, True. The first 0 hides the window; True makes the call synchronous so the button event blocks until the PDF is ready, preventing concurrent file overwrites. Avoid running as SYSTEM and verify DCOM launch permissions for the WinCC runtime account on the Adobe Acrobat DCOM application.