Add PrintToPDF to webview (Edge and macOS) (PR #26583)

41 views
Skip to first unread message

Blake-Madden

unread,
Jun 13, 2026, 10:52:13 AM (11 days ago) Jun 13
to wx-...@googlegroups.com, Subscribed

Adds parity to Qt's webview engine.


You can view, comment on, or merge this pull request online at:

  https://github.com/wxWidgets/wxWidgets/pull/26583

Commit Summary

  • 8df50fe Add print to PDF for Edge WebView
  • 341c62c Add PDF printing to sample
  • 92de977 Add PDF export to macOS backend
  • 79b8e57 Add documentation

File Changes

(8 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583@github.com>

Blake-Madden

unread,
Jun 13, 2026, 10:53:17 AM (11 days ago) Jun 13
to wx-...@googlegroups.com, Subscribed
Blake-Madden left a comment (wxWidgets/wxWidgets#26583)

I have to get a new Linux machine. Once I get that, I can look into adding support there too.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/c4698859245@github.com>

VZ

unread,
Jun 13, 2026, 2:49:04 PM (10 days ago) Jun 13
to wx-...@googlegroups.com, Subscribed

@vadz commented on this pull request.

Thanks, looks good! Just 2 minor comments that it would be nice to address before merging.


In src/msw/webview_edge.cpp:

> +{
+    if (!m_impl->m_webView)
+        return false;
+
+    wxCOMPtr<ICoreWebView2_7> webView7;
+    if (FAILED(m_impl->m_webView->QueryInterface(IID_PPV_ARGS(&webView7))))
+        return false;
+
+    const wxString filePathCopy = filePath;
+    HRESULT hr = webView7->PrintToPdf(
+        filePath.wc_str(),
+        nullptr,
+        Callback<ICoreWebView2PrintToPdfCompletedHandler>(
+            [this, filePathCopy](HRESULT errorCode, BOOL isSuccessful) -> HRESULT
+            {
+                wxWebViewEvent event(wxEVT_WEBVIEW_PDF_SAVED, GetId(), filePathCopy, wxString());

It's better to allocate this event on heap and use QueueEvent(). Or, alternatively, use CallAfter() to generate this event directly from the main thread.


In src/msw/webview_edge.cpp:

> +            ? COREWEBVIEW2_PRINT_ORIENTATION_LANDSCAPE
+            : COREWEBVIEW2_PRINT_ORIENTATION_PORTRAIT);
+
+    wxSize paperSizeTenthsMM = wxThePrintPaperDatabase->GetSize(printData.GetPaperId());
+    if (paperSizeTenthsMM.x > 0 && paperSizeTenthsMM.y > 0)
+    {
+        double widthInches = paperSizeTenthsMM.x / 254.0;
+        double heightInches = paperSizeTenthsMM.y / 254.0;
+        printSettings->put_PageWidth(widthInches);
+        printSettings->put_PageHeight(heightInches);
+    }
+
+    printSettings->put_ShouldPrintHeaderAndFooter(FALSE);
+
+    const wxString filePathCopy = filePath;
+    hr = webView7->PrintToPdf(

Could we extract this code in a helper function taking (possibly null) print settings to avoid duplicating the lambda?


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/review/4491869573@github.com>

VZ

unread,
Jun 13, 2026, 2:50:40 PM (10 days ago) Jun 13
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26583)

Oh, and clang CI failure looks to be a real problem, apparently we are going to have to provide the UUID of ICoreWebView2_7 ourselves.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/c4699457799@github.com>

Blake-Madden

unread,
Jun 17, 2026, 5:24:17 PM (6 days ago) Jun 17
to wx-...@googlegroups.com, Subscribed

@Blake-Madden commented on this pull request.


In src/msw/webview_edge.cpp:

> +{
+    if (!m_impl->m_webView)
+        return false;
+
+    wxCOMPtr<ICoreWebView2_7> webView7;
+    if (FAILED(m_impl->m_webView->QueryInterface(IID_PPV_ARGS(&webView7))))
+        return false;
+
+    const wxString filePathCopy = filePath;
+    HRESULT hr = webView7->PrintToPdf(
+        filePath.wc_str(),
+        nullptr,
+        Callback<ICoreWebView2PrintToPdfCompletedHandler>(
+            [this, filePathCopy](HRESULT errorCode, BOOL isSuccessful) -> HRESULT
+            {
+                wxWebViewEvent event(wxEVT_WEBVIEW_PDF_SAVED, GetId(), filePathCopy, wxString());

Got it, using QueueEvent now.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/review/4519738080@github.com>

Blake-Madden

unread,
Jun 17, 2026, 5:24:28 PM (6 days ago) Jun 17
to wx-...@googlegroups.com, Subscribed

@Blake-Madden commented on this pull request.


In src/msw/webview_edge.cpp:

> +            ? COREWEBVIEW2_PRINT_ORIENTATION_LANDSCAPE
+            : COREWEBVIEW2_PRINT_ORIENTATION_PORTRAIT);
+
+    wxSize paperSizeTenthsMM = wxThePrintPaperDatabase->GetSize(printData.GetPaperId());
+    if (paperSizeTenthsMM.x > 0 && paperSizeTenthsMM.y > 0)
+    {
+        double widthInches = paperSizeTenthsMM.x / 254.0;
+        double heightInches = paperSizeTenthsMM.y / 254.0;
+        printSettings->put_PageWidth(widthInches);
+        printSettings->put_PageHeight(heightInches);
+    }
+
+    printSettings->put_ShouldPrintHeaderAndFooter(FALSE);
+
+    const wxString filePathCopy = filePath;
+    hr = webView7->PrintToPdf(

Done.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/review/4519739366@github.com>

Blake-Madden

unread,
Jun 17, 2026, 5:26:21 PM (6 days ago) Jun 17
to wx-...@googlegroups.com, Push

@Blake-Madden pushed 2 commits.


View it on GitHub or unsubscribe.


Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/before/79b8e57c6fad19e04d86686af701d77964e4fcbd/after/d58faf6361678f6da3f15cbf3c77f42d9aac91f8@github.com>

Blake-Madden

unread,
Jun 17, 2026, 6:34:00 PM (6 days ago) Jun 17
to wx-...@googlegroups.com, Subscribed
Blake-Madden left a comment (wxWidgets/wxWidgets#26583)

Oh, and clang CI failure looks to be a real problem, apparently we are going to have to provide the UUID of ICoreWebView2_7 ourselves.

Done.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/c4736110711@github.com>

Blake-Madden

unread,
Jun 21, 2026, 10:27:03 AM (3 days ago) Jun 21
to wx-...@googlegroups.com, Push

@Blake-Madden pushed 1 commit.


View it on GitHub or unsubscribe.


Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/before/d58faf6361678f6da3f15cbf3c77f42d9aac91f8/after/3c9f8049341b2f7abf56b2b4a02c96e9332d6a17@github.com>

VZ

unread,
Jun 21, 2026, 10:43:56 AM (3 days ago) Jun 21
to wx-...@googlegroups.com, Subscribed

@vadz commented on this pull request.

Thanks, this looks good but GTK version could be tidied up a bit and maybe made safer.


In src/gtk/webview_webkit2.cpp:

> +} // extern "C"
+
+bool wxWebViewWebKit::PrintToPDF(const wxString& filePath)
+{
+    gchar* uri = g_filename_to_uri(filePath.utf8_str(), nullptr, nullptr);
+    if (!uri)
+        return false;
+
+    WebKitPrintOperation* printop = webkit_print_operation_new(m_web_view);
+
+    wxGtkObject<GtkPrintSettings> settings(gtk_print_settings_new());
+    // Do NOT translate this; this is the name of the "printer" that GTK looks up
+    gtk_print_settings_set_printer(settings, "Print to File");
+    gtk_print_settings_set(settings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, "pdf");
+    gtk_print_settings_set(settings, GTK_PRINT_SETTINGS_OUTPUT_URI, uri);
+    g_free(uri);

Could/should use wxGtkString uri instead.


In samples/webview/webview.cpp:

> +    if (!m_browser->PrintToPDF(dlg.GetPath()))
+        wxLogError("PrintToPDF is not supported by this browser backend.");
+}
+
+#if wxUSE_PRINTING_ARCHITECTURE && (defined(__WXMSW__) || defined(__WXGTK__))
+void WebFrame::OnPrintToPDFWithSettings(wxCommandEvent& WXUNUSED(evt))
+{
+    wxArrayString paperChoices;
+    paperChoices.Add("Letter (Portrait)");
+    paperChoices.Add("Letter (Landscape)");
+    paperChoices.Add("A4 (Portrait)");
+    paperChoices.Add("A4 (Landscape)");
+    paperChoices.Add("Legal (Portrait)");
+    paperChoices.Add("Legal (Landscape)");
+
+    int sel = wxGetSingleChoiceIndex(

This is really just in case you'd like to improve it, but IMHO it would make for a nicer demo if the paper choice combobox was part of the file dialog itself (to which it can be added using SetCustomizeHook()).


In src/gtk/webview_webkit2.cpp:

> +struct wxWebViewGtkPDFData
+{
+    wxWebViewWebKit* webView;
+    wxString filePath;
+    WebKitPrintOperation* printop;
+};
+
+static void wxDoHandlePDFResult(gpointer user_data, int success)
+{
+    wxWebViewGtkPDFData* data = static_cast<wxWebViewGtkPDFData*>(user_data);
+    wxWebViewEvent event(wxEVT_WEBVIEW_PDF_SAVED, data->webView->GetId(),
+                         data->filePath, wxString());
+    event.SetInt(success);
+    event.SetEventObject(data->webView);
+    data->webView->HandleWindowEvent(event);
+    g_object_unref(data->printop);

This should be arguably done in wxWebViewGtkPDFData dtor (which should be added).


In src/gtk/webview_webkit2.cpp:

> @@ -1525,6 +1527,99 @@ void wxWebViewWebKit::Print(const wxPrintData& printData, int WXUNUSED(flags))
 }
 #endif // wxUSE_PRINTING_ARCHITECTURE
 
+struct wxWebViewGtkPDFData

This struct should define a ctor to prevent it from being created with uninitialized fields.


In src/gtk/webview_webkit2.cpp:

> +
+#if wxUSE_PRINTING_ARCHITECTURE
+bool wxWebViewWebKit::PrintToPDF(const wxString& filePath, const wxPrintData& printData)
+{
+    gchar* uri = g_filename_to_uri(filePath.utf8_str(), nullptr, nullptr);
+    if (!uri)
+        return false;
+
+    WebKitPrintOperation* printop = webkit_print_operation_new(m_web_view);
+
+    wxGtkObject<GtkPrintSettings> settings(gtk_print_settings_new());
+    // Do NOT translate this; this is the name of the "printer" that GTK looks up
+    gtk_print_settings_set_printer(settings, "Print to File");
+    gtk_print_settings_set(settings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, "pdf");
+    gtk_print_settings_set(settings, GTK_PRINT_SETTINGS_OUTPUT_URI, uri);
+    g_free(uri);

Same as above.


In src/gtk/webview_webkit2.cpp:

> +    wxGtkObject<GtkPrintSettings> settings(gtk_print_settings_new());
+    // Do NOT translate this; this is the name of the "printer" that GTK looks up
+    gtk_print_settings_set_printer(settings, "Print to File");
+    gtk_print_settings_set(settings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, "pdf");
+    gtk_print_settings_set(settings, GTK_PRINT_SETTINGS_OUTPUT_URI, uri);
+    g_free(uri);
+
+    wxApplyPrintData(printop, settings, printData);
+
+    webkit_print_operation_set_print_settings(printop, settings);
+
+    wxWebViewGtkPDFData* data = new wxWebViewGtkPDFData{this, filePath, printop};
+    g_signal_connect(printop, "finished", G_CALLBACK(wxgtk_webview_webkit_pdf_finished), data);
+    g_signal_connect(printop, "failed", G_CALLBACK(wxgtk_webview_webkit_pdf_failed), data);
+
+    webkit_print_operation_print(printop);

What's going to happen if wxWebViewWebKit is destroyed (e.g. because the window containing it is closed) before the operation is finished? The pointer will probably leak, which may be not the worst thing, but I'm not sure if the code wouldn't crash, which would be worse.

Can a print operation be cancelled? If so, we should ideally do it from the dtor if one is in progress.


In src/msw/webview_edge.cpp:

> @@ -1472,6 +1472,80 @@ void wxWebViewEdge::Print(const wxPrintData& printData, int flags)
 }
 #endif // wxUSE_PRINTING_ARCHITECTURE
 
+bool wxWebViewEdge::DoCallPrintToPdf(const wxString& filePath, ICoreWebView2PrintSettings* printSettings)
+{
+    wxCOMPtr<ICoreWebView2_7> webView7;
+    if (FAILED(m_impl->m_webView->QueryInterface(IID_PPV_ARGS(&webView7))))
+        return false;

Should we log some error here? It could be confusing to the user if the "Print to PDF" menu item simply did nothing, without any explanation.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/review/4539845504@github.com>

Blake-Madden

unread,
Jun 21, 2026, 11:29:08 AM (3 days ago) Jun 21
to wx-...@googlegroups.com, Subscribed

@Blake-Madden commented on this pull request.


In src/msw/webview_edge.cpp:

> @@ -1472,6 +1472,80 @@ void wxWebViewEdge::Print(const wxPrintData& printData, int flags)
 }
 #endif // wxUSE_PRINTING_ARCHITECTURE
 
+bool wxWebViewEdge::DoCallPrintToPdf(const wxString& filePath, ICoreWebView2PrintSettings* printSettings)
+{
+    wxCOMPtr<ICoreWebView2_7> webView7;
+    if (FAILED(m_impl->m_webView->QueryInterface(IID_PPV_ARGS(&webView7))))
+        return false;

done


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/review/4539905143@github.com>

Blake-Madden

unread,
Jun 21, 2026, 11:29:27 AM (3 days ago) Jun 21
to wx-...@googlegroups.com, Subscribed

@Blake-Madden commented on this pull request.


In samples/webview/webview.cpp:

> +    if (!m_browser->PrintToPDF(dlg.GetPath()))
+        wxLogError("PrintToPDF is not supported by this browser backend.");
+}
+
+#if wxUSE_PRINTING_ARCHITECTURE && (defined(__WXMSW__) || defined(__WXGTK__))
+void WebFrame::OnPrintToPDFWithSettings(wxCommandEvent& WXUNUSED(evt))
+{
+    wxArrayString paperChoices;
+    paperChoices.Add("Letter (Portrait)");
+    paperChoices.Add("Letter (Landscape)");
+    paperChoices.Add("A4 (Portrait)");
+    paperChoices.Add("A4 (Landscape)");
+    paperChoices.Add("Legal (Portrait)");
+    paperChoices.Add("Legal (Landscape)");
+
+    int sel = wxGetSingleChoiceIndex(

done


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/review/4539905472@github.com>

Blake-Madden

unread,
Jun 21, 2026, 11:40:45 AM (3 days ago) Jun 21
to wx-...@googlegroups.com, Push

@Blake-Madden pushed 3 commits.

  • f9619c6 Log error if Edge PDF fails
  • a8173ab Combine file dialog and paper selector in webview PDF sample
  • 38bb430 Combine dup code and add RAII


View it on GitHub or unsubscribe.


Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/before/3c9f8049341b2f7abf56b2b4a02c96e9332d6a17/after/38bb430d9540e3a8624a7318cfb41020c86c1592@github.com>

Blake-Madden

unread,
Jun 21, 2026, 11:40:54 AM (3 days ago) Jun 21
to wx-...@googlegroups.com, Subscribed

@Blake-Madden commented on this pull request.


In src/gtk/webview_webkit2.cpp:

> +struct wxWebViewGtkPDFData
+{
+    wxWebViewWebKit* webView;
+    wxString filePath;
+    WebKitPrintOperation* printop;
+};
+
+static void wxDoHandlePDFResult(gpointer user_data, int success)
+{
+    wxWebViewGtkPDFData* data = static_cast<wxWebViewGtkPDFData*>(user_data);
+    wxWebViewEvent event(wxEVT_WEBVIEW_PDF_SAVED, data->webView->GetId(),
+                         data->filePath, wxString());
+    event.SetInt(success);
+    event.SetEventObject(data->webView);
+    data->webView->HandleWindowEvent(event);
+    g_object_unref(data->printop);

done


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/review/4539917744@github.com>

Blake-Madden

unread,
Jun 21, 2026, 11:41:06 AM (3 days ago) Jun 21
to wx-...@googlegroups.com, Subscribed

@Blake-Madden commented on this pull request.


In src/gtk/webview_webkit2.cpp:

> @@ -1525,6 +1527,99 @@ void wxWebViewWebKit::Print(const wxPrintData& printData, int WXUNUSED(flags))
 }
 #endif // wxUSE_PRINTING_ARCHITECTURE
 
+struct wxWebViewGtkPDFData

done


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/review/4539917947@github.com>

Blake-Madden

unread,
Jun 21, 2026, 11:41:07 AM (3 days ago) Jun 21
to wx-...@googlegroups.com, Subscribed

@Blake-Madden commented on this pull request.


In src/gtk/webview_webkit2.cpp:

> +
+#if wxUSE_PRINTING_ARCHITECTURE
+bool wxWebViewWebKit::PrintToPDF(const wxString& filePath, const wxPrintData& printData)
+{
+    gchar* uri = g_filename_to_uri(filePath.utf8_str(), nullptr, nullptr);
+    if (!uri)
+        return false;
+
+    WebKitPrintOperation* printop = webkit_print_operation_new(m_web_view);
+
+    wxGtkObject<GtkPrintSettings> settings(gtk_print_settings_new());
+    // Do NOT translate this; this is the name of the "printer" that GTK looks up
+    gtk_print_settings_set_printer(settings, "Print to File");
+    gtk_print_settings_set(settings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, "pdf");
+    gtk_print_settings_set(settings, GTK_PRINT_SETTINGS_OUTPUT_URI, uri);
+    g_free(uri);

done


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/review/4539917991@github.com>

Blake-Madden

unread,
Jun 21, 2026, 11:41:23 AM (3 days ago) Jun 21
to wx-...@googlegroups.com, Subscribed

@Blake-Madden commented on this pull request.


In src/gtk/webview_webkit2.cpp:

> +} // extern "C"
+
+bool wxWebViewWebKit::PrintToPDF(const wxString& filePath)
+{
+    gchar* uri = g_filename_to_uri(filePath.utf8_str(), nullptr, nullptr);
+    if (!uri)
+        return false;
+
+    WebKitPrintOperation* printop = webkit_print_operation_new(m_web_view);
+
+    wxGtkObject<GtkPrintSettings> settings(gtk_print_settings_new());
+    // Do NOT translate this; this is the name of the "printer" that GTK looks up
+    gtk_print_settings_set_printer(settings, "Print to File");
+    gtk_print_settings_set(settings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, "pdf");
+    gtk_print_settings_set(settings, GTK_PRINT_SETTINGS_OUTPUT_URI, uri);
+    g_free(uri);

done


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/review/4539918416@github.com>

Blake-Madden

unread,
Jun 21, 2026, 11:47:31 AM (3 days ago) Jun 21
to wx-...@googlegroups.com, Push

@Blake-Madden pushed 1 commit.

  • 87cfe42 Use wxWeakRef to avoid possible dangling pointer


View it on GitHub or unsubscribe.


Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/before/38bb430d9540e3a8624a7318cfb41020c86c1592/after/87cfe428b72767ef3e661edf44617fa360f9bca5@github.com>

Blake-Madden

unread,
Jun 21, 2026, 11:47:51 AM (3 days ago) Jun 21
to wx-...@googlegroups.com, Subscribed

@Blake-Madden commented on this pull request.


In src/gtk/webview_webkit2.cpp:

> +    wxGtkObject<GtkPrintSettings> settings(gtk_print_settings_new());
+    // Do NOT translate this; this is the name of the "printer" that GTK looks up
+    gtk_print_settings_set_printer(settings, "Print to File");
+    gtk_print_settings_set(settings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, "pdf");
+    gtk_print_settings_set(settings, GTK_PRINT_SETTINGS_OUTPUT_URI, uri);
+    g_free(uri);
+
+    wxApplyPrintData(printop, settings, printData);
+
+    webkit_print_operation_set_print_settings(printop, settings);
+
+    wxWebViewGtkPDFData* data = new wxWebViewGtkPDFData{this, filePath, printop};
+    g_signal_connect(printop, "finished", G_CALLBACK(wxgtk_webview_webkit_pdf_finished), data);
+    g_signal_connect(printop, "failed", G_CALLBACK(wxgtk_webview_webkit_pdf_failed), data);
+
+    webkit_print_operation_print(printop);

On my OpenSuse at least, I don't have a change to cancel, it performs the PDF save asynchronously. But I've wrapped this in a wxWeakRef just in case.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/review/4539928729@github.com>

Blake-Madden

unread,
Jun 21, 2026, 12:41:57 PM (3 days ago) Jun 21
to wx-...@googlegroups.com, Subscribed
Blake-Madden left a comment (wxWidgets/wxWidgets#26583)

The Qt failure doesn't appear to be me:

tests\controls\gridtest.cpp(759): FAILED:
  CHECK( colsize.GetCount() == 1 )
with expansion:
  0 == 1


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/c4762623174@github.com>

VZ

unread,
Jun 21, 2026, 12:45:39 PM (3 days ago) Jun 21
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26583)

Yes, it's due to

  Timed out waiting for mouse release to be processed

which is not related to the changes here.

I'll merge this soon, thanks for the updates!


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/c4762632373@github.com>

VZ

unread,
Jun 22, 2026, 8:44:48 AM (2 days ago) Jun 22
to wx-...@googlegroups.com, Subscribed

Closed #26583 via e871f1a.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26583/issue_event/27041532056@github.com>

Reply all
Reply to author
Forward
0 new messages