PDF的复制然后合并中断输出PDF

时间:2015-10-15 19:13:23

标签: php pdftk fdf

我想弄清楚为什么以下代码会破坏输出的PDF .. 我正在复制几个PDF文件,它们组合得很好,PDF表单填写完毕,但是当我启用下面的代码时,我只得到一个空白的PDF(没有填写),这会显示在错误日志中。< / p>

list1 <- list(business_id = 1:10,
              type = letters[1:10],
              values_1 = rnorm(10, 1))
# List of 3
# $ business_id: int [1:10] 1 2 3 4 5 6 7 8 9 10
# $ type       : chr [1:10] "a" "b" "c" "d" ...
# $ values_1   : num [1:10] 1.346 1.01 0.664 0.495 1.678 ...

list2 <- list(business_id = 5:14,
              type = letters[5:14],
              values_2 = rpois(10, 50))
# List of 3
# $ business_id: int [1:10] 5 6 7 8 9 10 11 12 13 14
# $ type       : chr [1:10] "e" "f" "g" "h" ...
# $ values_2   : int [1:10] 49 45 52 48 53 49 43 49 49 54

merge(list1, list2, by = c("business_id", "type"), all = TRUE)

#    business_id type    values_1 values_2
# 1            1    a  1.34647449       NA
# 2            2    b  1.00967581       NA
# 3            3    c  0.66401918       NA
# 4            4    d  0.49516496       NA
# 5            5    e  1.67790930       49
# 6            6    f  1.10751253       45
# 7            7    g  3.51306102       52
# 8            8    h  2.05527040       48
# 9            9    i  0.08864909       53
# 10          10    j -1.03377394       49
# 11          11    k          NA       43
# 12          12    l          NA       49
# 13          13    m          NA       49
# 14          14    n          NA       54
Warning: input PDF is not an acroform, so its fields were not filled.

我构建了数组,因此我之后只删除了那些文件。

这是结合它们的命令,也许我错过了什么?

for ($i = 1; $i <= $totesi; $i++) { $pgnum = ($i + 1); if(!copy('../attachment2.pdf', $pgnum . '.pdf')) { echo 'Failed to Copy'; } $pdfarr[] .= $pgnum . '.pdf'; }

再次如上面的代码所说,它不起作用。

更新

我尝试将存档与pdftk *.pdf cat output file.pdf分开,它可以正常工作1页,如果数组包含的内容少于10米,则会发生更多错误。

pdftk
if ($totesi >= 1) {
    for ($i = 1; $i <= $totesi; $i++) {
        if(strpos($type, 'Nodal') !== FALSE) {
            $tempstr .= ' 6';
        } elseif(strpos($type, 'All Inc') !== FALSE) {
            $tempstr .= ' 5';
        }
    }
    shell_exec("pdftk 1.pdf cat ".$pdffile." ". $tempstr ." output 1111111.pdf");
    unlink('1.pdf');
}
Warning: input PDF is not an acroform, so its fields were not filled.

这也不起作用。

0 个答案:

没有答案