Here is the view and the controller, nothing special happening really. But it is very odd behaviour, it works perfectly if I don't hide the CSS element containing the view, otherwise it fails to load and If I manually edit the source to un-hide the CSS element I can see the signing screen error.
View:
@using Groupdocs.Web.UI.Signature
@model HowNow.Signature.Models.SignModel
@{
ViewBag.Title = "Index";
}
@section Head
{
@Html.CreateSignatureStylesLoadBlock()
}
@(Html.Signature("#groupdocs-signature")
.DocumentGuid(Model.Document.Guid)
.RecipientGuid(Model.Document.SignatureDocumentRecipients.FirstOrDefault().Guid)
);
@Html.CreateSignatureScriptsLoadBlock()
Controller:
public class SignController : Controller
{
public readonly string tempDir = "~/tmp/";
public readonly string groupDocsDir = "~/app_data";
// GET: Sign
public async Task Index(string url, string finishedurl)
{
var client = new HttpClient();
var stream = await client.GetStreamAsync(url);
var uri = new Uri(url);
bool existsApp = System.IO.Directory.Exists(Server.MapPath(groupDocsDir));
if (!existsApp) System.IO.Directory.CreateDirectory(Server.MapPath(groupDocsDir));
bool existsTmp = System.IO.Directory.Exists(Server.MapPath(tempDir));
if (!existsTmp) System.IO.Directory.CreateDirectory(Server.MapPath(tempDir));
var filepath = Path.Combine(Server.MapPath(tempDir), uri.Segments[uri.Segments.Length - 1]);
using (var file = System.IO.File.Create(filepath))
{
stream.CopyTo(file);
}
var signedFilepath = Path.Combine(Server.MapPath(tempDir),
Path.GetFileNameWithoutExtension(filepath) + "_signed" + Path.GetExtension(filepath));
var document = FluentSignature.Document()
.FileName(Path.GetFileName(filepath))
.SignedFileName(Path.GetFileName(signedFilepath))
.AddRecipient(FluentSignature.Recipient()
.AddField(FluentSignature.Field()
.Name("Signature1")
.Mandatory(true)
.LockDuringSign(false)
.Type(SignatureFieldType.Signature)
.AddLocation(FluentSignature.Location()
.Page(1)
.LocationWidth(150)
.LocationHeight(50)
.LocationX((decimal) 0.400)
.LocationY((decimal) 0.300)
)
)
)
.Create();
var signModel = new SignModel()
{
Document = document,
UploadUrl = url,
};
return View(signModel);
}
}
Iframe Parent (embedded signing view):
Where ng-show="!documentLoading" sets the display of the element to none while it waits for load.
When the element display is set to none it errors with the following :
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in Groupdocs.Auxiliary
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in Groupdocs.Web.UI.Signature.dll