1

merge pdf

Hello, In my database when I send a bill from a customer, I have to create two documents. The invoice in pdf and the payment in pdf. After that, I sent it by email. To improve my database, I would like to be able to merge my two pdf into one. An idea to realize this? Go to an API to send PDF files and send and receive them back the merged PDF? Another way to do?

10 replies

null
    • SMoore
    • 6 yrs ago
    • Reported - view

    I second this

    • Jorg
    • 6 yrs ago
    • Reported - view

    Hi, 

    That is not possible yet, but we have it already in our list of requested features.

    Best, Jörg

    • yavibakiy
    • 5 yrs ago
    • Reported - view

    To merge multiple PDF files into single PDF file you can make use of Softaken PDF Merge Tool which is the safe and secure software to use without facing any problem. You can easily operate this application and non-technical guys too because of its friendly user interface.

    • sududukobe
    • 5 yrs ago
    • Reported - view

    Try Softaken PDF Champ

    • DELETED97harrybrown
    • 5 yrs ago
    • Reported - view

    Use the KDETools PST Merger to merge the multiple PST files in one PST file. This Software merges various PST items such as calendars, contacts, email, notes and all. It supports in ANSI and UNICODE file format. It supports all the Version. It merge unlimited PST files. It merge PST file without installing MS-Outlook. This Software remove the duplicate items.   

    • wiyid22493
    • 1 yr ago
    • Reported - view

    You can easily combine two or more PDF files into a single file. Use the OSTtoPSTAPP Merge PDF Tool if you want simple and organized ways to merge PDF files. That takes care of all your PDF integration problems. With many amazing features, such as the ability to merge multiple PDF files at the same time, ease of use, and compatibility with all versions of Windows, this software is a perfect match for those who use The most important thing is that it offers a free demo service. Users can measure the performance of the tool in the demo pack, which is very useful for all users.

    • danielmarine
    • 1 yr ago
    • Reported - view

    Hi,

    The following formula displays a html button which achieves the desired result within Ninox.

    You need URLs of each file you would like to combine. You then create a list of these URLs ensuring that they are separated by ','

    For example, if you had 3 pdf files the array would need to look like this, making sure to include the single quotes:

    'https://example1.pdf', 'https://example2.pdf', 'https://example3.pdf'

    See the code below:

    let URLarray := join(TABLE1.'YOUR_IMAGE_URL_FIELD', "','");

    html("<!DOCTYPE html>
    <html lang=""en"">
    <head>
        <meta charset=""UTF-8"">
        <meta name=""viewport"" content=""width=device-width, initial-scale=1.0"">
        <title>Combine PDF Files from URLs</title>
    </head>
    <body>
        <button onclick=""combinePDF()"">Combine PDF Files from URLs</button>

        <script src=""https://cdnjs.cloudflare.com/ajax/libs/pdf-lib/1.16.0/pdf-lib.min.js""></script>
        <script>
            async function combinePDF() {
                const urls = [
    " +
    URLarray +
    "
                ];

                const pdfDoc = await PDFLib.PDFDocument.create();

                for (let i = 0; i < urls.length; i++) {
                    const response = await fetch(urls[i]);
                    const arrayBuffer = await response.arrayBuffer();
                    const tempPdfDoc = await PDFLib.PDFDocument.load(arrayBuffer);
                    const copiedPages = await pdfDoc.copyPages(tempPdfDoc, tempPdfDoc.getPageIndices());
                    copiedPages.forEach((page) => pdfDoc.addPage(page));

    if (i === urls.length - 1) {
                        const pdfBytes = await pdfDoc.save();
                        const blob = new Blob([pdfBytes], { type: ""application/pdf"" });
                        const url = URL.createObjectURL(blob);
                        const a = document.createElement(""a"");
                        a.href = url;
                        a.download = ""combined.pdf"";
                        a.click();
                    }
                }
            }
        </script>
    </body>
    </html>

      • Fabian_Glanz
      • 5 days ago
      • Reported - view

      Hi ,

      I am using your code and it works great! For my further workflow i need the created document in ninox.

      Do you know a way how to place the created document in a ninox document-field?

      I already tried to do it via the URl but unfortunatly it's only a temporary link and not a sharelink. Do you have a solution to finalize my workflow?

      Thanks, Fabain

      • danielmarine
      • 5 days ago
      • Reported - view

       Hi Fabian,

      As the code is javascript, you can simply use an API call to send the file as form data back into your database to populate the image field.

      Here is a simple javascript example:

      let URLarray := join(TABLE1.'YOUR_IMAGE_URL_FIELD', "','");
      
      html("<!DOCTYPE html>
      <html lang=""en"">
      <head>
          <meta charset=""UTF-8"">
          <meta name=""viewport"" content=""width=device-width, initial-scale=1.0"">
          <title>Combine PDF Files from URLs</title>
      </head>
      <body>
          <button onclick=""combinePDF()"">Combine PDF Files from URLs</button>
          <script src=""https://cdnjs.cloudflare.com/ajax/libs/pdf-lib/1.16.0/pdf-lib.min.js""></script>
          <script>
              async function combinePDF() {
                  const urls = [
      " +
      URLarray +
      "            ];
                  const pdfDoc = await PDFLib.PDFDocument.create();
      
                    for (let i = 0; i < urls.length; i++) {
                  const response = await fetch(urls[i]);
                  const arrayBuffer = await response.arrayBuffer();
                  const tempPdfDoc = await PDFLib.PDFDocument.load(arrayBuffer);
                  const copiedPages = await pdfDoc.copyPages(tempPdfDoc, tempPdfDoc.getPageIndices());
                  copiedPages.forEach((page) => pdfDoc.addPage(page));
              }
      
      
              const pdfBytes = await pdfDoc.save();
      
              // Create a Blob from the PDF bytes
              const pdfBlob = new Blob([pdfBytes], { type: 'application/pdf' });
      
              // Create a FormData object and append the PDF file
              const formData = new FormData();
              formData.append('file', pdfBlob, 'your_combined_file_name.pdf');
      
              // Send the PDF data to the API
              var apiUrl = 'https://api.ninox.com/v1/teams/YourTeamID/databases/YourDatabaseID/tables/YourTableID/records/YourRecordID/files';
              var response = await fetch(apiUrl, {
                  method: 'POST',
                  headers: {
                      'Authorization': 'Bearer YOUR NINOX API KEY HERE'
                  },
                          body: formData,
        redirect: ""follow""
      
              });
      
              if (response.ok) {
                  alert('PDF sent successfully');
              } else {
                  alert('Failed to send PDF', response.statusText);
      
              }
      
          </script>
      </body>
      </html>
      

      As far as I know, files need to be sent to the /files endpoint, so cannot be sent directly into an image field. However, once you have a file attached to a record, you can use a trigger such as a button to then populate an image field with the file. Alternatively, you could simply use a Ninox formula to reference and display the file.

      Let me know whether this helps!

    • Ben_Jahn
    • 5 days ago
    • Reported - view

    Here is a sample database on this topic. Two PDF documents are merged here. I found this solution in the German-speaking forum.