API Name: PDFMergerAPI
Version: 1.0
PDFMergerAPI offers a robust and efficient solution for integrating PDF merging functionality into your digital products, including web applications, mobile applications, and desktop software. Engineered for simplicity, speed, and security, our API enables you to merge multiple PDF files into a single document seamlessly.
Begin by registering for an API key on our website. This key is essential for authenticating your requests and accessing the PDF merging service.
Merging PDFs:
import requests
import base64
# API endpoint
url = "https://pdf-merge2.p.rapidapi.com/pdfmerge"
# Example PDF files
PDFFilename1 = 'pdf_1.pdf'
PDFFilename2 = 'pdf_2.pdf'
# Prepare payload and headers
payload = []
headers = {
"content-type": "application/json",
"X-RapidAPI-Key": "YOUR_API_KEY_HERE",
"X-RapidAPI-Host": "pdf-merge2.p.rapidapi.com"
}
# Function to open and encode PDF
def OpenPDF(filename):
with open(filename, "rb") as pdf_file:
encoded_pdf = base64.b64encode(pdf_file.read()).decode("utf-8")
return encoded_pdf
# Append encoded PDFs to payload
payload.extend([OpenPDF(PDFFilename1), OpenPDF(PDFFilename2)]) # Add more as needed
# Send request
response = requests.post(url, json=payload, headers=headers)
print(response.json())
For any inquiries or technical support, please reach out to our customer support team through our website’s contact form.