Repository navigation
Start printing on the paper of the document - #711
Merged
Merged
Conversation
The print dialog always started on the default paper of the printer, in portrait. An A4 document printed on Letter, and a slide printed on a portrait sheet. CoreLoader now reads the page size of a text, presentation or drawing document from the core. It opens the document once, for this and for the editing check. For a PDF printed from its file, PdfRenderer reads the size of the first page. PrintingManager gives the print framework the matching standard paper and orientation. For a size that has no standard paper, it gives only the orientation. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KNpfqA2jL1iVM1Wirf7njH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #710. The print dialog always started on the default paper of the printer, in portrait. An A4 document started on Letter, and a slide started on a portrait sheet.
Change
PageSize(new, pure Kotlin): a page size in mils, made from a coreMeasure(in,cm,mm,pt,pc,px). It matches A3, A4, A5, Letter, Legal and Tabloid within 2%, which keeps A4 and Letter apart.CoreLoader: reads the page size of a text, presentation or drawing document. For text it usesTextRoot.pageLayout(), otherwise the first slide or page. The document is opened once, for this and for the editing check, so an editable format gets no extra decode. The value goes toLoadedDocumentand is parcelled with it.PrintingManager: givesPrintManager.printaMediaSizefor the paper and orientation. For a size without a standard paper, such as a 4:3 slide, it gives onlyUNKNOWN_LANDSCAPEorUNKNOWN_PORTRAIT. For a PDF printed from its file,PdfRendererreads the size of the first page.The print framework uses these attributes only as the start values. If the printer does not have the paper, the dialog falls back to the paper of the printer, and the user can still change it.
Verification
PageSizeTest(5 tests) and theDocumentParcelTestround trip (6 tests, on the emulator) pass.spotlessCheckandlintProDebugpass.Casio_WVA-M650-7AJF.pdfspeisekarte_helmarts.pdfstyle-various-1.pdfstyle-various-1.odpfile-sample_100kB.odtsample.odgfile_example_XLSX_10.xlsxI read the "before" column from #710's emulator run (Letter for the Casio PDF) and from the framework default; I did not rerun every row on the old build.