Skip to content

Commit 52febea

Browse files
Create ProgrammaticSaveAs.md
1 parent 4adaf66 commit 52febea

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

specs/ProgrammaticSaveAs.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Programmatic Save As API
2+
3+
4+
# Background
5+
6+
The context menu has the "Save as" item to manually save the html page, image, pdf, or other content through a save as dialog. We provide more flexiable ways to do the save as programmatically in WebView2. You can bring up the default save as dialog easily. And you will be able to block default dialog, save the content silently, by providing the path and save as type programmatically or even build your own save as UI.
7+
8+
In this document we describe the API. We'd appreciate your feedback.
9+
10+
# Description
11+
12+
We propose the `SaveContentAs` method WebView2, which allows you to trigger the save as programmatically. By using this method alone, the system default will popup.
13+
14+
Additionally, we propose the `SaveAsRequestedEvent`. You can register this event to block the default dialog and use the `SaveAsRequestedEventArgs` instead, to set your perferred save as path, save as type, and depulicate file replacement rule. In your clinet app, you can design your own UI to input these parameters. For html page, we support 3 save as types: HTML_ONLY, SINGLE_FILE and COMPLETE. For non-html page, the type is been set as DEFAULT, which will save the content as it is. This API also provides default values for all parameters, if you don't want to input anything.
15+
16+
# Examples
17+
## Win32 C++
18+
# API Details
19+
## Win32 C++
20+
Sync with the code and design doc soon

0 commit comments

Comments
 (0)