Bug 150104 - Printer settings not loaded from doc for long printer/driver name
Summary: Printer settings not loaded from doc for long printer/driver name
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
7.3.4.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Michael Weghorn
URL:
Whiteboard: target:7.5.0
Keywords:
Depends on:
Blocks: Printer-Settings
  Show dependency treegraph
 
Reported: 2022-07-22 13:50 UTC by Michael Weghorn
Modified: 2022-07-26 20:39 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Weghorn 2022-07-22 13:50:24 UTC
When saving printer settings to a document, those are not correctly restored when opening the document again on Windows when the printer name is longer than 63 characters or the driver name is longer than 31 characters (ASCII characters, number is even lower when non-ASCII characters are involved).

= Steps to reproduce: =

1) install PDF Creator, available from here: https://www.pdfforge.org/pdfcreator 
2) rename the "PDFCreator" printer to a name longer than 64 characters:
  a) Go to "Printers & scanners" module in Windows system settings
  b) select the "PDFCreator" printer -> "Manage" -> "Printer properties"
  c) in the "General" tab, set the following new name: "PDFCreator_abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
3) optional, but makes the problem even clearer: Set another printer as default printer in Windows settings, e.g. "Microsoft Print do PDF"
4) make sure that the following two options are enabled in LO settings under "Load" -> "General" (which they are by default):
* "Load user-specific settings with the document"
* Load printer settings with the document
3) open a new Writer doc
4) go to "File" -> "Printer Settings"
5) select the printer renamed above
6) go to "Properties..." ->  "Paper/Quality" and select "Black & White" instead of "Color" (the default set for the printer in Windows settings) in the "Paper/Quality" tab
7) confirm all open dialogs
8) save the document
9) close the document
10) open the saved document again
11) check the printer settings under "File" -> "Printer Settings"

= Actual result: =

* the system default printer is selected
* when selecting the printer set up above, "Color" is selected in the printer properties

= Expected result: =

The printer settings previously set should be restored, i.e.
* "PDFCreator_abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" should be preselected as printer
* "black & white" should be selected in the color settings in the printer properties


Version: 7.3.4.2 (x64) / LibreOffice Community
Build ID: 728fec16bd5f605073805c3c9e7c4212a0120dc5
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded
Comment 1 Michael Weghorn 2022-07-22 13:53:30 UTC
This was originally reported by a different user within our organization.
The problem was originally observed in a slightly different setup, but the cause is similar: There, a printer with a shorter ("normal") name was used, but the driver name exceeds 32 characters: "LRS Universal Printer Driver (1.1.0.28)".
(The driver name would get truncated to the first 31 characters ("LRS Universal Printer Driver (1") when opening the file again, and previously selected printer settings would get lost.

I'm working on a fix.
Comment 2 Commit Notification 2022-07-26 20:38:44 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/11cd74ade59c6b47b25a737775a541fdd6faed44

tdf#150104 Store full printer/driver name in doc's JobSetup

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.