/* ----------------------------------------------------------------- */ /// /// Overwrite /// /// <summary> /// Overwrites the PDF document. /// </summary> /// /// <param name="src">Facade object.</param> /// /* ----------------------------------------------------------------- */ public static void Overwrite(this MainFacade src) { if (src.Bindable.History.Undoable) { src.Save(src.Bindable.Source.Value.FullName); } }
/* ----------------------------------------------------------------- */ /// /// Close /// /// <summary> /// Closes the current PDF document. /// </summary> /// /// <param name="src">Source object.</param> /// <param name="save">Save before closing.</param> /// /* ----------------------------------------------------------------- */ public static void Close(this MainFacade src, bool save) { if (save) { src.Save(src.Value.Source.FullName, false); } src.Close(); }
/* ----------------------------------------------------------------- */ /// /// Save /// /// <summary> /// Saves the PDF document to the specified file path. /// </summary> /// /// <param name="src">Source object.</param> /// <param name="dest">Path to save.</param> /// <param name="reopen"> /// Value indicating whether to reopen the document. /// </param> /// /* ----------------------------------------------------------------- */ public static void Save(this MainFacade src, string dest, bool reopen) => src.Save( dest, e => { src.Backup.Invoke(e); src.Cache?.Clear(); }, e => { if (reopen) { src.Reload(e.FullName); } src.Value.Set(Properties.Resources.MessageSaved, e.FullName); } );
/* ----------------------------------------------------------------- */ /// /// Save /// /// <summary> /// Save the PDF document /// </summary> /// /// <param name="src">Source object.</param> /// <param name="dest">Saving file information.</param> /// <param name="prev">Action to be invoked before saving.</param> /// <param name="next">Action to be invoked after saving.</param> /// /* ----------------------------------------------------------------- */ public static void Save(this MainFacade src, string dest, Action <Entity> prev, Action <Entity> next) { var obj = src.Value; var itext = obj.Source.GetItext(obj.Query, obj.IO, false); obj.Set(itext.Metadata, itext.Encryption); src.Save(itext, new SaveOption(obj.IO) { Target = SaveTarget.All, Split = false, Destination = dest, Metadata = obj.Metadata, Encryption = obj.Encryption, Attachments = itext.Attachments, }, prev, next); }
/* ----------------------------------------------------------------- */ /// /// Save /// /// <summary> /// Saves the PDF document to the specified file path. /// </summary> /// /// <param name="src">Facade object.</param> /// <param name="dest">File path.</param> /// /* ----------------------------------------------------------------- */ public static void Save(this MainFacade src, string dest) => src.Save(dest, true);
/* ----------------------------------------------------------------- */ /// /// Extract /// /// <summary> /// Extracts PDF pages saves to a file with the specified options. /// </summary> /// /// <param name="src">Source object.</param> /// <param name="options">Save options.</param> /// /* ----------------------------------------------------------------- */ public static void Extract(this MainFacade src, SaveOption options) => src.Save( null, options, e => src.Backup.Invoke(e), e => src.Value.Set(Properties.Resources.MessageSaved, e.FullName) );
/* ----------------------------------------------------------------- */ /// /// Overwrite /// /// <summary> /// Overwrites the PDF document. /// </summary> /// /// <param name="src">Source object.</param> /// /* ----------------------------------------------------------------- */ public static void Overwrite(this MainFacade src) => src.Value.History.Undoable.Then(() => src.Save(src.Value.Source.FullName));