Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 如何在pdf中调用数据?_Reactjs_React Pdf - Fatal编程技术网

Reactjs 如何在pdf中调用数据?

Reactjs 如何在pdf中调用数据?,reactjs,react-pdf,Reactjs,React Pdf,有一个生成PDF的项目,但我需要传递参数并读取它。我已经搜索了文档,但没有找到任何对我有帮助的文档 import React from 'react'; import { Page, Text, View, Document, StyleSheet, Image} from '@react-pdf/renderer'; import logo from "./logo.png"; import firma from "./firma.png"; import imagen from "./1.j

有一个生成PDF的项目,但我需要传递参数并读取它。我已经搜索了文档,但没有找到任何对我有帮助的文档

import React from 'react';
import { Page, Text, View, Document, StyleSheet, Image} from '@react-pdf/renderer';
import logo from "./logo.png";
import firma from "./firma.png";
import imagen from "./1.jpg";    

const MyDocument = () => (
      <Document>
        <Page size="A4" style={styles.pag}>
          <View style={styles.firma}>
            <Image src={logo}/>
          </View>
          <View >
            <Text style={styles.client}>Nombre: Xxxxx Xxxxx | RUT: XX.XXX.XXX-X | Correo: xxxxx@xxxx.xxx | Teléfono: +56 9 XXXX XXXX</Text>
          </View>
          <View style={styles.imagen}>
            <Image src={imagen}/>
          </View>
          <View style={styles.info}>
            <Text style={styles.h1}>Datos de propiedad</Text>
          </View>
          <View style={styles.info}>
            <Text>UF: XX.XXX</Text>
            <Text>Tipo de propiedad: XXXXXXX</Text>
            <Text>Dirección: XXXXXX</Text>
            <Text>Metros construidos: XXXX</Text>
            <Text>Metros de terreno/terraza: XXXXX</Text>
            <Text>Dormitorios: XX</Text>
            <Text>Baños: XXX</Text>
          </View>
        </Page

X标记了我需要调用的数据。

创建一个新的状态变量,并将所有详细信息存储在其中。例如,在容器内部,this.state={phone:9999999,…}。 然后在文本标记中添加value属性,例如:value={this.state.phone}

有关如何传递值的更多参考信息,请访问以下链接:


您能创建一个最小的、可重复的示例吗?