brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.01k stars 2.21k forks source link

Print preview fails #38543

Open PaduaPlay opened 1 month ago

PaduaPlay commented 1 month ago

Description

The Ctrl P print dialog opens a 'print preview failed' window.

Forcing printing Ctrl Shift P causes a browser hang.

With any printer selected as the default printer.

Steps to reproduce

  1. Ctrl P to see the 'print preview' failed screen

Actual result

PrintPreview fails - Brave

Expected result

Ctrl P should show a print preview.

Reproduces how often

Easily reproduced

Brave version (brave://version info)

Release Version 1.66.115 Chromium: 125.0.6422.112 (Official Build) (64-bit) on Windows 11

https://github.com/brave/brave-browser/releases/download/v1.66.115/brave-v1.66.115-win32-x64.zip (portable version - not the setup.exe version)

Channel information

Reproducibility

Miscellaneous information

Seems to be a new issue, with the new version of Chromium?

Printing works fine with other Windows apps , Firefox etc.

fhoshino commented 1 month ago

Same problem here but on windows 10

PaduaPlay commented 1 month ago

This seems to be a known issue with various 'forks' of Chromium _ Brave, Chromium itself, Ungoogled Chromium, Google Chrome etc. - but only in the 125.x versions. The, earlier, 124.x versions work fine.

https://github.com/ungoogled-software/ungoogled-chromium-windows/issues/353

The reason for the 'print preview failed' error seems to be some permissions which are not set when the portable / packed files are unpacked. Apparently it is fine with installed versions.

There is also a solution posted to set these permissions needed for the Ctrl P command and print preview to work.

Running icacls from Powershell..

icacls X:\directorywherethebrowserisinstalled\ /grant "ALL APPLICATION PACKAGES:(OI)(CI)(RX)" /t

Of course, replacing X:\directorywherethebrowserisinstalled with the folder where the browser is installed.

Have tried it, and print preview works.

Hopefully the upcoming releases of the various Chromium forks, including Brave, will take care of any such required permissions so all of this extraneous permission setting is not needed.

hairycactus commented 1 month ago

I am one of those affected by this problem. Even tried resetting my Brave Desktop browser to default factory settings, but it has no effect.

Using CTRL-P

Screenshot 1: Trying to Preview Webpages & Non-PDF Files = Error

BraveDesktop1.66 .118(31May24)-PrintPreviewSave-Error-05Jun24

Screenshot 2: Preview PDF Files = OK

BraveDesktop1.66.118(31May24)-PrintPreviewSave-PDF-OK-05Jun24

Using CTRL-SHIFT-P

Brave Desktop (no-install ZIP build) Tested

Affected:
Not Affected:
Additional Info:
hairycactus commented 1 month ago

After CTRL-P fails to function correctly, loading brave://histograms/ChildProcess.LaunchFailed always shows the following. The stats are identical regardless of the number of tests.

- Histogram: ChildProcess.LaunchFailed.UtilityProcessErrorCode recorded 1 samples (flags = 0x41) [#]
   44  -O                                                                        (1 = 100.0%)

- Histogram: ChildProcess.LaunchFailed.UtilityProcessHash recorded 1 samples (flags = 0x41) [#]
   -657129659-O                                                                  (1 = 100.0%)

- Histogram: ChildProcess.LaunchFailed.WinLastError recorded 1 samples (flags = 0x41) [#]
   0  -O                                                                          (1 = 100.0%)

Screenshot of brave://histograms/ChildProcess.LaunchFailed:

BraveDesktop1.66.118(31May24)-PrintPreviewSave-ErrorHistogram-05Jun24

hairycactus commented 1 month ago

@PaduaPlay: Running icacls from Powershell.. icacls X:\directorywherethebrowserisinstalled\ /grant "ALL APPLICATION PACKAGES:(OI)(CI)(RX)" /t

For my Brave Desktop browser, the above icacls command has no effect in resolving the Print Preview & Save as PDF failure -- even though the command completed successfully in elevated PowerShell console (run as Administrator & as SYSTEM user), & the ACL permissions are indeed correctly applied (as verified by checking Brave's working folder via File Explorer's Security tab).

Although I didn't test the below, this pair of icacls commands (must run both) apparently works for some users: https://issues.chromium.org/issues/339994760#comment33

icacls "X:\BraveBrowserPath\" /grant *S-1-15-3-1024-3424233489-972189580-2057154623-747635277-1604371224-316187997-3786583170-1043257646:(OI)(CI)(RX)

icacls "X:\BraveBrowserPath\" /grant *S-1-15-3-1024-2302894289-466761758-1166120688-1039016420-2430351297-4240214049-4028510897-3317428798:(OI)(CI)(RX)

Slightly different icacls command pair: https://github.com/ungoogled-software/ungoogled-chromium-windows/issues/353#issuecomment-2132210216

hairycactus commented 1 month ago

What works for me is running Brave Desktop's main executable brave.exe (or its portable launcher helper) using the switch --disable-features=PrintCompositorLPAC.

If using Brave Desktop's No-Install ZIP Build directly:

  1. Create a shortcut LNK file for brave.exe.
  2. At shortcut file's Target field, set: "D:\BraveDesktop\brave.exe" --disable-features=PrintCompositorLPAC
  3. Launch Brave using the shortcut file.

If using a Portable Launcher-Helper for Brave Desktop's No-Install ZIP Build:

  1. Create a shortcut LNK file for the portable launcher file (eg. brave-portable.exe).
  2. At shortcut file's Target field, set: "D:\BravePortable\brave-portable.exe" --disable-features=PrintCompositorLPAC
  3. Launch Brave Portable using the shortcut file.
References: