[英]How Do I change output Paper Size to A4 in React Native (expo android)
I am using React Native to make an Android App for the billing app and the output paper is 216mmX279mm which is not true PDF size, I am using expo-print
, printToFileAsync
and from the expo I want PDF output exactly A4 size which 210mmX297mm
我查看了 expo print
文檔,我在 MDN 網站上查找了 .@page 文檔How do I Change Output to A4 size
我檢查了它說的print
和FilePrintOptions
文檔
那么如何將默認設置更改為 A4 並增加 DPI?
找到了。
const printToFile = async () => {
const { uri } = await Print.printToFileAsync({
html, height:842, width:595
});
console.log('File has been saved to:', uri);
await shareAsync(uri, { UTI: '.pdf', mimeType: 'application/pdf' });
所以,默認情況下,美國信紙的height:792, width:612
PPI,正如我在問題中所問的那樣,
html
是一個字符串,也將height
和width
作為number
,如代碼塊所示,
例如,如果您想更改 PPI 更改像素大小
A4 72PPI = H842、W595
A4 150PPI = H1754,W1240 我認為只需要“px”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.