Dear Sir or Madam,
as noted in the documentation, the conversion of pptx to jpeg is supported by Graph API. https://learn.microsoft.com/en-us/graph/api/driveitem-get-content-format?view=graph-rest-beta&tabs=http
However, when I convert it to jpg, I only retrieve a single image of the 1st slide. Please, see the code attached.
content_stream = None
url = f"https://graph.microsoft.com/v1.0/sites/{sharepoint_id}/drive/items/{document_id}/content?format=jpg&width=800&height=800"
headers = {'Authorization': 'Bearer ' + access_token}
response = requests.get(url, headers=headers, timeout = 1000000)#, timeout = 10) # in minutes, default 30 sec
print(response.status_code)
print(response.content)
if response.ok:
content_stream = BytesIO(response.content)
content_stream
I have also tried to specify the page or slide, but it is hard to guess which variable needs to be sent, as there is not good documentation on working with jpg.
This is what I have tried:
url = f"https://graph.microsoft.com/v1.0/sites/{sharepoint_id}/drive/items/{document_id}/content?slide=10&format=jpg&width=1200&height=1200"
url = f"https://graph.microsoft.com/v1.0/sites/{sharepoint_id}/drive/items/{document_id}/content?page=10&format=jpg&&width=1200&height=1200"
I have thoroughly researched the documentation https://github.com/microsoftgraph/microsoft-graph-docs-contrib/blob/main/api-reference/beta/resources/driveitem.md but I could not find an answer there or in the linked documents.
Could you please give me an exact answer how can I get more than 1 slide of pptx converted to jpeg with a code example, e.g. url format or link to the code example.
Best regards,
Maryna