Javascript 在reactjs中下载pdf

Javascript 在reactjs中下载pdf,javascript,reactjs,dom,html2canvas,Javascript,Reactjs,Dom,Html2canvas,我使用@react pdf/renderer包下载了一个pdf组件,它的工作很好: const MyDocument = (props) => ( <Document> <Page size="A4" style={styles.page}> <View style={styles.section}> <Text>{props.title}</Text>

我使用
@react pdf/renderer
包下载了一个pdf组件,它的工作很好:

const MyDocument = (props) => (
  <Document>
    <Page size="A4" style={styles.page}>
      <View style={styles.section}>
        <Text>{props.title}</Text>   
      </View>
      <View style={styles.section}>
        <Text>Section #2</Text>
      </View>
    </Page>
    
  </Document>
);
constmydocument=(道具)=>(
{props.title}
第2节
);
然后

<PDFDownloadLink
                document={<MyDocument title={this.state.title}/>}
                fileName="doc.pdf">
                    {({ blob, url, loading, error }) => (
                        loading ? 'Loading...' : 'Download!'
                    )}
 </PDFDownloadLink>

{({blob,url,加载,错误})=>(
正在加载?“正在加载…”:“下载!”
)}
我有一个问题,是否可以结合@react pdf/renderer包和html2canvas包,让它下载这些元素+组件的dom返回

<Page size="A4" style={styles.page}>
        <View style={styles.section}>
          <My second component />
        </View>
 </Page>