通过R创建可填充PDF文本框 [英] Create Fillable PDF Textbox via R
问题描述
我正在使用R Markdown中的测试文件,该文件是通过简单创建新的markdown文件在RStudio中生成的.它显示如下:
I am using the test file from R Markdown, generated in RStudio by simple creating a new markdown file. It appears as follows:
---
title: "Fillable Textbox?"
author: "The Need To Edit"
date: "Wednesday, October 21, 2015"
output: pdf_document
---
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r}
summary(cars)
```
You can also embed plots, for example:
```{r, echo=FALSE}
plot(cars)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
我的问题:
是否可以在PDF表单中创建可填充的文本框?
Is it possible to create a fillable textbox within the PDF form?
我正在使某些工作流程自动化,但是在这种自动化中,最终用户可能需要添加评论.我认为可填充文本框将是维护标准文档格式并为用户提供一些自由的好方法.除了添加可填充文本框外,我已经找到了几乎所有方法的方法,也许我搜索的是错误的表达式?
I am working to automate some of my workflow however within that automation the end user may need to add comments. I thought a fillable textbox would be a nice way to maintain a standard document format and give my users some freedom. I have found ways to do nearly everything except add a fillable textbox, perhaps I am searching the wrong expression?
推荐答案
hyperref程序包(自动加载)允许填充字段.只需使用其特定命令即可,您可以找到
The hyperref package (which is loaded automatically) allows fillable fields. It is just a matter of use its specific commands, which you can find here. Try this code (click on the right of the word Name
).
---
title: "Fillable Textbox?"
author: "The Need To Edit"
date: "Wednesday, October 21, 2015"
output: pdf_document
---
Since Rmarkdown uses knitr and it loads automatically hyperref I think hat this should work.
In fact it is just a matter of use some \LaTeX\ commands of the hyperref package.
```{r, echo=FALSE}
plot(cars)
```
\begin{Form}
\TextField{Name}
\end{Form}
此PDF当然可以作为PDF填充,然后在RStudio(如果使用)PDF查看器中将无法使用.
Of course this PDF is fillable as a PDF, and then it will not work inside the RStudio (if you use it) PDF viewer.
这篇关于通过R创建可填充PDF文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!