Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions samples/AvalonDraw/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
<MenuItem Header="Place Image..." Click="PlaceImageMenuItem_Click"/>
<MenuItem Header="Preview" Click="PreviewMenuItem_Click" InputGesture="F5"/>
<MenuItem Header="Edit Text" Click="EditTextMenuItem_Click" InputGesture="Ctrl+T"/>
<MenuItem Header="Export as PDF..." Click="ExportPdfMenuItem_Click"/>
<MenuItem Header="Export as EPS..." Click="ExportEpsMenuItem_Click"/>
</MenuItem>
<MenuItem Header="Edit">
<MenuItem Header="Insert Element" Click="InsertElementMenuItem_Click" InputGesture="Ctrl+I"/>
Expand Down
38 changes: 38 additions & 0 deletions samples/AvalonDraw/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,44 @@ private async void ExportElementMenuItem_Click(object? sender, RoutedEventArgs e
SK.SKColorType.Rgba8888, SK.SKAlphaType.Premul, SvgView.SkSvg.Settings.Srgb);
}

private async void ExportPdfMenuItem_Click(object? sender, RoutedEventArgs e)
{
if (_document is null || SvgView.SkSvg?.Picture is null)
return;
var dialog = new SaveFileDialog
{
Filters = new()
{
new FileDialogFilter { Name = "PDF", Extensions = { "pdf" } },
new FileDialogFilter { Name = "All", Extensions = { "*" } }
},
DefaultExtension = "pdf",
};
var path = await dialog.ShowAsync(this);
if (string.IsNullOrEmpty(path))
return;
SvgView.SkSvg.Picture.ToPdf(path, SK.SKColors.Transparent, 1f, 1f);
}

private async void ExportEpsMenuItem_Click(object? sender, RoutedEventArgs e)
{
if (_document is null || SvgView.SkSvg?.Picture is null)
return;
var dialog = new SaveFileDialog
{
Filters = new()
{
new FileDialogFilter { Name = "EPS", Extensions = { "eps" } },
new FileDialogFilter { Name = "All", Extensions = { "*" } }
},
DefaultExtension = "eps",
};
var path = await dialog.ShowAsync(this);
if (string.IsNullOrEmpty(path))
return;
SvgView.SkSvg.Picture.ToXps(path, SK.SKColors.Transparent, 1f, 1f);
}

private async void PlaceImageMenuItem_Click(object? sender, RoutedEventArgs e)
{
if (_document is null)
Expand Down
Loading