I am working on a Xamarin Forms project in which I want to transform my screenshot which is .PNG, to binary and upload it to a server.
Now the server part requires an API which I will be handed over by someone who has already made it, and I will only have to implement it... after I complete this task
I have so far succeeded in taking a screenshot of the whole screen and saving it into my device, so, I only need a bit of help with the Conversion part.. I have found a code for a solution but due to lack of knowledge and experience in C# I failed to implement it...
This is MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="UploadingFiles.MainPage">
    <StackLayout>
    <Button Text="Document filled"                          
        FontSize="12.5"
        Margin="0,0,0,0"
        HorizontalOptions="Center"
        FontFamily="MYICON"
        BorderColor="Black"
        Padding="0,0,0,0"
        BorderWidth="1"
        BackgroundColor="White"
        WidthRequest="120"
        HeightRequest="23"
        CornerRadius="0"
        Clicked="DoPDFThings"
        TextColor="Black"
        FontAttributes="Bold"/>
    </StackLayout>
</ContentPage>Here is the C# part...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NativeMedia;
using Xamarin.Essentials;
using Xamarin.Forms;
namespace UploadingFiles
{
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
        }
        private async void DoPDFThings(object sender, EventArgs e)
        {
            var screenshot = await Screenshot.CaptureAsync(); //    working 100% for partial sc: was var imageStream = await header.CaptureImageAsync();
            //  working 100% for partial sc: await MediaGallery.SaveAsync(MediaFileType.Image, imageStream, "myScreenshot.png");
            //  var screenshot = await Screenshot.CaptureAsync();
            await MediaGallery.SaveAsync(MediaFileType.Image, await screenshot.OpenReadAsync(), "myScreenshot.png");
        }
    }
} 
    