diff --git a/PdfiumViewer.Demo/MainForm.Designer.cs b/PdfiumViewer.Demo/MainForm.Designer.cs index 7537f774..a219eb46 100644 --- a/PdfiumViewer.Demo/MainForm.Designer.cs +++ b/PdfiumViewer.Demo/MainForm.Designer.cs @@ -92,6 +92,8 @@ private void InitializeComponent() this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pdfViewer1 = new PdfiumViewer.PdfViewer(); + this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); + this._textMode = new System.Windows.Forms.ToolStripButton(); this.menuStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout(); @@ -119,46 +121,46 @@ private void InitializeComponent() this.toolStripMenuItem3, this.exitToolStripMenuItem}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Size = new System.Drawing.Size(36, 20); this.fileToolStripMenuItem.Text = "&File"; // // openToolStripMenuItem // this.openToolStripMenuItem.Name = "openToolStripMenuItem"; this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); - this.openToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.openToolStripMenuItem.Size = new System.Drawing.Size(173, 22); this.openToolStripMenuItem.Text = "&Open"; this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); // // toolStripMenuItem1 // this.toolStripMenuItem1.Name = "toolStripMenuItem1"; - this.toolStripMenuItem1.Size = new System.Drawing.Size(177, 6); + this.toolStripMenuItem1.Size = new System.Drawing.Size(170, 6); // // printPreviewToolStripMenuItem // this.printPreviewToolStripMenuItem.Name = "printPreviewToolStripMenuItem"; - this.printPreviewToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.printPreviewToolStripMenuItem.Size = new System.Drawing.Size(173, 22); this.printPreviewToolStripMenuItem.Text = "Print Preview"; this.printPreviewToolStripMenuItem.Click += new System.EventHandler(this.printPreviewToolStripMenuItem_Click); // // printMultiplePagesToolStripMenuItem // this.printMultiplePagesToolStripMenuItem.Name = "printMultiplePagesToolStripMenuItem"; - this.printMultiplePagesToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.printMultiplePagesToolStripMenuItem.Size = new System.Drawing.Size(173, 22); this.printMultiplePagesToolStripMenuItem.Text = "Print Multiple Pages"; this.printMultiplePagesToolStripMenuItem.Click += new System.EventHandler(this.printMultiplePagesToolStripMenuItem_Click); // // toolStripMenuItem3 // this.toolStripMenuItem3.Name = "toolStripMenuItem3"; - this.toolStripMenuItem3.Size = new System.Drawing.Size(177, 6); + this.toolStripMenuItem3.Size = new System.Drawing.Size(170, 6); // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); - this.exitToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(173, 22); this.exitToolStripMenuItem.Text = "E&xit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // @@ -179,57 +181,57 @@ private void InitializeComponent() this.toolStripMenuItem6, this.informationToolStripMenuItem}); this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem"; - this.toolsToolStripMenuItem.Size = new System.Drawing.Size(47, 20); + this.toolsToolStripMenuItem.Size = new System.Drawing.Size(45, 20); this.toolsToolStripMenuItem.Text = "&Tools"; // // findToolStripMenuItem // this.findToolStripMenuItem.Name = "findToolStripMenuItem"; this.findToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F))); - this.findToolStripMenuItem.Size = new System.Drawing.Size(244, 22); + this.findToolStripMenuItem.Size = new System.Drawing.Size(232, 22); this.findToolStripMenuItem.Text = "&Find"; this.findToolStripMenuItem.Click += new System.EventHandler(this.findToolStripMenuItem_Click); // // toolStripMenuItem7 // this.toolStripMenuItem7.Name = "toolStripMenuItem7"; - this.toolStripMenuItem7.Size = new System.Drawing.Size(241, 6); + this.toolStripMenuItem7.Size = new System.Drawing.Size(229, 6); // // renderToBitmapsToolStripMenuItem // this.renderToBitmapsToolStripMenuItem.Name = "renderToBitmapsToolStripMenuItem"; - this.renderToBitmapsToolStripMenuItem.Size = new System.Drawing.Size(244, 22); + this.renderToBitmapsToolStripMenuItem.Size = new System.Drawing.Size(232, 22); this.renderToBitmapsToolStripMenuItem.Text = "&Render to Bitmaps"; this.renderToBitmapsToolStripMenuItem.Click += new System.EventHandler(this.renderToBitmapsToolStripMenuItem_Click); // // toolStripMenuItem2 // this.toolStripMenuItem2.Name = "toolStripMenuItem2"; - this.toolStripMenuItem2.Size = new System.Drawing.Size(241, 6); + this.toolStripMenuItem2.Size = new System.Drawing.Size(229, 6); // // cutMarginsWhenPrintingToolStripMenuItem // this.cutMarginsWhenPrintingToolStripMenuItem.Name = "cutMarginsWhenPrintingToolStripMenuItem"; - this.cutMarginsWhenPrintingToolStripMenuItem.Size = new System.Drawing.Size(244, 22); + this.cutMarginsWhenPrintingToolStripMenuItem.Size = new System.Drawing.Size(232, 22); this.cutMarginsWhenPrintingToolStripMenuItem.Text = "Cut margins when printing"; this.cutMarginsWhenPrintingToolStripMenuItem.Click += new System.EventHandler(this.cutMarginsWhenPrintingToolStripMenuItem_Click); // // shrinkToMarginsWhenPrintingToolStripMenuItem // this.shrinkToMarginsWhenPrintingToolStripMenuItem.Name = "shrinkToMarginsWhenPrintingToolStripMenuItem"; - this.shrinkToMarginsWhenPrintingToolStripMenuItem.Size = new System.Drawing.Size(244, 22); + this.shrinkToMarginsWhenPrintingToolStripMenuItem.Size = new System.Drawing.Size(232, 22); this.shrinkToMarginsWhenPrintingToolStripMenuItem.Text = "Shrink to margins when printing"; this.shrinkToMarginsWhenPrintingToolStripMenuItem.Click += new System.EventHandler(this.shrinkToMarginsWhenPrintingToolStripMenuItem_Click); // // toolStripMenuItem4 // this.toolStripMenuItem4.Name = "toolStripMenuItem4"; - this.toolStripMenuItem4.Size = new System.Drawing.Size(241, 6); + this.toolStripMenuItem4.Size = new System.Drawing.Size(229, 6); // // deleteCurrentPageToolStripMenuItem // this.deleteCurrentPageToolStripMenuItem.Name = "deleteCurrentPageToolStripMenuItem"; - this.deleteCurrentPageToolStripMenuItem.Size = new System.Drawing.Size(244, 22); + this.deleteCurrentPageToolStripMenuItem.Size = new System.Drawing.Size(232, 22); this.deleteCurrentPageToolStripMenuItem.Text = "Delete Current Page"; this.deleteCurrentPageToolStripMenuItem.Click += new System.EventHandler(this.deleteCurrentPageToolStripMenuItem_Click); // @@ -241,58 +243,58 @@ private void InitializeComponent() this.rotate180ToolStripMenuItem, this.rotate270ToolStripMenuItem}); this.rotateCurrentPageToolStripMenuItem.Name = "rotateCurrentPageToolStripMenuItem"; - this.rotateCurrentPageToolStripMenuItem.Size = new System.Drawing.Size(244, 22); + this.rotateCurrentPageToolStripMenuItem.Size = new System.Drawing.Size(232, 22); this.rotateCurrentPageToolStripMenuItem.Text = "Rotate Current Page"; // // rotate0ToolStripMenuItem // this.rotate0ToolStripMenuItem.Name = "rotate0ToolStripMenuItem"; - this.rotate0ToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.rotate0ToolStripMenuItem.Size = new System.Drawing.Size(138, 22); this.rotate0ToolStripMenuItem.Text = "Rotate 0°"; this.rotate0ToolStripMenuItem.Click += new System.EventHandler(this.rotate0ToolStripMenuItem_Click); // // rotate90ToolStripMenuItem // this.rotate90ToolStripMenuItem.Name = "rotate90ToolStripMenuItem"; - this.rotate90ToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.rotate90ToolStripMenuItem.Size = new System.Drawing.Size(138, 22); this.rotate90ToolStripMenuItem.Text = "Rotate 90°"; this.rotate90ToolStripMenuItem.Click += new System.EventHandler(this.rotate90ToolStripMenuItem_Click); // // rotate180ToolStripMenuItem // this.rotate180ToolStripMenuItem.Name = "rotate180ToolStripMenuItem"; - this.rotate180ToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.rotate180ToolStripMenuItem.Size = new System.Drawing.Size(138, 22); this.rotate180ToolStripMenuItem.Text = "Rotate 180°"; this.rotate180ToolStripMenuItem.Click += new System.EventHandler(this.rotate180ToolStripMenuItem_Click); // // rotate270ToolStripMenuItem // this.rotate270ToolStripMenuItem.Name = "rotate270ToolStripMenuItem"; - this.rotate270ToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.rotate270ToolStripMenuItem.Size = new System.Drawing.Size(138, 22); this.rotate270ToolStripMenuItem.Text = "Rotate 270°"; this.rotate270ToolStripMenuItem.Click += new System.EventHandler(this.rotate270ToolStripMenuItem_Click); // // toolStripMenuItem5 // this.toolStripMenuItem5.Name = "toolStripMenuItem5"; - this.toolStripMenuItem5.Size = new System.Drawing.Size(241, 6); + this.toolStripMenuItem5.Size = new System.Drawing.Size(229, 6); // // showRangeOfPagesToolStripMenuItem // this.showRangeOfPagesToolStripMenuItem.Name = "showRangeOfPagesToolStripMenuItem"; - this.showRangeOfPagesToolStripMenuItem.Size = new System.Drawing.Size(244, 22); + this.showRangeOfPagesToolStripMenuItem.Size = new System.Drawing.Size(232, 22); this.showRangeOfPagesToolStripMenuItem.Text = "Show range of pages"; this.showRangeOfPagesToolStripMenuItem.Click += new System.EventHandler(this.showRangeOfPagesToolStripMenuItem_Click); // // toolStripMenuItem6 // this.toolStripMenuItem6.Name = "toolStripMenuItem6"; - this.toolStripMenuItem6.Size = new System.Drawing.Size(241, 6); + this.toolStripMenuItem6.Size = new System.Drawing.Size(229, 6); // // informationToolStripMenuItem // this.informationToolStripMenuItem.Name = "informationToolStripMenuItem"; - this.informationToolStripMenuItem.Size = new System.Drawing.Size(244, 22); + this.informationToolStripMenuItem.Size = new System.Drawing.Size(232, 22); this.informationToolStripMenuItem.Text = "Information"; this.informationToolStripMenuItem.Click += new System.EventHandler(this.informationToolStripMenuItem_Click); // @@ -318,6 +320,8 @@ private void InitializeComponent() this._rotateLeft, this._rotateRight, this.toolStripSeparator6, + this._textMode, + this.toolStripSeparator4, this._showToolbar, this._showBookmarks, this._getTextFromPage}); @@ -330,7 +334,7 @@ private void InitializeComponent() // toolStripLabel1 // this.toolStripLabel1.Name = "toolStripLabel1"; - this.toolStripLabel1.Size = new System.Drawing.Size(36, 22); + this.toolStripLabel1.Size = new System.Drawing.Size(32, 22); this.toolStripLabel1.Text = "Page:"; // // _page @@ -372,7 +376,7 @@ private void InitializeComponent() // toolStripLabel2 // this.toolStripLabel2.Name = "toolStripLabel2"; - this.toolStripLabel2.Size = new System.Drawing.Size(42, 22); + this.toolStripLabel2.Size = new System.Drawing.Size(35, 22); this.toolStripLabel2.Text = "Zoom:"; // // _zoom @@ -417,7 +421,7 @@ private void InitializeComponent() this._fitWidth.Image = ((System.Drawing.Image)(resources.GetObject("_fitWidth.Image"))); this._fitWidth.ImageTransparentColor = System.Drawing.Color.Magenta; this._fitWidth.Name = "_fitWidth"; - this._fitWidth.Size = new System.Drawing.Size(59, 22); + this._fitWidth.Size = new System.Drawing.Size(55, 22); this._fitWidth.Text = "Fit Width"; this._fitWidth.Click += new System.EventHandler(this._fitWidth_Click); // @@ -427,7 +431,7 @@ private void InitializeComponent() this._fitHeight.Image = ((System.Drawing.Image)(resources.GetObject("_fitHeight.Image"))); this._fitHeight.ImageTransparentColor = System.Drawing.Color.Magenta; this._fitHeight.Name = "_fitHeight"; - this._fitHeight.Size = new System.Drawing.Size(63, 22); + this._fitHeight.Size = new System.Drawing.Size(60, 22); this._fitHeight.Text = "Fit Height"; this._fitHeight.Click += new System.EventHandler(this._fitHeight_Click); // @@ -437,7 +441,7 @@ private void InitializeComponent() this._fitBest.Image = ((System.Drawing.Image)(resources.GetObject("_fitBest.Image"))); this._fitBest.ImageTransparentColor = System.Drawing.Color.Magenta; this._fitBest.Name = "_fitBest"; - this._fitBest.Size = new System.Drawing.Size(49, 22); + this._fitBest.Size = new System.Drawing.Size(51, 22); this._fitBest.Text = "Fit Best"; this._fitBest.Click += new System.EventHandler(this._fitBest_Click); // @@ -452,7 +456,7 @@ private void InitializeComponent() this._rotateLeft.Image = ((System.Drawing.Image)(resources.GetObject("_rotateLeft.Image"))); this._rotateLeft.ImageTransparentColor = System.Drawing.Color.Magenta; this._rotateLeft.Name = "_rotateLeft"; - this._rotateLeft.Size = new System.Drawing.Size(68, 22); + this._rotateLeft.Size = new System.Drawing.Size(67, 22); this._rotateLeft.Text = "Rotate Left"; this._rotateLeft.Click += new System.EventHandler(this._rotateLeft_Click); // @@ -462,7 +466,7 @@ private void InitializeComponent() this._rotateRight.Image = ((System.Drawing.Image)(resources.GetObject("_rotateRight.Image"))); this._rotateRight.ImageTransparentColor = System.Drawing.Color.Magenta; this._rotateRight.Name = "_rotateRight"; - this._rotateRight.Size = new System.Drawing.Size(76, 22); + this._rotateRight.Size = new System.Drawing.Size(74, 22); this._rotateRight.Text = "Rotate Right"; this._rotateRight.Click += new System.EventHandler(this._rotateRight_Click); // @@ -478,7 +482,7 @@ private void InitializeComponent() this._showToolbar.Image = ((System.Drawing.Image)(resources.GetObject("_showToolbar.Image"))); this._showToolbar.ImageTransparentColor = System.Drawing.Color.Magenta; this._showToolbar.Name = "_showToolbar"; - this._showToolbar.Size = new System.Drawing.Size(83, 22); + this._showToolbar.Size = new System.Drawing.Size(78, 22); this._showToolbar.Text = "Show Toolbar"; this._showToolbar.Click += new System.EventHandler(this._hideToolbar_Click); // @@ -489,7 +493,7 @@ private void InitializeComponent() this._showBookmarks.Image = ((System.Drawing.Image)(resources.GetObject("_showBookmarks.Image"))); this._showBookmarks.ImageTransparentColor = System.Drawing.Color.Magenta; this._showBookmarks.Name = "_showBookmarks"; - this._showBookmarks.Size = new System.Drawing.Size(102, 22); + this._showBookmarks.Size = new System.Drawing.Size(97, 22); this._showBookmarks.Text = "Show Bookmarks"; this._showBookmarks.Click += new System.EventHandler(this._hideBookmarks_Click); // @@ -499,7 +503,7 @@ private void InitializeComponent() this._getTextFromPage.Image = ((System.Drawing.Image)(resources.GetObject("_getTextFromPage.Image"))); this._getTextFromPage.ImageTransparentColor = System.Drawing.Color.Magenta; this._getTextFromPage.Name = "_getTextFromPage"; - this._getTextFromPage.Size = new System.Drawing.Size(53, 22); + this._getTextFromPage.Size = new System.Drawing.Size(54, 22); this._getTextFromPage.Text = "Get Text"; this._getTextFromPage.ToolTipText = "Get Text From Current Page"; this._getTextFromPage.Click += new System.EventHandler(this._getTextFromPage_Click); @@ -511,7 +515,7 @@ private void InitializeComponent() this._pageToolStripLabel, this.toolStripStatusLabel2, this._coordinatesToolStripLabel}); - this.statusStrip1.Location = new System.Drawing.Point(0, 573); + this.statusStrip1.Location = new System.Drawing.Point(0, 527); this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Size = new System.Drawing.Size(1128, 22); this.statusStrip1.TabIndex = 3; @@ -520,25 +524,25 @@ private void InitializeComponent() // toolStripStatusLabel1 // this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; - this.toolStripStatusLabel1.Size = new System.Drawing.Size(36, 17); + this.toolStripStatusLabel1.Size = new System.Drawing.Size(32, 17); this.toolStripStatusLabel1.Text = "Page:"; // // _pageToolStripLabel // this._pageToolStripLabel.Name = "_pageToolStripLabel"; - this._pageToolStripLabel.Size = new System.Drawing.Size(41, 17); + this._pageToolStripLabel.Size = new System.Drawing.Size(37, 17); this._pageToolStripLabel.Text = "(page)"; // // toolStripStatusLabel2 // this.toolStripStatusLabel2.Name = "toolStripStatusLabel2"; - this.toolStripStatusLabel2.Size = new System.Drawing.Size(74, 17); + this.toolStripStatusLabel2.Size = new System.Drawing.Size(68, 17); this.toolStripStatusLabel2.Text = "Coordinates:"; // // _coordinatesToolStripLabel // this._coordinatesToolStripLabel.Name = "_coordinatesToolStripLabel"; - this._coordinatesToolStripLabel.Size = new System.Drawing.Size(77, 17); + this._coordinatesToolStripLabel.Size = new System.Drawing.Size(72, 17); this._coordinatesToolStripLabel.Text = "(coordinates)"; // // pdfViewerContextMenu @@ -547,20 +551,20 @@ private void InitializeComponent() this.copyToolStripMenuItem, this.selectAllToolStripMenuItem}); this.pdfViewerContextMenu.Name = "pdfViewerContextMenu"; - this.pdfViewerContextMenu.Size = new System.Drawing.Size(123, 48); + this.pdfViewerContextMenu.Size = new System.Drawing.Size(121, 48); this.pdfViewerContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.pdfViewerContextMenu_Opening); // // copyToolStripMenuItem // this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; - this.copyToolStripMenuItem.Size = new System.Drawing.Size(122, 22); + this.copyToolStripMenuItem.Size = new System.Drawing.Size(120, 22); this.copyToolStripMenuItem.Text = "&Copy"; this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click); // // selectAllToolStripMenuItem // this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem"; - this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(122, 22); + this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(120, 22); this.selectAllToolStripMenuItem.Text = "Select &All"; this.selectAllToolStripMenuItem.Click += new System.EventHandler(this.selectAllToolStripMenuItem_Click); // @@ -569,14 +573,30 @@ private void InitializeComponent() this.pdfViewer1.Dock = System.Windows.Forms.DockStyle.Fill; this.pdfViewer1.Location = new System.Drawing.Point(0, 49); this.pdfViewer1.Name = "pdfViewer1"; - this.pdfViewer1.Size = new System.Drawing.Size(1128, 524); + this.pdfViewer1.Size = new System.Drawing.Size(1128, 478); this.pdfViewer1.TabIndex = 0; // + // toolStripSeparator4 + // + this.toolStripSeparator4.Name = "toolStripSeparator4"; + this.toolStripSeparator4.Size = new System.Drawing.Size(6, 25); + // + // _textMode + // + this._textMode.CheckOnClick = true; + this._textMode.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this._textMode.Image = ((System.Drawing.Image)(resources.GetObject("_textMode.Image"))); + this._textMode.ImageTransparentColor = System.Drawing.Color.Magenta; + this._textMode.Name = "_textMode"; + this._textMode.Size = new System.Drawing.Size(67, 22); + this._textMode.Text = "Text Mode"; + this._textMode.Click += new System.EventHandler(this._textMode_Click); + // // MainForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1128, 595); + this.ClientSize = new System.Drawing.Size(1128, 549); this.Controls.Add(this.pdfViewer1); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.toolStrip1); @@ -657,6 +677,8 @@ private void InitializeComponent() private System.Windows.Forms.ContextMenuStrip pdfViewerContextMenu; private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem; + private System.Windows.Forms.ToolStripButton _textMode; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; } } diff --git a/PdfiumViewer.Demo/MainForm.cs b/PdfiumViewer.Demo/MainForm.cs index 87dd7b70..c0a39649 100644 --- a/PdfiumViewer.Demo/MainForm.cs +++ b/PdfiumViewer.Demo/MainForm.cs @@ -280,15 +280,9 @@ private void _hideBookmarks_Click(object sender, EventArgs e) private void deleteCurrentPageToolStripMenuItem_Click(object sender, EventArgs e) { - // PdfRenderer does not support changes to the loaded document, - // so we fake it by reloading the document into the renderer. - int page = pdfViewer1.Renderer.Page; - var document = pdfViewer1.Document; - pdfViewer1.Document = null; - document.DeletePage(page); - pdfViewer1.Document = document; - pdfViewer1.Renderer.Page = page; + pdfViewer1.Document.DeletePage(page); + pdfViewer1.Renderer.ReloadDocument(); } private void rotate0ToolStripMenuItem_Click(object sender, EventArgs e) @@ -313,15 +307,9 @@ private void rotate270ToolStripMenuItem_Click(object sender, EventArgs e) private void Rotate(PdfRotation rotate) { - // PdfRenderer does not support changes to the loaded document, - // so we fake it by reloading the document into the renderer. - int page = pdfViewer1.Renderer.Page; - var document = pdfViewer1.Document; - pdfViewer1.Document = null; - document.RotatePage(page, rotate); - pdfViewer1.Document = document; - pdfViewer1.Renderer.Page = page; + pdfViewer1.Document.RotatePage(page, rotate); + pdfViewer1.Renderer.ReloadDocument(); } private void showRangeOfPagesToolStripMenuItem_Click(object sender, EventArgs e) @@ -395,5 +383,10 @@ private void pdfViewerContextMenu_Opening(object sender, CancelEventArgs e) { copyToolStripMenuItem.Enabled = pdfViewer1.Renderer.IsTextSelected; } + + private void _textMode_Click(object sender, EventArgs e) + { + pdfViewer1.Renderer.CursorMode = (pdfViewer1.Renderer.CursorMode == PdfCursorMode.Pan) ? PdfCursorMode.TextSelection : PdfCursorMode.Pan; + } } } diff --git a/PdfiumViewer.Demo/MainForm.resx b/PdfiumViewer.Demo/MainForm.resx index c32d9b38..35df8487 100644 --- a/PdfiumViewer.Demo/MainForm.resx +++ b/PdfiumViewer.Demo/MainForm.resx @@ -257,6 +257,21 @@ mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== diff --git a/PdfiumViewer.Demo/PdfRangeDocument.cs b/PdfiumViewer.Demo/PdfRangeDocument.cs index 3dee0e6f..1d0c43a0 100644 --- a/PdfiumViewer.Demo/PdfRangeDocument.cs +++ b/PdfiumViewer.Demo/PdfRangeDocument.cs @@ -303,11 +303,6 @@ public int CountCharacters(int page) return _document.CountCharacters(page); } - public List GetTextRectangles(int page, int startIndex, int count) - { - return _document.GetTextRectangles(page, startIndex, count); - } - private int TranslatePage(int page) { if (page < 0 || page >= PageCount) diff --git a/PdfiumViewer.Demo/PdfiumViewer.Demo.csproj b/PdfiumViewer.Demo/PdfiumViewer.Demo.csproj index 54f680ee..443da779 100644 --- a/PdfiumViewer.Demo/PdfiumViewer.Demo.csproj +++ b/PdfiumViewer.Demo/PdfiumViewer.Demo.csproj @@ -1,7 +1,7 @@  - - + + Debug x86 @@ -160,8 +160,8 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + +