Skip to content

Commit

Permalink
Version 3.13.0
Browse files Browse the repository at this point in the history
## Version 3.13.0 - March 16, 2018

- **Fixed:** Some issues with the search features that were added in
3.12.0:

- "Any words" search did not find results when keywords had hyphens
in-between.

- "Any words" search would hang (infinite loop) when one of the words
was a single hyphen.

- A subsequent search in the viewer (without reloading the document)
with new criteria where
no results are returned did not clear any of the highlights (yellow and
orange both) from
the previous successful search.

- **Improved:** Updated DocumentViewer icons with better ones and
hopefully fixed "gibberish font icon" issue
which was supposed to be fixed back in 3.11.0 but was still being
observed though not frequently as before.

- **Fixed:** When using DocumentSource with a byte array or stream, if
the input document was PDF,
Download action would fail with error "downloadError". This was because
the original copy in DocumentCache was
being replaced with the generated one.

- **Added:** DocumentViewer.DocumentHandlerParameters property for a
better solution to pass multiple parameters
to your IDocumentHandler implementation. Added DocumentHandlerParameters
parameter to the methods of
IDocumentHandler interface so you should update GetInfo and OpenRead
signatures in your implementation.
Refer to DocumentViewer.DocumentHandlerParameters property in the
updated docs for more details.
  • Loading branch information
GleamTech committed Mar 17, 2018
1 parent 218ae2c commit d94bf98
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 33 deletions.
30 changes: 24 additions & 6 deletions Examples/Mvc.CS/Controllers/DocumentViewerController.Stream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,22 @@ public ActionResult Stream()
// So it can be any string value that your IDocumentHandler implementation understands.
documentViewer.Document = "~/App_Data/ExampleFiles/Default.docx";


//---------------------------------------------
// Here is an example (commented out) for loading a document from database.
// See below for DbDocumentHandler class which implements IDocumentHandler interface.
// This loads the document with passed ID (176) from the database
/*
documentViewer.DocumentHandlerType = typeof(DbDocumentHandler);
documentViewer.Document = "176"; // a file path or identifier
// When you need to pass custom parameters along with the input file to your handler implementation,
// use documentViewer.DocumentHandlerParameters property to set your parameters.
// These will be passed to the methods of your handler implementation:
documentViewer.DocumentHandlerParameters.Set("connectionString", "SOME CONNECTION STRING");
*/
//---------------------------------------------


//---------------------------------------------
//When you don't have a file on disk and implementing IDocumentHandler interface is not convenient,
Expand All @@ -65,6 +73,8 @@ public ActionResult Stream()
byteArray
);
*/
//---------------------------------------------


