We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 86c7588 commit efb5f68Copy full SHA for efb5f68
Backend/NotesToText.py
@@ -2,4 +2,22 @@
2
3
4
# Create an instance of APIRouter
5
-router = APIRouter()
+router = APIRouter()
6
+
7
+def pdf_to_images(pdf_path, output_folder):
8
+ # Convert PDF pages to images
9
+ images = convert_from_path(pdf_path)
10
11
+ # Create the output folder if it doesn't exist
12
+ if not os.path.exists(output_folder):
13
+ os.makedirs(output_folder)
14
15
+ # Save each image in the specified output folder
16
+ image_paths = []
17
+ for i, image in enumerate(images):
18
+ image_path = os.path.join(output_folder, f'page_{i+1}.jpeg')
19
+ image.save(image_path, 'JPEG')
20
+ image_paths.append(image_path)
21
+ noImg = i+1
22
23
+ return image_paths,noImg
0 commit comments