예제 #1
0
        public void SaveAsEpub(ExportInfo info, List <LoadedFile> files)
        {
            var document = new Document(InputFormat.rtf);

            foreach (var file in files)
            {
                document.AddFile(file.Path);
            }
            document.Author          = info.Author;
            document.Language        = "en";
            document.Publisher       = "Home entertainment";
            document.PublicationTime = (DateTime.Today);// info.DatePublish;
            document.Rights          = "all";
            document.Title           = info.Title;
            if (info.ImagePath != null && !string.IsNullOrEmpty(info.ImagePath))
            {
                document.PathToCover = info.ImagePath;
            }
            var convertor = new Convertor(document);

            convertor.CreateEpub(info.SavePath.EndsWith("\\")? info.SavePath: (info.SavePath + "\\") + info.Title + ".epub");
            //  HackDocument document = new HackDocument(filePath);
            //  document.BuiltinDocumentProperties.Title = info.Title;
            //  document.BuiltinDocumentProperties.Author = info.Author;
            //document.BuiltinDocumentProperties.CreateDate = (DateTime)info.DatePublish == null ? DateTime.Now : (DateTime)info.DatePublish;
            //    var section=document.AddSection();
            //    section.Document.LoadRtf(@"C:\test.rtf");
            //  section = document.AddSection();
            //    section.Document.LoadRtf(filePath);
            //   document.PremiumSave(info.SavePath + "\\" + Path.GetFileNameWithoutExtension(filePath) + ".epub", FileFormat.EPub);
        }
예제 #2
0
        //public byte[] ConvertDocumentToPdf(Stream aInputStream)
        //{
        //    byte[] tResult = null;
        //    using (MemoryStream tOutput = new MemoryStream())
        //    {
        //        ConvertDocumentToPdf(aInputStream, tOutput);
        //        tResult = tOutput.ToArray();
        //    }
        //    return tResult;
        //}

        //public void ConvertDocumentToPdf(Stream aInputStream, Stream aOutputStream)
        //{
        //  //  SpireLicense.LicenseProvider.SetLicenseKey(@"sGB6g9jPENUBAIRgo6LnJuyXETnXf19qM7KMKXiy12yslrfh84Ukseil96/AQOrfQyQOjO6iFpO+28+EgRa2bQK5voH908vfGNak2EmkwZolFWRHzujVNaA9Y95ctuKYBm4iVcelMWn8P6hVLxnasVhESC+cMbOh3jeQW3zE/BbVNQrff/HC8RzIJKMsc47TlOirmeYdjn697g65EeQWSrf+kwjm46UfA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VOtx/U+H3b6L2LLeby8255zdD6dfBN/1e2Thz+LJGedWpytHW/wqkutDoG8gCaMb8zv+JvRy1kRkTxNiEY3os+u/CLQLht0xdiZO7814RGwiaMyH1ixzIiVmtEJzA6RCXDvjUvhSukY2QwVEJfXZMHyGOqWAdLA==");
        //    FileFormat tFileFormat = FileFormat.EPub;
        //    Document tDocument = new Document(aInputStream);
        //    tDocument.SaveToStream(aOutputStream, tFileFormat);
        //    tDocument.Close();
        //}
        public void SaveAsMobi(ExportInfo info, string filePath)
        {
            //SaveAsEpub(info, filePath);
            //var process = new Process();
            //process.StartInfo.UseShellExecute = false;
            //process.StartInfo.RedirectStandardOutput = true;
            //process.StartInfo.FileName = System.Windows.Forms.Application.StartupPath + "\\" + "kindlegen.exe";
            //process.StartInfo.Arguments = info.SavePath + "\\ToEpub.epub";
            //process.Start();
            //process.WaitForExit();
            //File.Delete(info.SavePath + "\\ToEpub.epub");
        }
예제 #3
0
        private void ButExport_Click(object sender, RoutedEventArgs e)
        {
            string folderPath = "";
            FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();

            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                folderPath = folderBrowserDialog.SelectedPath;
                ExportInfo exportInfo = new ExportInfo()
                {
                    Title       = exportPanel.TextBoxTitle.Text,
                    Author      = exportPanel.TextBoxAuthor.Text,
                    DatePublish = exportPanel.TextBoxPublishingDate.SelectedDate,
                    SavePath    = folderPath,
                    ImagePath   = (exportPanel.ImageName.Tag == null) ? "" : exportPanel.ImageName.Tag.ToString()
                };
                TextBox.MainControl.SaveAsEpub(exportInfo, BrowseProject.CurentProject.Files);
            }
        }