return View(documentViewer);
}
Expand All @@ -84,7 +94,7 @@ public class CustomDocumentHandler : IDocumentHandler
// the input file that was requested to be loaded in DocumentViewer
//
// Return a DocumentInfo instance initialized with required information from this method.
public DocumentInfo GetInfo(string inputFile)
public DocumentInfo GetInfo(string inputFile, DocumentHandlerParameters handlerParameters)
{
var physicalPath = HttpContext.Current.Server.MapPath(inputFile);
var fileInfo = new FileInfo(physicalPath);
Expand Down Expand Up @@ -123,7 +133,7 @@ public DocumentInfo GetInfo(string inputFile)
// for you to locate and open a corresponding stream.
//
// Return a StreamResult instance initialized with a readable System.IO.Stream object.
public StreamResult OpenRead(string inputFile, InputOptions inputOptions)
public StreamResult OpenRead(string inputFile, InputOptions inputOptions, DocumentHandlerParameters handlerParameters)
{
var physicalPath = HttpContext.Current.Server.MapPath(inputFile);
var stream = File.OpenRead(physicalPath);
Expand All @@ -148,12 +158,16 @@ public class DbDocumentHandler : IDocumentHandler
// the input file that was requested to be loaded in DocumentViewer
//
// Return a DocumentInfo instance initialized with required information from this method.
public DocumentInfo GetInfo(string inputFile)
public DocumentInfo GetInfo(string inputFile, DocumentHandlerParameters handlerParameters)
{
var fileId = inputFile;
string fileName;

using (var connection = new SqlConnection("CONNECTION STRING"))
// Get your parameters that were set in documentViewer.DocumentHandlerParameters property
// The type for the generic Get<T> method should be the same as the set value's type.
var connectionString = handlerParameters.Get<string>("connectionString");

using (var connection = new SqlConnection(connectionString))
{
connection.Open();

Expand Down Expand Up @@ -203,12 +217,16 @@ public DocumentInfo GetInfo(string inputFile)
// for you to locate and open a corresponding stream.
//
// Return a StreamResult instance initialized with a readable System.IO.Stream object.
public StreamResult OpenRead(string inputFile, InputOptions inputOptions)
public StreamResult OpenRead(string inputFile, InputOptions inputOptions, DocumentHandlerParameters handlerParameters)
{
var fileId = inputFile;
byte[] fileBytes;

using (var connection = new SqlConnection("CONNECTION STRING"))
// Get your parameters that were set in documentViewer.DocumentHandlerParameters property
// The type for the generic Get<T> method should be the same as the set value's type.
var connectionString = handlerParameters.Get<string>("connectionString");

using (var connection = new SqlConnection(connectionString))
{
connection.Open();

Expand Down
2 changes: 1 addition & 1 deletion Examples/Mvc.CS/Mvc.CS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<HintPath>..\packages\GleamTech.Core.2.3.3\lib\net40\GleamTech.Core.dll</HintPath>
</Reference>
<Reference Include="GleamTech.DocumentUltimate">
<HintPath>..\packages\DocumentUltimate.3.12.0\lib\net40\GleamTech.DocumentUltimate.dll</HintPath>
<HintPath>..\packages\DocumentUltimate.3.13.0\lib\net40\GleamTech.DocumentUltimate.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp"/>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand Down
2 changes: 1 addition & 1 deletion Examples/Mvc.CS/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<package id="Microsoft.AspNet.WebPages" version="2.0.30506.0" targetFramework="net40"/>
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net40"/>
<package id="GleamTech.Core" version="2.3.3" targetFramework="net40"/>
<package id="DocumentUltimate" version="3.12.0" targetFramework="net40"/>
<package id="DocumentUltimate" version="3.13.0" targetFramework="net40"/>
</packages>
30 changes: 23 additions & 7 deletions Examples/Mvc.VB/Controllers/DocumentViewerController.Stream.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,20 @@ Namespace Controllers
' So it can be any string value that your IDocumentHandler implementation understands.
documentViewer.Document = "~/App_Data/ExampleFiles/Default.docx"


' ---------------------------------------------
' Here is an example (commented out) for loading a document from database.
' See below for DbDocumentHandler class which implements IDocumentHandler interface.
' This loads the document with passed ID (176) from the database

'documentViewer.DocumentHandlerType = typeof(DbDocumentHandler);
'documentViewer.Document = "176"; ' a file path or identifier
' When you need to pass custom parameters along with the input file to your handler implementation,
' use documentViewer.DocumentHandlerParameters property to set your parameters.
' These will be passed to the methods of your handler implementation:
'documentViewer.DocumentHandlerParameters.Set("connectionString", "SOME CONNECTION STRING")
' ---------------------------------------------


' ---------------------------------------------
' When you don't have a file on disk and implementing IDocumentHandler interface is not convenient,
Expand All @@ -57,7 +64,7 @@ Namespace Controllers
' New DocumentInfo(uniqueId, fileName),
' byteArray
')

' ---------------------------------------------

Return View(documentViewer)
End Function
Expand All @@ -80,7 +87,7 @@ Namespace Controllers
' the input file that was requested to be loaded in DocumentViewer
'
' Return a DocumentInfo instance initialized with required information from this method.
Public Function GetInfo(inputFile As String) As DocumentInfo Implements IDocumentHandler.GetInfo
Public Function GetInfo(inputFile As String, handlerParameters As DocumentHandlerParameters) As DocumentInfo Implements IDocumentHandler.GetInfo

Dim physicalPath = HttpContext.Current.Server.MapPath(inputFile)
Dim fileInfo As New FileInfo(physicalPath)
Expand Down Expand Up @@ -120,7 +127,7 @@ Namespace Controllers
' for you to locate and open a corresponding stream.
'
' Return a StreamResult instance initialized with a readable System.IO.Stream object.
Public Function OpenRead(inputFile As String, inputOptions As InputOptions) As StreamResult Implements IDocumentHandler.OpenRead
Public Function OpenRead(inputFile As String, inputOptions As InputOptions, handlerParameters As DocumentHandlerParameters) As StreamResult Implements IDocumentHandler.OpenRead

Dim physicalPath = HttpContext.Current.Server.MapPath(inputFile)
Dim stream = File.OpenRead(physicalPath)
Expand Down Expand Up @@ -148,11 +155,15 @@ Namespace Controllers
' the input file that was requested to be loaded in DocumentViewer
'
' Return a DocumentInfo instance initialized with required information from this method.
Public Function GetInfo(inputFile As String) As DocumentInfo Implements IDocumentHandler.GetInfo
Public Function GetInfo(inputFile As String, handlerParameters As DocumentHandlerParameters) As DocumentInfo Implements IDocumentHandler.GetInfo
Dim fileId = inputFile
Dim fileName As String

Using connection As New SqlConnection("CONNECTION STRING")
' Get your parameters that were set in documentViewer.DocumentHandlerParameters property
' The type for the generic Get<T> method should be the same as the set value's type.
Dim connectionString = handlerParameters.Get(Of String)("connectionString")

Using connection As New SqlConnection(connectionString)
connection.Open()

Dim sql = "SELECT FileName FROM FileTable WHERE FileId=" + fileId
Expand Down Expand Up @@ -199,11 +210,15 @@ Namespace Controllers
' for you to locate and open a corresponding stream.
'
' Return a StreamResult instance initialized with a readable System.IO.Stream object.
Public Function OpenRead(inputFile As String, inputOptions As InputOptions) As StreamResult Implements IDocumentHandler.OpenRead
Public Function OpenRead(inputFile As String, inputOptions As InputOptions, handlerParameters As DocumentHandlerParameters) As StreamResult Implements IDocumentHandler.OpenRead
Dim fileId = inputFile
Dim fileBytes As Byte()

Using connection As New SqlConnection("CONNECTION STRING")
' Get your parameters that were set in documentViewer.DocumentHandlerParameters property
' The type for the generic Get<T> method should be the same as the set value's type.
Dim connectionString = handlerParameters.Get(Of String)("connectionString")

Using connection As New SqlConnection(connectionString)
connection.Open()

Dim sql = "SELECT FileBytes FROM FileTable WHERE FileId=" + fileId
Expand All @@ -225,4 +240,5 @@ Namespace Controllers
Return New StreamResult(stream)
End Function
End Class

End Namespace
2 changes: 1 addition & 1 deletion Examples/Mvc.VB/Mvc.VB.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<HintPath>..\packages\GleamTech.Core.2.3.3\lib\net40\GleamTech.Core.dll</HintPath>
</Reference>
<Reference Include="GleamTech.DocumentUltimate">
<HintPath>..\packages\DocumentUltimate.3.12.0\lib\net40\GleamTech.DocumentUltimate.dll</HintPath>
<HintPath>..\packages\DocumentUltimate.3.13.0\lib\net40\GleamTech.DocumentUltimate.dll</HintPath>
</Reference>
<Reference Include="System.Data"/>
<Reference Include="System.Drawing"/>
Expand Down
2 changes: 1 addition & 1 deletion Examples/Mvc.VB/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<package id="Microsoft.AspNet.WebPages" version="2.0.30506.0" targetFramework="net40"/>
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net40"/>
<package id="GleamTech.Core" version="2.3.3" targetFramework="net40"/>
<package id="DocumentUltimate" version="3.12.0" targetFramework="net40"/>
<package id="DocumentUltimate" version="3.13.0" targetFramework="net40"/>
</packages>
29 changes: 23 additions & 6 deletions Examples/WebForms.CS/DocumentViewer/Stream.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,22 @@ protected void Page_Load(object sender, EventArgs e)
// So it can be any string value that your IDocumentHandler implementation understands.
documentViewer.Document = "~/App_Data/ExampleFiles/Default.docx";


//---------------------------------------------
// Here is an example (commented out) for loading a document from database.
// See below for DbDocumentHandler class which implements IDocumentHandler interface.
// This loads the document with passed ID (176) from the database
/*
documentViewer.DocumentHandlerType = typeof(DbDocumentHandler);
documentViewer.Document = "176"; // a file path or identifier
// When you need to pass custom parameters along with the input file to your handler implementation,
// use documentViewer.DocumentHandlerParameters property to set your parameters.
// These will be passed to the methods of your handler implementation:
documentViewer.DocumentHandlerParameters.Set("connectionString", "SOME CONNECTION STRING");
*/
//---------------------------------------------


//---------------------------------------------
//When you don't have a file on disk and implementing IDocumentHandler interface is not convenient,
Expand All @@ -57,6 +65,7 @@ protected void Page_Load(object sender, EventArgs e)
byteArray
);
*/
//---------------------------------------------
}
}

Expand All @@ -74,7 +83,7 @@ public class CustomDocumentHandler : IDocumentHandler
// the input file that was requested to be loaded in DocumentViewer
//
// Return a DocumentInfo instance initialized with required information from this method.
public DocumentInfo GetInfo(string inputFile)
public DocumentInfo GetInfo(string inputFile, DocumentHandlerParameters handlerParameters)
{
var physicalPath = HttpContext.Current.Server.MapPath(inputFile);
var fileInfo = new FileInfo(physicalPath);
Expand Down Expand Up @@ -113,7 +122,7 @@ public DocumentInfo GetInfo(string inputFile)
// for you to locate and open a corresponding stream.
//
// Return a StreamResult instance initialized with a readable System.IO.Stream object.
public StreamResult OpenRead(string inputFile, InputOptions inputOptions)
public StreamResult OpenRead(string inputFile, InputOptions inputOptions, DocumentHandlerParameters handlerParameters)
{
var physicalPath = HttpContext.Current.Server.MapPath(inputFile);
var stream = File.OpenRead(physicalPath);
Expand All @@ -138,12 +147,16 @@ public class DbDocumentHandler : IDocumentHandler
// the input file that was requested to be loaded in DocumentViewer
//
// Return a DocumentInfo instance initialized with required information from this method.
public DocumentInfo GetInfo(string inputFile)
public DocumentInfo GetInfo(string inputFile, DocumentHandlerParameters handlerParameters)
{
var fileId = inputFile;
string fileName;

using (var connection = new SqlConnection("CONNECTION STRING"))
// Get your parameters that were set in documentViewer.DocumentHandlerParameters property
// The type for the generic Get<T> method should be the same as the set value's type.
var connectionString = handlerParameters.Get<string>("connectionString");

using (var connection = new SqlConnection(connectionString))
{
connection.Open();

Expand Down Expand Up @@ -193,12 +206,16 @@ public DocumentInfo GetInfo(string inputFile)
// for you to locate and open a corresponding stream.
//
// Return a StreamResult instance initialized with a readable System.IO.Stream object.
public StreamResult OpenRead(string inputFile, InputOptions inputOptions)
public StreamResult OpenRead(string inputFile, InputOptions inputOptions, DocumentHandlerParameters handlerParameters)
{
var fileId = inputFile;
byte[] fileBytes;

using (var connection = new SqlConnection("CONNECTION STRING"))
// Get your parameters that were set in documentViewer.DocumentHandlerParameters property
// The type for the generic Get<T> method should be the same as the set value's type.
var connectionString = handlerParameters.Get<string>("connectionString");

using (var connection = new SqlConnection(connectionString))
{
connection.Open();

Expand Down
2 changes: 1 addition & 1 deletion Examples/WebForms.CS/WebForms.CS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<HintPath>..\packages\GleamTech.Core.2.3.3\lib\net40\GleamTech.Core.dll</HintPath>
</Reference>
<Reference Include="GleamTech.DocumentUltimate">
<HintPath>..\packages\DocumentUltimate.3.12.0\lib\net40\GleamTech.DocumentUltimate.dll</HintPath>
<HintPath>..\packages\DocumentUltimate.3.13.0\lib\net40\GleamTech.DocumentUltimate.dll</HintPath>
</Reference>
<Reference Include="System"/>
<Reference Include="System.Core"/>
Expand Down
2 changes: 1 addition & 1 deletion Examples/WebForms.CS/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="GleamTech.Core" version="2.3.3" targetFramework="net40"/>
<package id="DocumentUltimate" version="3.12.0" targetFramework="net40"/>
<package id="DocumentUltimate" version="3.13.0" targetFramework="net40"/>
</packages>
Loading

0 comments on commit d94bf98

Please sign in to comment.