none
[UWP]Sharing isf and pdf inkcanvas RRS feed

All replies

  • Hi,

    Could you please explain your requirement with more detail information? Where is the source file from? To what you want to share the file? Are them two UWP apps?

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, June 14, 2018 1:51 AM
    Moderator
  • When the user wants to share the InkCanvas ISF file to send email, OneNote, other devices.
    Thursday, June 14, 2018 7:45 AM
  •  

    this is  what   I want to do.

    Monday, June 18, 2018 10:35 AM
  • Hi,

    Yes, this is possible to implement. You could use DataTransferManager.ShowShareUI() method to call this window and add the data you want to share.

    Please refer the Official UWP sample Share Source. You could get more detail code from the sample.

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, June 19, 2018 7:20 AM
    Moderator
  •   private void RegisterForShare()
            {
    
                DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView();
                dataTransferManager.DataRequested += new TypedEventHandler<DataTransferManager,
                    DataRequestedEventArgs>(this.ShareImageHandler);
            }
    
            private  void ShareImageHandler(DataTransferManager sender, DataRequestedEventArgs args)
            {
                if(this.imageFile != null)
                {
                    DataRequest requestData = args.Request;
                    requestData.Data.Properties.Title = "Share InkCanvas";
                    requestData.Data.Properties.Description = "Share InkCanvas";
    
                    List<IStorageItem> imageItems = new List<IStorageItem>();
    
                    imageItems.Add(this.imageFile);
                    requestData.Data.SetStorageItems(imageItems);
                    RandomAccessStreamReference imageStreamRef = RandomAccessStreamReference.CreateFromFile(this.imageFile);
                    requestData.Data.Properties.Thumbnail = imageStreamRef;
                    requestData.Data.SetBitmap(imageStreamRef);
    
                }
    
    
            }
    
            private void btshare_Click(object sender, RoutedEventArgs e)
            {
                DataTransferManager.ShowShareUI();
            }
    When I press the button I get the window of sharing but I get nothing from app to share what I have done in the InkCanvas
    Thursday, June 21, 2018 9:41 AM
  • Hi,

    Sorry for the delay.

    Have you handled the sharing data in the target app? If not, I suggest that you could refer this link about how to receive data:https://docs.microsoft.com/en-us/windows/uwp/app-to-app/receive-data

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, June 28, 2018 8:35 AM
    Moderator
  • I want to share  strokes to PNG

    • Edited by Javier Ra Sunday, July 1, 2018 4:44 PM more information
    Sunday, July 1, 2018 4:26 PM
  • Hi,

    What do you mean share strokes to PNG? Can you explain it with more details? You want to save the strokes into a PNG and then share the PNG?

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, July 2, 2018 2:34 AM
    Moderator
  • Helo:

    Yes, the idea is to share the stroke in PNG ,  Another problem is that pressing the share button I get the veto but nothing comes out.

    Monday, July 2, 2018 5:07 PM
  • Hi,

    If you want to save the ink strokes in to .png files, you might take a look at Win2D. Add the Win2D.UWP NuGet package and using it to convert the the InkCanvas to a byte array, a pixels array or a memory stream. Then you could write it in a .png file.

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, July 3, 2018 8:49 AM
    Moderator
  • Better to share with ISF or PDF
    Tuesday, July 3, 2018 5:54 PM
  • Hi,

    You could directly store the ink strokes into a .isf file or .gif file. Please refer this document:https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/storing-ink. It shows how to save ink strokes into a .gif file but you could also save it into a .isf file too. Just change the file type to .isf.

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, July 4, 2018 1:02 AM
    Moderator
  • Hello:

    I want to do is share what I done InkCanvas, share through Outlook.

    Thursday, July 5, 2018 10:29 AM
  • Hi,

    First, if you want to share a file with email as an attachment, you could try to use EmailManager class (it requires Restricted capabilities called emailSystem and email ), this class will launch the default email app, create a new email and attach the file.

    But it is a note that it does not work with outlook. This is a know issue. You could refer this link: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/38c32901-b061-47f0-b43a-808d1aaa3993/uwp-emailmanagershowcomposenewemailasync-attachments-in-microsoft-office-365?forum=wpdevelop

    So if you want to share the file with email but not using outlook, you could try to use EmailManager class. If you need to use outlook, you might need to tell the customer to create a new email and attach the file manually.

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, July 6, 2018 8:34 AM
    Moderator
  • hi:

    I've been watching this link :

    Sharing

    Monday, July 9, 2018 7:06 AM
  • Hi,

    What's the behavior you want and what's the behavior you are getting now?

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, July 11, 2018 12:29 AM
    Moderator
  •  private  async void DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
            {
                DataPackage dataPackage = new DataPackage();
                dataPackage.Properties.Title = "InkPen";
                dataPackage.Properties.Description = "InkStroke";
    
                var file = await ApplicationData.Current.TemporaryFolder.CreateFileAsync("INkStrokePen.png", CreationCollisionOption.GenerateUniqueName);
    
                var stream = await file.OpenAsync(FileAccessMode.ReadWrite);
    
                dataPackage.SetBitmap(RandomAccessStreamReference.CreateFromStream(stream));
    
                dataPackage.SetStorageItems(new[] { file });
    
                var thumbnail = await file.GetThumbnailAsync(Windows.Storage.FileProperties.ThumbnailMode.SingleItem);
    
                dataPackage.Properties.Thumbnail = RandomAccessStreamReference.CreateFromStream(thumbnail);
    
                stream.Dispose();
    
            }
    
            private  void BTShare_Click( object sender, RoutedEventArgs e)
            {
                DataTransferManager.ShowShareUI();
            }
    Made this code but press rel button I get the share window but if no option.

    Wednesday, July 11, 2018 8:29 AM
  • hello: To share the stroke as an image for options like email, OneNote etc. When I'm going to share what's done the Inkcanvas me out 0 KB
    private  async Task ShareAsync(DataPackage dataPackage)
            {
               
                dataPackage.Properties.Title = "InkPen Page";
                dataPackage.Properties.ApplicationName = "InkPen";
                dataPackage.Properties.Description = "InkPen page sent from myInkPen app!";
    
                var file = await ApplicationData.Current.TemporaryFolder.CreateFileAsync("InkPen.png",
                    CreationCollisionOption.GenerateUniqueName);
                var stream = await file.OpenAsync(FileAccessMode.ReadWrite);
    
                dataPackage.SetBitmap(RandomAccessStreamReference.CreateFromStream(stream));
    
                dataPackage.SetStorageItems(new[] {file });
    
                var thumbnail = await file.GetThumbnailAsync(Windows.Storage.FileProperties.ThumbnailMode.SingleItem);
                dataPackage.Properties.Thumbnail = RandomAccessStreamReference.CreateFromStream(thumbnail);
    
                stream.Dispose();
    
                
            }


    • Edited by Javier Ra Monday, March 18, 2019 6:15 PM more information
    Friday, March 15, 2019 12:22 PM