Fusion de 2 PDF Documents a travers 4D

Comment je peux realiser cette tache???Urgent SVP.


Quelle plateforme ? quand tu dis fusionner, c’est quoi exactement, ajouter/insérer des pages ou superposer deux pdf l’un sur l’autre ?

4D V16. J’ai 2 document PDF et je veux les fusionner en un Seul par ajouter un a un autre ou vous pouvez me proposer une autre solution s’il existe. On windows

I suppose it is possible with GhostScript:


but it might be easier with PDFtk:


I want an integrated solution In 4D because I couldn’t understand the given Code Keisuke_Miyako.

To be clear: do you mean…

  1. I want 100% native code; no plugin, no LAUNCH EXTERNAL PROCESS, or
  2. I want a high-level integration example so that I don’t have to understand the low-level plugin or LAUNCH EXTERNAL PROCESS

pdf manipulation is not native to 4D. you will have to use some libraries or tool to achieve that.

Miyako is trying to help.

I wasn’t demeering Miako’s efforts simply i didn’t understood the code. but i was asked to merge 2 PDF files through 4D and it’s been 2 days stuck hhhhhh.

I want 100% native code


The only way to do this 100% native is to write the code to manipulate pdf directly (i.e. understanding pdf file format, etc…) … You are going to be stuck more than 2 days I am afraid…

You need to be pragmatic and accept the help Miyako is offering using a plugin or an external tool.

1 Like


You can use my component to do this (which makes use of python) , You can merge pdfs by simply copying the component into your database’s component folder , then run the method launch_pdf_script and make sure that python is installed in your machine .If it isn’t , take a look at the following steps :

  1. Install python https://www.python.org/downloads/windows/
  2. Install pip utility by simply copying the content of the following link : https://bootstrap.pypa.io/get-pip.py and pasting it into a file named get-pip.py , then run the following command : python get-pip.py
  3. Install the pyPDF2 library which facilitates pdf files manipulation by simply running the command : pip install pyPDF2

The resulting pdf file will be inside the component’s resources folder ( not the database’s) under the name merged_files.pdf

Link to comp : https://github.com/ayoub-kl/pdf_merge.git