首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从中创建一个pdf,并将其发送到一个应用程序的云存储中

从中创建一个pdf,并将其发送到一个应用程序的云存储中
EN

Stack Overflow用户
提问于 2022-02-03 17:29:42
回答 1查看 108关注 0票数 1

我搜索一种方法来将我的转换成一个pdf,然后将它自动发送到云存储中。用户进程:

1-填写表格2-提交表格

从用户3隐藏进程-从表单数据4创建一个pdf -将其存储到云存储中

我更新了我的问题,并提供了更多细节。例如,我在我的应用程序中有一个表单,最后我想要一个pdf文件按钮来创建具有用户值的PDF,并将它发送到服务器上保存在云上。

这是我的表格

代码语言:javascript
复制
import React, { useState } from 'react';
import BouncyCheckbox from "react-native-bouncy-checkbox";

import {
  ScrollView,
  StyleSheet,
  Dimensions,
  TouchableOpacity
} from "react-native";
// Galio components
import { Block, Text, Button as GaButton, theme } from "galio- 
framework";
// Argon themed components
import { argonTheme, tabs, articles } from "../constants/";
import {  Input, Button, View, Card, Select, Icon, Header, 
Switch } from "../components/";

const { width } = Dimensions.get("screen");

class Tall extends React.Component {
state = {
 "switch-1": true,
 "switch-2": false
};

 renderText = () => {
  return (
   <Block flex style={styles.group}>
     <Text size={22} style={styles.title}>
       1 - HEIGHT
     </Text>
     <Block style={{ paddingHorizontal: theme.SIZES.BASE }}>
       <Text size={18}
         h3
         style={{ fontFamily: 'open-sans-regular', 
  marginBottom: theme.SIZES.BASE / 1 }}
        color={argonTheme.COLORS.DEFAULT}
      >
   - ARE YOU TALL ?
      </Text>
     </Block>
   </Block>
  );
  };

 renderSwitches = () => {
  return (
    <Block flex style={styles.group}>

    <Block style={{ paddingHorizontal: theme.SIZES.BASE }}>
      <Block
        row
        middle
        space="between"
        style={{ marginBottom: theme.SIZES.BASE }}
      >
         <Text style={{ fontFamily: 'open-sans-regular' }} size={14} color={argonTheme.COLORS.TEXT}>YES</Text>

        <BouncyCheckbox
          size={25}
          fillColor="green"
          unfillColor="#FFFFFF"

          iconStyle={{ borderColor: "green" }}
          onPress={(isChecked: boolean) => {}}
        />

      </Block>
      <Block row middle space="between">
        <Text style={{ fontFamily: 'open-sans-regular' }} size={14} color={argonTheme.COLORS.TEXT}>NO</Text>
        <BouncyCheckbox
          size={25}
          fillColor="red"
          unfillColor="#FFFFFF"

          iconStyle={{ borderColor: "red" }}
          onPress={(isChecked: boolean) => {}}
        />
       </Block>
      </Block>
      </Block>
    );
  };

  
  renderButtons = () => {
   return (
    <Block flex>

       <Block center>
         <Button textStyle={{ fontFamily: 'open-sans-bold' }} color="success" style={styles.button}>
         SEND
         </Button>
         </Block>


     </Block>
   );
  };

 render() {
   return (
    <Block flex center>
    <ScrollView
      showsVerticalScrollIndicator={false}
      contentContainerStyle={{ paddingBottom: 30, width }}
    >
      {this.renderText()}
      {this.renderSwitches()}
        {this.renderButtons()}


      </ScrollView>
    </Block>
   );
  }
  }

const styles = StyleSheet.create({
title: {
fontFamily: 'open-sans-bold',
paddingBottom: theme.SIZES.BASE,
paddingHorizontal: theme.SIZES.BASE * 2,
marginTop: 44,
color: argonTheme.COLORS.HEADER
 },
 group: {
paddingTop: theme.SIZES.BASE * 2
 },
shadow: {
shadowColor: "black",
shadowOffset: { width: 0, height: 2 },
shadowRadius: 4,
shadowOpacity: 0.2,
elevation: 2
},
button: {
marginBottom: 40,
marginTop: 80,
width: width - theme.SIZES.BASE * 2
},
optionsButton: {
width: "auto",
height: 34,
paddingHorizontal: theme.SIZES.BASE,
paddingVertical: 10
},
input: {
borderBottomWidth: 1
},
inputDefault: {
borderBottomColor: argonTheme.COLORS.PLACEHOLDER
},
inputTheme: {
borderBottomColor: argonTheme.COLORS.PRIMARY
},
inputTheme: {
borderBottomColor: argonTheme.COLORS.PRIMARY
},
inputInfo: {
borderBottomColor: argonTheme.COLORS.INFO
},
inputSuccess: {
borderBottomColor: argonTheme.COLORS.SUCCESS
},


});

export default Tall;

如何使用世博打印检索用户选择(您高吗?)是还是否)在const HTML中?

EN

回答 1

Stack Overflow用户

发布于 2022-02-03 17:37:47

是的,可以用世博会的印刷品。

代码语言:javascript
复制
const user = {
  name: 'Foub',
  surname: 'Bouf'
};
const html = `<div style="color: red">Mr.${user.name} ${user.surname}</div>`;
const { base64 } = await Print.printToFileAsync({
  html
});
// send the base64 which is a string containing the pdf's data to the server

你可以把你想要的任何HTML和你想要的样式放在一起,就像一个真正的HTML页面

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70975704

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档