Przeglądaj źródła

PDFTool(Android) - 1.替换数字签名form表单填写外观方式 2.修复CPDFDigitalSigConfig setImage显示异常问题

liuxiaolong 1 rok temu
rodzic
commit
70474da9f1

+ 4 - 1
Annotations/proguard-rules.pro

@@ -18,4 +18,7 @@
 
 # If you keep the line number information, uncomment this to
 # hide the original source file name.
-#-renamesourcefileattribute SourceFile
+#-renamesourcefileattribute SourceFile
+-keep class com.compdfkit.ui.** {*;}
+-keep class com.compdfkit.core.** {*;}
+-keep class com.compdfkit.tools.** {*;}

BIN
ComPDFKit_Repo/compdfkit-ui/ComPDFKit-UI.aar


BIN
ComPDFKit_Repo/compdfkit/ComPDFKit.aar


+ 1 - 4
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/signature/pdfproperties/pdfsign/CDigitalSignStylePreviewView.java

@@ -169,10 +169,7 @@ public class CDigitalSignStylePreviewView extends FrameLayout {
         digitalSigConfig.setContent(getContent());
         digitalSigConfig.setDrawOnlyContent(TextUtils.isEmpty(signImagePath));
         if (!TextUtils.isEmpty(signImagePath)) {
-            BitmapFactory.Options op = new BitmapFactory.Options();
-            op.inJustDecodeBounds = false;
-            op.inPreferredConfig = Bitmap.Config.ARGB_8888;
-            Bitmap bitmap = BitmapFactory.decodeFile(signImagePath, op);
+            Bitmap bitmap = BitmapFactory.decodeFile(signImagePath);
             digitalSigConfig.setImage(bitmap);
         }
         if (showLogo) {

+ 2 - 1
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/signature/pdfproperties/pdfsign/CDigitalSignatureWidgetImpl.java

@@ -57,7 +57,7 @@ public class CDigitalSignatureWidgetImpl extends CPDFSignatureWidgetImpl {
             CPDFCertInfo certInfo = CertificateDigitalDatas.getCertInfo(certFilePath, certPassword);
             String dn = CertificateDigitalDatas.getOwnerContent(certInfo.getSubject(), ",");
             CDigitalSignStylePreviewDialog previewDialog = CDigitalSignStylePreviewDialog.newInstance(signImagePath, certInfo.getSubject().getCommonName(), dn);
-            previewDialog.setResultDigitalSignListener((config, location, reason) -> {
+            previewDialog.setResultDigitalSignListener((imagePath, config, location, reason) -> {
                 try {
                     Context context = readerView.getContext();
                     CFileDirectoryDialog directoryDialog = CFileDirectoryDialog.newInstance(
@@ -93,6 +93,7 @@ public class CDigitalSignatureWidgetImpl extends CPDFSignatureWidgetImpl {
                               String certFilePath,
                               String certPassword,
                               String saveDir) {
+
         String uuid = UUID.randomUUID().toString().substring(0, 4);
         String fileName = readerView.getPDFDocument().getFileName();
         File saveFile = new File(saveDir + File.separator + fileName + "_" + uuid, readerView.getPDFDocument().getFileName());

+ 4 - 2
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/signature/preview/CDigitalSignStylePreviewDialog.java

@@ -282,8 +282,10 @@ public class CDigitalSignStylePreviewDialog extends CBasicBottomSheetDialogFragm
                 slMain.setVisibility(View.VISIBLE);
                 return;
             }
+            Bitmap bitmap = previewView.getBitmap();
+            String imagePath = CSignatureDatas.saveSignatureBitmap(getContext(), bitmap);
             if (resultDigitalSignListener != null) {
-                resultDigitalSignListener.sign(previewView.getConfig(), previewView.getLocation(), previewView.getReason());
+                resultDigitalSignListener.sign(imagePath, previewView.getConfig(), previewView.getLocation(), previewView.getReason());
             }
             dismiss();
         }
@@ -294,6 +296,6 @@ public class CDigitalSignStylePreviewDialog extends CBasicBottomSheetDialogFragm
     }
 
     public interface COnResultDigitalSignListener{
-        void sign(CPDFDigitalSigConfig config, String location, String reason);
+        void sign(String signPreviewImagePath, CPDFDigitalSigConfig config, String location, String reason);
     }
 }

+ 4 - 1
ContentEditor/proguard-rules.pro

@@ -18,4 +18,7 @@
 
 # If you keep the line number information, uncomment this to
 # hide the original source file name.
-#-renamesourcefileattribute SourceFile
+#-renamesourcefileattribute SourceFile
+-keep class com.compdfkit.ui.** {*;}
+-keep class com.compdfkit.core.** {*;}
+-keep class com.compdfkit.tools.** {*;}

+ 4 - 1
DigitalSignature/proguard-rules.pro

@@ -18,4 +18,7 @@
 
 # If you keep the line number information, uncomment this to
 # hide the original source file name.
-#-renamesourcefileattribute SourceFile
+#-renamesourcefileattribute SourceFile
+-keep class com.compdfkit.ui.** {*;}
+-keep class com.compdfkit.core.** {*;}
+-keep class com.compdfkit.tools.** {*;}

+ 4 - 1
DocsEditor/proguard-rules.pro

@@ -18,4 +18,7 @@
 
 # If you keep the line number information, uncomment this to
 # hide the original source file name.
-#-renamesourcefileattribute SourceFile
+#-renamesourcefileattribute SourceFile
+-keep class com.compdfkit.ui.** {*;}
+-keep class com.compdfkit.core.** {*;}
+-keep class com.compdfkit.tools.** {*;}

+ 4 - 1
Forms/proguard-rules.pro

@@ -18,4 +18,7 @@
 
 # If you keep the line number information, uncomment this to
 # hide the original source file name.
-#-renamesourcefileattribute SourceFile
+#-renamesourcefileattribute SourceFile
+-keep class com.compdfkit.ui.** {*;}
+-keep class com.compdfkit.core.** {*;}
+-keep class com.compdfkit.tools.** {*;}

+ 4 - 1
PDFViewer/proguard-rules.pro

@@ -18,4 +18,7 @@
 
 # If you keep the line number information, uncomment this to
 # hide the original source file name.
-#-renamesourcefileattribute SourceFile
+#-renamesourcefileattribute SourceFile
+-keep class com.compdfkit.ui.** {*;}
+-keep class com.compdfkit.core.** {*;}
+-keep class com.compdfkit.tools.** {*;}

+ 15 - 13
Samples/src/main/java/com/compdfkit/samples/samples/DigitalSignaturesTest.java

@@ -77,19 +77,20 @@ public class DigitalSignaturesTest extends PDFSamples {
     }
 
     /**
-     * Create pfx format certificate for digital signature use
-     *
-     * Password: ComPDFKit
-     * C=SG: This represents the country code "SG," which typically stands for Singapore.
-     * O=ComPDFKit: This is the Organization (O) field, indicating the name of the organization or entity,
-     *      in this case, "ComPDFKit."
-     * D=R&D Department: This is the Department (D) field,
+     * <b>Create pfx format certificate for digital signature use</b> <br>
+     * <br><br>
+     * <b>Password:</b> ComPDFKit <br>
+     * <b>C=SG:</b> This represents the country code "SG," which typically stands for Singapore.<br><br>
+     * <b>O=ComPDFKit:</b> This is the Organization (O) field, indicating the name of the organization or entity,
+     *      in this case, "ComPDFKit." <br><br>
+     * <b>D=R&D Department:</b> This is the Department (D) field,
      *      indicating the specific department within the organization,
-     *      in this case, "R&D Department."
-     * CN=Alan: This is the Common Name (CN) field, which usually represents the name
-     *      of the individual or entity. In this case, it is "Alan."
-     *
-     *
+     *      in this case, "R&D Department."<br><br>
+     * <b>CN=Alan:</b> This is the Common Name (CN) field, which usually represents the name
+     *      of the individual or entity. In this case, it is "Alan."<br><br>
+     * <b>emailAddress=xxxx@example.com:</b> Email is xxxx@example.com <br><br>
+     * <b>CPDFSignature.CertUsage.PDFAll: </b>Used for both digital signing and data validation simultaneously.<br><br>
+     * <b>is_2048: </b> Enhanced security encryption.<br><br>
      */
     private void generateCertificate() {
         outputListener.println("generate certificate");
@@ -99,7 +100,7 @@ public class DigitalSignaturesTest extends PDFSamples {
         ownerInfo.setOrgnize("ComPDFKit");
         ownerInfo.setEmail("xxxx@example.com");
         ownerInfo.setCountry("SG");
-        CPDFSignature.CertUsage flag = CPDFSignature.CertUsage.PDFDigSig;
+        CPDFSignature.CertUsage flag = CPDFSignature.CertUsage.PDFAll;
         File certFile = new File(outputDir(), "certificate/Certificate.pfx");
         certFile.getParentFile().mkdirs();
 
@@ -112,6 +113,7 @@ public class DigitalSignaturesTest extends PDFSamples {
         printDividingLine();
     }
 
+
     private void createSignature() {
         outputListener.println("Create digital signature.");
 

+ 4 - 1
Viewer/proguard-rules.pro

@@ -18,4 +18,7 @@
 
 # If you keep the line number information, uncomment this to
 # hide the original source file name.
-#-renamesourcefileattribute SourceFile
+#-renamesourcefileattribute SourceFile
+-keep class com.compdfkit.ui.** {*;}
+-keep class com.compdfkit.core.** {*;}
+-keep class com.compdfkit.tools.** {*;}