将多个PDF合并成一个PDF [英] Merge Multiple PDF's into one PDF

查看:126
本文介绍了将多个PDF合并成一个PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码存在一些问题。我试图循环访问包含许多PDF的驱动器文件夹,然后将它们合并到一个文件中。当我使用我的代码时,它只是为驱动器文件夹中的最后一个PDF创建一个PDF,而不是像预期的那样将它们全部合并在一起。

I am having some issues with my code. I am trying to loop through a drive folder that contains many PDF's and then merge these into one file. When I use my code it just creates a PDF for the last PDF in the drive folder and not merge them all together as expected.

function MergeFiles(){
var folder = DocsList.getFolderById('myFolderID'); 
var files = folder.getFiles(); 
var blobs = [];    
for( var i in files )   
blobs.push(files[i].getBlob().getBytes());
Logger.log(blobs.push(files[i].getBlob().getBytes()));
var myPDF = Utilities.newBlob(blobs.pop(), "application/pdf", "newPDF.pdf");
folder.createFile(myPDF);

    }


推荐答案

pdf绝对不是一个简单的多个pdf文件内容的连接...我怀疑你可以用这种方法得到任何结果,即使我承认它似乎引诱...

A multipage pdf is definitely not a simple concatenation of multiple pdf file contents... I doubt that you could get any result with this approach even if I admit it seems seducing...

我一直在寻找类似的东西,但直到现在才成功。

I've been looking for something like that also but without success until now.

这篇关于将多个PDF合并成一个PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