/// <summary> /// Reorder a page before rendering /// </summary> /// <param name="Handler">Base class of handlers</param> /// <param name="guid">File name</param> /// <param name="currentPageNumber">Existing number of page</param> /// <param name="newPageNumber">New number of page</param> public static void ReorderPage(ref ViewerHandler <PageHtml> Handler, String guid, int currentPageNumber, int newPageNumber) { //ExStart:reorderPage //Initialize the ReorderPageOptions object by passing guid as document name, current Page Number, new page number ReorderPageOptions options = new ReorderPageOptions(currentPageNumber, newPageNumber); // call ViewerHandler's Reorder page function by passing initialized ReorderPageOptions object. Handler.ReorderPage(guid, options); //ExEnd:reorderPage }
public static ReorderPageResponse ReorderPage(ReorderPageParameters parameters) { string guid = parameters.Path; DocumentInfoContainer documentInfoContainer = _imageHandler.GetDocumentInfo(guid); int pageNumber = documentInfoContainer.Pages[parameters.OldPosition].Number; int newPosition = parameters.NewPosition + 1; ReorderPageOptions reorderPageOptions = new ReorderPageOptions(pageNumber, newPosition); _imageHandler.ReorderPage(guid, reorderPageOptions); return(new ReorderPageResponse()); }
public static void Reorder_Pages_In_Html_Mode() { Console.WriteLine("***** {0} *****", "Reorder pages in Html mode"); /* ********************* SAMPLE ********************* */ /* ******************** Reorder 1st and 2nd pages *********************** */ // Setup GroupDocs.Viewer config ViewerConfig config = new ViewerConfig(); config.StoragePath = @"C:\storage"; // Create html handler ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config); string guid = "word.doc"; int pageNumber = 1; int newPosition = 2; // Perform page reorder ReorderPageOptions options = new ReorderPageOptions(guid, pageNumber, newPosition); htmlHandler.ReorderPage(options); /* ******************** Retrieve all document pages including transformation *********************** */ // Set html options to include reorder transformations HtmlOptions htmlOptions = new HtmlOptions { Transformations = Transformation.Reorder }; // Get html representation of all document pages, including reorder transformations List<PageHtml> pages = htmlHandler.GetPages(guid, htmlOptions); /* ******************** Retrieve all document pages excluding transformation *********************** */ // Set html options NOT to include ANY transformations HtmlOptions noTransformationsOptions = new HtmlOptions { Transformations = Transformation.None // This is by default }; // Get html representation of all document pages, without transformations List<PageHtml> pagesWithoutTransformations = htmlHandler.GetPages(guid, noTransformationsOptions); // Get html representation of all document pages, without transformations List<PageHtml> pagesWithoutTransformations2 = htmlHandler.GetPages(guid); }
public ActionResult ReorderPage(ReorderPageParameters parameters) { string guid = parameters.Path; DocumentInfoOptions documentInfoOptions = new DocumentInfoOptions(guid); DocumentInfoContainer documentInfoContainer = _imageHandler.GetDocumentInfo(documentInfoOptions); int pageNumber = documentInfoContainer.Pages[parameters.OldPosition].Number; int newPosition = parameters.NewPosition + 1; ReorderPageOptions reorderPageOptions = new ReorderPageOptions(guid, pageNumber, newPosition); _imageHandler.ReorderPage(reorderPageOptions); return(ToJsonResult(new ReorderPageResponse())); }
public ActionResult ReorderPage(ReorderPageParameters parameters) { try { string guid = parameters.Path; DocumentInfoContainer documentInfoContainer = _imageHandler.GetDocumentInfo(guid); int pageNumber = documentInfoContainer.Pages[parameters.OldPosition].Number; int newPosition = parameters.NewPosition + 1; ReorderPageOptions reorderPageOptions = new ReorderPageOptions(pageNumber, newPosition); _imageHandler.ReorderPage(guid, reorderPageOptions); return(ToJsonResult(new ReorderPageResponse())); } catch (Exception e) { return(this.JsonOrJsonP(new FailedResponse { Reason = e.Message }, null)); } }
public ActionResult ReorderPage(ReorderPageParameters parameters) { string guid = parameters.Path; DocumentInfoContainer documentInfoContainer = _imageHandler.GetDocumentInfo(guid); int pageNumber = documentInfoContainer.Pages[parameters.OldPosition].Number; int newPosition = parameters.NewPosition + 1; ReorderPageOptions reorderPageOptions = new ReorderPageOptions(guid, pageNumber, newPosition); _imageHandler.ReorderPage(reorderPageOptions); return ToJsonResult(new ReorderPageResponse()); }