1C platform 8.3.18.1334 – Linux server, Windows thick clients.

We generate SpreadsheetDocument using CheckPut() and all relevant Printing parameters set (FitToPage=False, PageSize=A4, custom Margins, etc.).

Most of the times everything works as expected – generated document has expected page count ant prints successfully on user's printer, from the same spreadsheet automatically saved PDF/A-2 document also has the same page count.

However, sometimes generated document prints correctly, but when saved as PDF has different page count, e. g., 1 vs. 2, 3 vs. 5, etc.

We experimented with various SpreadsheetDocument options (changed margins, FitToPage, PrinterName, PrintParametersKey), but couldn't determine what exactly causes this problem and how to avoid it.
Sometimes PDF generation works on 1C client, but doesn't work on 1C server, or vice versa.

We suspect that it is related to the user's printer, but not sure how, since one day it works with the same printer settings (A4 paper size), next day it doesn't; the same printer model works with one computer, does not work with other, etc.

Fail_5_vs_3.mxl – generated, then anonymized spreadsheet document. Prints as 3 pages on user's printer and several other printers, prints as 5 pages on some other printers and when saved as PDF.
FPDF_fail_5_vs_3.pdf (zipped) – saved from PDF_fail_5_vs_3.mxl.

Is it possible to generate A4 spreadsheet document that reliably fits on A4 page for printing and when saved as PDF?

CheckPut documentation mentions:

Quote
It should be noted that if margins for a spreadsheet document are smaller than those set for the printer which will print the document, the content of some strings may not fit the page, even if the method returns value True.
What margins are used when saving as PDF with SpreadsheetDocument.Write("File.pdf", SpreadsheetDocumentFileType.PDF_A_2)?
Is it possible to use CheckPut safely and avoid this problem?