Skip to content

Unable to load PDF after Signing  #3

@VijayK1990

Description

@VijayK1990

public Signer(string temporaryFolder, string javaPath, string SignerJarPath)
{
_tempFolder = temporaryFolder;
_javaPath = javaPath;
//_jsignpdfLocation = """ + Directory.GetCurrentDirectory() + "/assets/JSignPdf-1.6.4/JSignPdf.jar" + """;
_jsignpdfLocation = SignerJarPath;
}

SignerJarPath is our custom variable defined to suit our needs

string VirtualFolderPath = Server.MapPath("SomePath");
string CertificatePath = Server.MapPath("SomePath");

if (!Directory.Exists(VirtualFolderPath))
{
Directory.CreateDirectory(VirtualFolderPath);
}
This is how we call your function, AssetFilePaths is a static class having path for Java Compiler and JSignPDFJar file
Signer _sign = new Signer(VirtualFolderPath, AssetFilePaths.Java.JavaEngine, Server.MapPath(AssetFilePaths.AssetFiles.JSignPDFJar));
string _BaseFileAsX64 = Convert.ToBase64String(System.IO.File.ReadAllBytes(fileName));
string _SignedFileAsX64 = _sign.Sign(_BaseFileAsX64, CertificatePath, "12345678", "");

return Encoding.UTF8.GetBytes(_SignedFileAsX64);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions