🪡 PDF-Signer is a Digitally sign PDF documents using handwritten signature or specific image.
- Easy, flexible.
- Support add sign from gallery and handwrite
- Support multiple colors for handwrite
- Save signs on local storage
repositories {
maven { url 'https://jitpack.io' }
...
}
Add the dependency below to your module's build.gradle
file:
dependencies {
implementation "com.github.Al-khateebBahaa:PDF-Signer:1.0.0-alpha"
}
PDF-Signer supports both Kotlin and Java projects, so you can reference it by your language.
- Android API 23 or later
- At onCreate method, invoke SDK onCreate
SignBuilder.onCreate(activity: AppCompatActivity)
- Implement
SignerCallBack
interface,
class MainActivity : AppCompatActivity(), SignerCallback {
}
- Override SignerCallback callback methods:
override fun onSignResult(isSuccess: Boolean, resultFile: File?) {
// if signing success, isSuccess param will return true with signed file
}
override fun onSignFailed(error: String) {
//SDK will return any error here
}
- Register your Activity/Fragment callback and build SDK.
try {
val mSignManager = SignBuilder.setCallback(this).build()
} catch (e: PdfSignerInitialingException) {
e.printStackTrace()
}
- Now you can pass your file to SDK and start signing process by call:
mSignManager.startSigning(
inputFile: File?,
returnedFileName: String? = null, // optional returned file name
activity: AppCompatActivity
)
You will get result either on onSignResult or onSignFailed
- FILE_NOT_FOUND : Returned When passing a nullable or invalid file
- ON_CREATE_ERROR : Returned When forget to invoke SDK onCreate method
- DELEGATE_NOT_FOUND : Returned When forget to attach SignerCallback
- INVALID_FILE_TYPE : File type is not a valid pdf file
- FAILED_TO_SIGN : Failed to add sign
- You can open Signatures library "Which contain your Signatures" by:
mSignManager.openSigningLibrary(context:Context)
-
If you want to pick a Signatures image from gallery, you should know that supported types are just jpeg or png.
-
This library still on testing phase, so you may find some issues
-
Files not saved, but Signatures saved at Signatures library
If you had any problem with setup, check the demo on main branch
Copyright 2023 Al-khateebBahaa (Bahaa Alkhateeb)
Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.