Ejemplo n.º 1
0
 public Stream ConvertToHtml(Source source, Stream destination)
 {
     if (source != null && source.FileData != null)
     {
         string fileExt = source.GetFileExtension();
         if (!string.IsNullOrEmpty(fileExt))
         {
             using (MemoryStream ms = new MemoryStream(source.FileData))
             {
                 BaseAsposeLoader loader = null;
                 if (WordExtensions.Contains(fileExt))
                 {
                     loader = new WordDocumentLoader(ms, null);
                 }
                 else if (CellExtensions.Contains(fileExt))
                 {
                     loader = new WorkbookLoader(ms, null);
                 }
                 else if (SlideExtensions.Contains(fileExt))
                 {
                     loader = new PresentationLoader(ms, null);
                 }
                 else if (PdfExtensions.Contains(fileExt))
                 {
                     loader = new PdfLoader(ms, null);
                 }
                 return(loader != null?loader.GetHtml(destination) : null);
             }
         }
     }
     return(null);
 }
Ejemplo n.º 2
0
        public ViewController(IntPtr handle)
            : base(handle)
        {
            var imageLoader = new PresentationLoader (presentation, 5);
            imageLoader.NextSlide += (object sender, SlideEventArgs e) => {
                var nsData = NSData.FromStream(e.ImageStream);
                var image = new UIImage (nsData);
                // scale the image to fit in the image view
                //var scaledImage = image.Scale(imageView.Frame.Size);
                this.InvokeOnMainThread(()=> imageView.Image = image);
                // put the scaled image in the image  view

            };
            imageLoader.Run ();
        }
Ejemplo n.º 3
0
        public Stream StripPassword(Source source, string password, Stream destination)
        {
            if (source != null && source.FileData != null)
            {
                string fileExt = source.GetFileExtension();
                if (!string.IsNullOrEmpty(fileExt))
                {
                    using (MemoryStream ms = new MemoryStream(source.FileData))
                    {
                        BaseAsposeLoader loader = null;
                        if (WordExtensions.Contains(fileExt))
                        {
                            loader = new WordDocumentLoader(ms, password);
                        }
                        else if (CellExtensions.Contains(fileExt))
                        {
                            loader = new WorkbookLoader(ms, password);
                        }
                        else if (SlideExtensions.Contains(fileExt))
                        {
                            loader = new PresentationLoader(ms, password);
                        }
                        else if (PdfExtensions.Contains(fileExt))
                        {
                            loader = new PdfLoader(ms, password);
                        }

                        if (loader != null && loader.IsPasswordCorrect)
                        {
                            return(loader.GetUnprotectedStream(destination));
                        }
                    }
                }
            }
            return(null);
        }