We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0ca7ea0 commit acb2243Copy full SHA for acb2243
examples/split_and_merge_pdf.py
@@ -0,0 +1,21 @@
1
+import convertapi
2
+import os
3
+import tempfile
4
+
5
+convertapi.api_secret = os.environ['CONVERT_API_SECRET'] # your api secret
6
7
+# Example of extracting first and last pages from PDF and then merging them back to new PDF.
8
+# https://www.convertapi.com/pdf-to-split
9
+# https://www.convertapi.com/pdf-to-merge
10
11
+split_result = convertapi.convert('split', { 'File': 'files/test.pdf' })
12
13
+first_page = split_result.files[0]
14
+last_page = split_result.files[-1]
15
+files = [first_page, last_page]
16
17
+merge_result = convertapi.convert('merge', { 'Files': files })
18
19
+saved_files = merge_result.save_files(tempfile.gettempdir())
20
21
+print("The thumbnail saved to %s" % saved_files)
0 commit comments