コード例 #1
0
ファイル: PdfiumBook.cs プロジェクト: iEmiya/PdfiumTranslator
        public static void Save(Dictionary <int, PdfiumPage> pages, string fileName)
        {
            var name = Path.GetFileNameWithoutExtension(fileName);
            var book = new PdfiumBook();

            book.Name  = name;
            book.Pages = new PdfiumPage[pages.Count];

            int no = 0;

            foreach (var p in pages.Values)
            {
                book.Pages[no++] = PdfiumPage.Encode(p);
            }

            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }

            using (var file = new StreamWriter(fileName))
            {
                Serializer.Serialize(file, book);
            }
        }
コード例 #2
0
        public PdfuimDocument(PdfDocument document, string fileName)
        {
            TranslateCurrentPage = false;
            _document            = document;
            _fileName            = Path.ChangeExtension(fileName, ".xml");
            _pages        = PdfiumBook.Load(_fileName);
            AutoSplitText = true;
            OnlyAscii     = true;
            HasSave       = true;

            _queue = new ConcurrentQueue <int>();
        }
コード例 #3
0
 public void Save()
 {
     PdfiumBook.Save(_pages, _fileName);
     HasSave = true;
 }