New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[print][ios] fix width/ height not working on HTML print #20046
Merged
keith-kurak
merged 8 commits into
main
from
keith/eng-6915-expo-print-not-setting-width-height-on
Nov 18, 2022
Merged
[print][ios] fix width/ height not working on HTML print #20046
keith-kurak
merged 8 commits into
main
from
keith/eng-6915-expo-print-not-setting-width-height-on
Nov 18, 2022
Conversation
This file contains 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
keith-kurak
requested review from
Simek,
amandeepmittal,
kbrandwijk and
lukmccall
as code owners
November 15, 2022 21:05
expo-bot
added
bot: passed checks
ExpoBot has nothing to complain about
and removed
bot: suggestions
ExpoBot has some suggestions
labels
Nov 15, 2022
kbrandwijk
reviewed
Nov 16, 2022
lukmccall
approved these changes
Nov 16, 2022
Co-authored-by: Kim Brandwijk <kim.brandwijk@gmail.com>
Co-authored-by: Łukasz Kosmaty <lukasz.kosmaty@swmansion.com>
keith-kurak
deleted the
keith/eng-6915-expo-print-not-setting-width-height-on
branch
November 18, 2022 16:20
When will this fix be released? Can we use it somehow in SDK 47? |
i already use 2.2.1 but why am i still cannot define custom width and height??
|
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.
Why
Fixes #16739, so now printing rendered HTML will change the page size when a custom
width
/height
is specified.How
Setting width/ height stopped working after printing was changed from a snapshot-based method to HTML renderer based method, in order to properly support margins and page breaks. This stack overflow comment hinted that using
UIGraphicsBeginPDFPageWithInfo
with the paper sizeCGRect
would do the trick, and, lo-and-behold, it seems to work!Also noticed that margin wasn't reflected when
useMarkupFormatter
was set totrue
when callingprintToFileAsync
, and margin and page size weren't reflected when using the same option withprintAsync
, so fixed those with a similar change.Test Plan
Tweaked the HTML from the docs' printing snack to simulate something akin to the label in the issue. Tried
printAsync
with no additional parameters, the same custom width/ height as in the issue, with custom margins, and with both custom dimensions and margins. Seems to look correct in all cases. Also triedprintToFileAsync
, and that worked, as well. Finally, to test theuseMarkupFormatter = true
fixes, tested both print functions with that on and off, and also tried omitting thehtml
parameter to simulate an error.Custom dimensions:
Custom margins:
Custom dimensions and margins
The test "label" in case anyone needs it:
Checklist
expo prebuild
& EAS Build (eg: updated a module plugin).