'Merge PDF documents in different versions
I'm using Google App Scripts to manipulate some PDFs.
I have two PDFs and want to merge them into one - im trying to use Merge Multiple PDF's into one PDF
One of the PDFs is in version 1.4 and have the trailer.
The other is a PDF generated based on a gdoc and gets in version 1.5 and does not have trailer.
Code i use to generate PDF file:
var docblob = DriveApp.getFileById("fileID").getAs('application/pdf');
docblob.setName("TEST pdf");
var file = DriveApp.createFile(docblob);
var fileId = file.getId();
Script of Merge Multiple PDF's into one PDF is not dealing right with this last file because does not have trailer.
Does anyone have a solution to generate a pdf in 1.4 version using appscripts? Or other solution to merge pdf files on appscripts?
Solution 1:[1]
Slightly old question, but would have liked finding a reply so I'll put one for future reference.
I tried using the SO suggestion you mentioned a few days ago and could not make it work either, even if I had two 1.4 PDFs.
I asked the author to be sure: @pokycoder kindly confirmed that his code is suitable only for PDF versions <1.4 (strictly less than, i.e. not including 1.4). So neither of your files would be handled by the code even if they were of the same version.
(As a curiosity: he commented it would not be intuitive to upgrade the code because "the trailer dictionary is a compressed data stream.")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Giampaolo Ferradini |