printToFileAsync seems to ignore width and height on native iOS Build
See original GitHub issueSummary
When calling printToFileAsync
of the expo-print
library and passing in a custom width and height, the passed width and height seem to get ignored (passing 2480x3508 to get a 300dpi A4 pdf, results in a pdf with the default 612x792 resolution).
This seems to happen only on native iOS builds (eas builds and with expo build), everything works fine on android and when running with expo go.
expo-print
Version: 11.0.4 (same error on 11.1.0)
Managed or bare workflow? If you have ios/
or android/
directories in your project, the answer is bare!
managed
What platform(s) does this occur on?
iOS
SDK Version (managed workflow only)
43
Environment
Expo CLI 5.0.3 environment info: System: OS: macOS 12.1 Shell: 5.8 - /bin/zsh Binaries: Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node Yarn: 1.22.17 - ~/.nvm/versions/node/v16.13.1/bin/yarn npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm Managers: CocoaPods: 1.11.2 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3 IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7935034 Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild npmPackages: expo: ^43.0.0 => 43.0.5 react: 17.0.1 => 17.0.1 react-dom: 17.0.1 => 17.0.1 react-native: 0.64.3 => 0.64.3 react-native-web: 0.17.1 => 0.17.1 npmGlobalPackages: eas-cli: 0.45.1 expo-cli: 5.0.3 Expo Workflow: managed
Reproducible demo
Pretty much the same code as in the usage example here.
import * as Print from "expo-print";
...
const html = `
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
`;
const result = await Print.printToFileAsync({
html: html,
width: 2480,
height: 3508,
margins: {
top: 0,
bottom: 0,
left: 0,
right: 0
}
});
Sharing.shareAsync(result.uri, {
mimeType: "application/pdf",
UTI: ".pdf"
});
Info of the generated pdf:
Issue Analytics
- State:
- Created 2 years ago
- Comments:10
exact same issue here…
expo sdk 43
yes, 42 is the last version this is working properly