怎么给pdf文件添加页码打印出来

    一直有个疑问,也是工作中遇到的。面对一个别人发给你的PDF文件,现在想打印出来,能不能给各页加上页码,类似于Word中在页尾加入的效果一样。网上有些软件的确可以,但都要付费,这就让很多朋友头疼了。
下面小编来解决大家的烦恼,小编知道一个PDF文件在线添加页码的网址,PDF添加页码http://app.xunjiepdf.com/pdfaddpagenum,能轻松的解决大家的问题。
    使用步骤如下:
    步骤一:搜索“迅捷pdf在线转换器”,找到相关页面点击进入在线网站主页面


,进入页面后,用我们鼠标点到文档处理,找到“PDF添加页码”那个栏目。
    步骤二:点击“添加文件”添加需要转换的图片。如果想要一次性转多个图片,那么我们可以点击“添加文件夹”。


    步骤三:点击“开始转换”,转换需要一段时间,转换状态也会在软件里显示,我们只要耐心等待转换完成。


    PDF文件不同于其他文件,想要添加页码,也只有少数软件可以实现,其中迅捷PDF在线转换器就是你最好的选择。

转载于:https://my.oschina.net/dengjiaqi666/blog/1563288

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Ant Design Pro 中可以使用 `react-pdf` 这个第三方库来实现 PDF 文件的预览和打印。具体实现步骤如下: 1. 安装 `react-pdf` 库 ``` npm install react-pdf ``` 2. 在组件中引入 `Document`、`Page` 和 `pdfjs` 组件 ```javascript import { Document, Page, pdfjs } from 'react-pdf'; pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`; ``` 3. 在页面中使用 `Document` 和 `Page` 组件来渲染 PDF 文件 ```javascript <Document file="/example.pdf"> <Page pageNumber={1} /> </Document> ``` 其中 `file` 属性指定要渲染的 PDF 文件路径,`Page` 组件的 `pageNumber` 属性指定要渲染的页码。 4. 添加打印功能 ```javascript import { pdfjs, Document, Page, pdf } from 'react-pdf'; import { Button } from 'antd'; pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`; class PDFViewer extends React.Component { state = { numPages: null, pageNumber: 1, }; onDocumentLoadSuccess = ({ numPages }) => { this.setState({ numPages }); }; goToPrevPage = () => { this.setState(prevState => ({ pageNumber: prevState.pageNumber - 1 })); }; goToNextPage = () => { this.setState(prevState => ({ pageNumber: prevState.pageNumber + 1 })); }; printDocument = () => { pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`; const loadingTask = pdfjs.getDocument(this.props.file); loadingTask.promise.then(pdf => { const printOptions = { ...pdfjs.DefaultPrintParams, printResolution: 150, embedJavascript: true, }; const pdfWindow = window.open('', '_blank', 'width=800,height=600,scrollbars=no'); pdfWindow.document.write('<html><head><title>Print</title></head><body>'); pdfWindow.document.write('<embed type="application/pdf" '); pdfWindow.document.write(`src="${this.props.file}" `); pdfWindow.document.write(`id="pdfDocument" `); pdfWindow.document.write(`print="print" `); pdfWindow.document.write(`options='${JSON.stringify(printOptions)}' `); pdfWindow.document.write('></embed>'); pdfWindow.document.write('</body></html>'); pdfWindow.document.close(); setTimeout(() => { pdfWindow.print(); }, 500); }); }; render() { const { pageNumber, numPages } = this.state; return ( <div> <p> Page {pageNumber} of {numPages} </p> <Document file={this.props.file} onLoadSuccess={this.onDocumentLoadSuccess}> <Page pageNumber={pageNumber} /> </Document> <Button disabled={pageNumber <= 1} onClick={this.goToPrevPage}> Previous </Button> <Button disabled={pageNumber >= numPages} onClick={this.goToNextPage}> Next </Button> <Button onClick={this.printDocument}>Print</Button> </div> ); } } export default PDFViewer; ``` 在上面的代码中,我们添加了一个 `printDocument` 方法,该方法会打开一个新的窗口,并在窗口中显示 PDF 文件,然后调用 `window.print()` 方法将 PDF 文件打印出来。注意,该方法中使用了 PDF.js 库的 `getDocument` 方法来获取 PDF 文件的信息。 这样就可以在 Ant Design Pro 中预览和打印 PDF 文件了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值