Cli-microsoft365: New command: convert file to PDF

Created on 15 Dec 2020  路  6Comments  路  Source: pnp/cli-microsoft365

Usage

file convert pdf [options]

Description

Converts the specified local file to PDF using Microsoft Graph

Options

Option|Description
--|--
-s, --sourceFile <sourceFile>|Local path or full URL to the source file to be converted to PDF
-t, --targetFile <targetFile>|Local path or full URL to where the generated PDF file should be saved

Additional Information

When CLI is authenticated on behalf of the current user, it will upload the file to convert to user's OneDrive for Business. When CLI is authenticated as app-only, it will upload the file to the Document library in the root SharePoint site. If targetFile is a local path, after the conversion is completed (no matter if it succeeded or not) the uploaded file is deleted. If a file with the same name already exists in the document library, this command will fail with an error.

good first issue new feature work in progress

Most helpful comment

Ship it 馃殌

All 6 comments

@pnp/cli-for-microsoft-365-maintainers I'd appreciate your feedback on this spec.

Should we also allow downloading files that are already in SharePoint/OneDrive for Business as PDF? If so, should this be possible in this command and then we allow the sourceFile to contain either a URL or a local path?

I think that conversion to PDF and downloading of files already stored in Microsoft 365 is a strong use-case so I think changing --sourceFile to accept a URL is a good idea.

I also think we should apply the same to --targetFile to also accept a URL, so you can convert and move a document from one location to another, useful for publishing scenarios where you want to seperate working and published documents.

Makes sense. The only restriction we need to put on targetFile that for URLs it must be absolute. If we'd allow relative URLs to the sourceFile location, we wouldn't be able to distinguish between a URL and a local path.

I was expecting the URLs to be absolute, similar to how the commands that accept --webUrl work currently, so I don't think that's a problem.

Updated the spec to allow both paths and URLs. Anything else or is it ready to go?

Ship it 馃殌

Was this page helpful?
0 / 5 - 0 ratings

Related issues

waldekmastykarz picture waldekmastykarz  路  3Comments

vineet2907 picture vineet2907  路  3Comments

aakashbhardwaj619 picture aakashbhardwaj619  路  3Comments

VelinGeorgiev picture VelinGeorgiev  路  3Comments

garrytrinder picture garrytrinder  路  3Comments