Skip to content

Browser, WebView2 update to 135.0.3179.73: PDF Viewer in child window not saving correctly #2022

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jensppi opened this issue Apr 15, 2025 · 4 comments

Comments

@jensppi
Copy link
Contributor

jensppi commented Apr 15, 2025

Describe the bug
Open Browser component with URL https://de.wikipedia.org/wiki/Datei:Test.pdf.

With Ctrl-Click on the small colorful TEST.pdf preview, a new window opens with the title Test.pdf. It contains the embedded PDF viewer from Edge WebView2.

  • Issue: Click on the disk icon to save the file. Choose a location and save the file. Open that folder via Explorer. No file was saved!

  • Alternative attempt: Click the printer icon, choose "Save as PDF", and save. File appears saved at first. But after closing the PDF viewer window, the file disappears — it's only temporarily available while the application is running!

To Reproduce

    import org.eclipse.swt.SWT;
    import org.eclipse.swt.browser.Browser;
    import org.eclipse.swt.widgets.Display;
    import org.eclipse.swt.widgets.Shell; 
    public class SWTBrowserExample {

    public static void main(String[] args) {

        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setText("Wikipedia PDF Viewer - WebView2");
        shell.setSize(1024, 768);

        try {
            Browser browser = new Browser(shell, SWT.NONE);

            String wikiUrl = "https://de.wikipedia.org/wiki/Datei:Test.pdf";
            browser.setUrl(wikiUrl);

            browser.setBounds(0, 0, shell.getSize().x, shell.getSize().y);
        } catch (Throwable e) {
            System.err.println("Error on init: " + e.getMessage());
            display.dispose();
            return;
        }

        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) display.sleep();
        }
        display.dispose();
    }
}

Expected behavior
All save operations should create real, persistent files on disk.
Saving via the disk or print-to-PDF options should not result in temporary or deleted files.

Screenshots

Image

Environment

  • Windows 11
  • Most important: Update to WebView2 135.0.3179.73

JRE/JDK version
Tested with Java 21, but issue is independent of Java version.

Tested with

  • SWT 4.28
  • SWT 4.36M1
@jensppi
Copy link
Contributor Author

jensppi commented Apr 15, 2025

It is not specific to the embedded pdf viewer.

If you scroll down on the Wiki page to Test.gif and do a Ctrl-Click on the link 'Test.gif', a new window opens. From the context menu try a 'Save image as' on the image. It also fails.

In the root window 'Save image as' is working. It fails in child windows opened via 'Ctrl-Click'.

@jensppi
Copy link
Contributor Author

jensppi commented Apr 16, 2025

Seems to be a WebView2 problem: see MicrosoftEdge/WebView2Feedback#5199 and MicrosoftEdge/WebView2Feedback#5196

@jensppi
Copy link
Contributor Author

jensppi commented Apr 17, 2025

It is a WebView2 bug.

@jensppi jensppi closed this as completed Apr 17, 2025
@HeikoKlare
Copy link
Contributor

Thank you for sharing the issue and the insights, @jensppi! Very helpful to have this documented in case someone experiences this issue when using Eclipse/SWT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants