Skip to content

[Edge] Browser with SWT.EDGE returns blank image when using print() #373

@Destrolaric

Description

@Destrolaric

Describe the bug
In our app, we have the functionality of printing images from an internal browser window. We previously used Internet Explorer as an internal browser but we changed it to Edge by default for Windows systems. Previously this functionality correctly created the image of browser composite, but it doesn't work for Edge.
To Reproduce

        browser = new Browser(composite, SWT.EDGE);
        //any URL
        browser.setUrl(file.toURI().toURL().toString())
        Image image = new Image(Display.getDefault(), browser.getBounds());
        GC gc = new GC(image);
        try {
           browser.print(gc);
        } finally {
            gc.dispose();
        }
        ImageTransfer imageTransfer = ImageTransfer.getInstance();
        Clipboard clipboard = new Clipboard(Display.getCurrent());
        clipboard.setContents(new Object[] {image.getImageData()}, new Transfer[]{imageTransfer});

Expected behavior
Correct image with browser content shown on it.

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • Windows
  1. Additional OS info (e.g. OS version, Linux Desktop, etc)
    Windows 10, Edge installed
  2. JRE/JDK version
    java.vendor.version=Temurin-11.0.15+10
    java.version=11.0.15
  3. Version
    found on:
    org.eclipse.swt.browser.EdgeVersion=105.0.1343.27

Workaround (or) Additional context
Probably screenshots can be done via browser functionality. But I was not able to do that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    WindowsHappens on Windows OSedgeEdge Browser

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions