Last active
October 22, 2020 14:53
-
-
Save groupdocscloud/e9df272d0718fb23d69ddc538caafb76 to your computer and use it in GitHub Desktop.
Extract Images from Documents in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extract images from Word documents, Excel spreadsheets, Presentations in Python. | |
options.file_info.file_path = "documents/doc-with-images.docx" | |
# Just change the document path according to requirement (doc/docx, xls/xlsx, ppt/pptx, ...) | |
request = groupdocs_parser_cloud.ImagesRequest(options) | |
result = parseApi.images(request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to extract images from Word documents, Excel spreadsheets, Presentations or PDF document in Python. | |
import groupdocs_parser_cloud | |
class ExtractImagesFromPDF: | |
@classmethod | |
def Run(cls): | |
# Obtain the APP SID and APP Key from https://dashboard.groupdocs.cloud/ | |
configuration = groupdocs_parser_cloud.Configuration("xxxx-APP-SID-xxx", "xxxx APP KEY xxx") | |
configuration.api_base_url = "https://api.groupdocs.cloud" | |
parseApi = groupdocs_parser_cloud.ParseApi.from_config(configuration) | |
options = groupdocs_parser_cloud.ImagesOptions() | |
options.file_info = groupdocs_parser_cloud.FileInfo() | |
options.file_info.file_path = "documents/doc-with-images.pdf" | |
request = groupdocs_parser_cloud.ImagesRequest(options) | |
result = parseApi.images(request) | |
# Display properties of extracted Images | |
for image in result.images: | |
print("Path: " + image.path) | |
print("Download url: " + image.download_url) | |
print("Image format: " + image.file_format) | |
print("Page index: " + str(image.page_index)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment