Question: I have some PDF documents on a Linux server that I want to combine together to form one document using PHP 5? Does anyone know if this can be done? Is there any solution on VeryPDF?
Answer: According to your needs, maybe you can have a free trial of this software: VeryPDF PDF Merger Cloud API. By this cloud API application, for one thing you can use it under Linux system. For another thing, you can call it from PHP code easily. By this PDF Merger Cloud API, you can merge two or more files into one PDF file, or extract some pages from some PDF files and merge them into a new PDF file. Please check more information of this software on homepage, in the following part, let us check how to use this software.
Step 1. Get an API code of PDF Merger Cloud API
- If you already have an account of VeryPDF Cloud API application, please do not do anything. Simply by the API key code you have then you can merge PDF by this cloud API application.
- If you do not have an account yet, please register an account on registration page by an email address and a user name. When you finish payment, then the API key code will be sent to your email box at once.
Step 2. Merge PDF from PHP code under Linux system
- Same with other cloud API application, VeryPDF cloud applications can work under any system. It gives developers on all platforms total control over documents and file formats including Linux system. It interoperates seamlessly with other cloud services.
- When merge PDF from PHP code, please refer to the following code template.
/* gets the data from a URL */
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
$returned_content = get_data('http://online.verypdf.com/api/?apikey=XXXXXXXXXXXXX&app=pdftoolbox2&infile1=http://online.verypdf.com/examples/cloud-api/verypdf.pdf&infile2=http://online.verypdf.com/examples/cloud-api/multipage.pdf&infile3=http://online.verypdf.com/examples/cloud-api/verypdf2.pdf&outfile=out.pdf&cat=A&B&C');
By this above code template, we can merge three PDF file A&B&C to one PDF file. When you do real merging PDF, please change the apikey to the real API key code in your email box. Please change the input PDF URL to the real PDF file URL which need merging. When you do not need to merge PDF file from PHP code, simply copy the URL to any browser and press enter, you can find the output PDF file a few seconds later.
By this software you can also do lots of things, please check functions in homepage. During the using, if you have any question, please contact us as soon as possible.