มีอะไรใหม่ใน GroupDocs.Signature for Python 26.1 (January 2026)
| ID | Category | Summary |
|---|---|---|
| SIGNATURENET‑5528 | ✨ Feature | รองรับลายเซ็นดิจิทัลแบบภาพและการตรวจสอบ (ฝังข้อมูลแบบ steganographic LSB สำหรับ PNG & JPG). |
| SIGNATURENET‑5445 | ✨ Feature | การเรนเดอร์แบบปรับได้สำหรับตัวอย่างลายเซ็น Barcode และ QR Code – ควบคุมความกว้าง/ความสูงอย่างชัดเจน. |
| SIGNATURENET‑5479 | ✨ Feature | รองรับการหมุนสำหรับภาพตัวอย่าง Barcode และ QR Code. |
| SIGNATURENET‑5478 | ✨ Feature | เพิ่มการจัดการรูปแบบไฟล์ APNG และ TGA สำหรับลายเซ็นที่ใช้ภาพ. |
| SIGNATURENET‑5500 | ⚡ Enhancement | ปรับปรุงการค้นหาและตรวจสอบลายเซ็นแบบ LINQ‑style (การกรองด้วย predicate). |
| SIGNATURENET‑5480 | ⚡ Enhancement | รองรับความโปร่งใสของพื้นหลังสำหรับตัวอย่าง Barcode/QR. |
| SIGNATURENET‑5477 | ⚡ Enhancement | รองรับการวางภาพทับบนลายเซ็นดิจิทัลพร้อมสีพื้นหลัง (ฟล็าก foreground‑image). |
| SIGNATURENET‑5422 | ⚡ Enhancement | ลบอัลกอริทึมการเข้ารหัสที่ไม่ปลอดภัย (RC2, DES, TripleDES และโหมด AES ที่อ่อนแอ). |
| SIGNATURENET‑5555 | 🐞 Bug Fix | แก้ข้อผิดพลาด GeneratePreview() ที่ทำให้เกิดข้อยกเว้น type‑initializer สำหรับไฟล์ DOC บน Linux. |
ต่อไปนี้เป็นการเดินชมเชิงเทคนิคสั้น ๆ ของการเปลี่ยนแปลงที่มีผลกระทบมากที่สุด
1. ลายเซ็นดิจิทัลแบบภาพ (steganography)
- ลายเซ็นจะถูกซ่อนในบิตที่มีความสำคัญต่ำที่สุดของพิกเซล PNG/JPG
- มีการป้องกันด้วยรหัสผ่าน, รองรับสตรีม, และทำงานกับภาพขนาดใดก็ได้ ≥ 8 × 8 px
ลงลายเซ็นบนภาพ
import groupdocs.signature as gs
import groupdocs.signature.options as gso
input_file = "image.png"
output_file = "signed_image.png"
password = "MySecurePassword123"
# Sign the image
with gs.Signature(input_file) as signature:
sign_options = gso.ImageDigitalSignOptions()
sign_options.password = password
sign_result = signature.sign(output_file, sign_options)
if sign_result.succeeded and len(sign_result.succeeded) > 0:
print("Image signed successfully!")
print(f"Signatures added: {len(sign_result.succeeded)}")
ตรวจสอบภาพที่ลงลายเซ็นแล้ว
import groupdocs.signature as gs
import groupdocs.signature.options as gso
signed_file = "signed_image.png"
password = "MySecurePassword123"
with gs.Signature(signed_file) as signature:
verify_options = gso.ImageDigitalVerifyOptions()
verify_options.password = password
verify_options.detection_threshold_percent = 75 # optional 0‑100%
verify_result = signature.verify(verify_options)
if verify_result.is_valid:
print("Digital signature is valid!")
print(f"Verified signatures: {len(verify_result.succeeded)}")
else:
print("Digital signature is invalid or not found.")
การตรวจสอบขั้นสูง (การสกัดข้อมูลเต็มรูปแบบ)
with gs.Signature("signed_image.png") as signature:
verify_options = gso.ImageDigitalVerifyOptions()
verify_options.password = "MySecurePassword123"
verify_options.use_full_data_extraction = True
verify_options.detection_threshold_percent = 85
verify_result = signature.verify(verify_options)
if verify_result.is_valid and verify_options.detected_probability is not None:
print(f"Signature detected with {verify_options.detected_probability}% probability")
2. การเรนเดอร์แบบปรับได้สำหรับตัวอย่าง Barcode & QR Code
นักพัฒนาสามารถระบุ width และ height ที่ต้องการสำหรับการสร้างภาพตัวอย่างได้อย่างแม่นยำ ทำให้ไม่ต้องพึ่งพาการปรับขนาดอัตโนมัติที่อาจไม่สอดคล้องกัน
import groupdocs.signature as gs
import groupdocs.signature.options as gso
import uuid
# QR code options
qr_sign_options = gso.QrCodeSignOptions("GROUP DOCS", gs.QrCodeTypes.QR)
qr_sign_options.width = 250
qr_sign_options.height = 270
qr_sign_options.fore_color = gs.Color.red
qr_sign_options.code_text_alignment = gs.CodeTextAlignment.BELOW
qr_sign_options.text = "GROUP DOCS"
# Preview generation
preview_options = gso.PreviewSignatureOptions(
qr_sign_options,
create_signature_stream, # user‑provided delegate
release_signature_stream # user‑provided delegate
)
preview_options.signature_id = str(uuid.uuid4())
preview_options.preview_format = gso.PreviewSignatureOptions.PreviewFormats.PNG
gs.Signature.generate_signature_preview(preview_options)
3. รองรับการหมุนสำหรับตัวอย่าง Barcode & QR
ตั้งค่า rotation_angle (หน่วยองศา) บนตัวเลือก barcode/QR เพื่อให้ภาพตัวอย่างหมุนตามที่กำหนด
import groupdocs.signature as gs
import groupdocs.signature.options as gso
import uuid
barcode_sign_options = gso.BarcodeSignOptions("GROUP DOCS", gs.BarcodeTypes.MaxiCode)
barcode_sign_options.width = 400
barcode_sign_options.height = 400
barcode_sign_options.fore_color = gs.Color.red
barcode_sign_options.code_text_alignment = gs.CodeTextAlignment.BELOW
barcode_sign_options.text = "GROUP DOCS"
barcode_sign_options.rotation_angle = 45 # rotate 45°
preview_options = gso.PreviewSignatureOptions(
barcode_sign_options,
create_signature_stream,
release_signature_stream
)
preview_options.signature_id = str(uuid.uuid4())
preview_options.preview_format = gso.PreviewSignatureOptions.PreviewFormats.PNG
gs.Signature.generate_signature_preview(preview_options)
4. รองรับรูปแบบภาพใหม่ – APNG & TGA
ไฟล์ APNG (Animated PNG) และ TGA (Targa) สามารถใช้เป็นลายเซ็นแบบภาพได้เช่นเดียวกับ PNG/JPG ทั้งการแทรก, ตัวอย่าง, และการตรวจสอบ
5. ความโปร่งใสของพื้นหลังสำหรับตัวอย่าง Barcode/QR
กำหนดค่า transparency (ตั้งแต่ 0 – 1) บนตัวเลือก barcode/QR เพื่อสร้างภาพตัวอย่างที่มีพื้นหลังโปร่งใส
barcode_sign_options = gso.BarcodeSignOptions("GROUP DOCS", gs.BarcodeTypes.Codabar)
barcode_sign_options.width = 400
barcode_sign_options.height = 400
barcode_sign_options.fore_color = gs.Color.red
barcode_sign_options.code_text_alignment = gs.CodeTextAlignment.BELOW
barcode_sign_options.text = "GROUP DOCS"
barcode_sign_options.transparency = 0.5 # 50 % transparent background
preview_options = gso.PreviewSignatureOptions(
barcode_sign_options,
create_signature_stream,
release_signature_stream
)
preview_options.signature_id = str(uuid.uuid4())
preview_options.preview_format = gso.PreviewSignatureOptions.PreviewFormats.PNG
gs.Signature.generate_signature_preview(preview_options)
6. รองรับการวางภาพทับบนลายเซ็นดิจิทัล
PdfDigitalSignatureAppearance ตอนนี้เคารพภาพทับพร้อมสีพื้นหลังโดยไม่บังภาพหลัก สามารถควบคุมชั้นโดยใช้ SignatureCustomAppearance.IsForegroundImage
import groupdocs.signature as gs
import groupdocs.signature.options as gso
signature_image_path = "signature.png"
certificate_path = "JohnSmithCertificate.pfx"
input_pdf = "SampleDocument.pdf"
output_pdf = "SignedDocument.pdf"
with gs.Signature(input_pdf) as signature:
sign_options = gso.DigitalSignOptions(certificate_path)
sign_options.password = "1234567890"
sign_options.reason = "Document approval"
sign_options.contact = "John Smith"
sign_options.location = "Head Office"
# Visible signature placement
sign_options.visible = True
sign_options.left = 350
sign_options.top = 100
sign_options.width = 200
sign_options.height = 70
sign_options.image_file_path = signature_image_path
appearance = gso.PdfDigitalSignatureAppearance()
appearance.foreground = gs.Color.from_argb(50, gs.Color.brown)
appearance.font_family_name = "Times New Roman"
appearance.font_size = 12
appearance.background = gs.Color.from_argb(50, gs.Color.light_gray)
appearance.is_foreground_image = True # image on top of text
sign_options.appearance = appearance
sign_result = signature.sign(output_pdf, sign_options)
print(f"\nDocument signed successfully with {len(sign_result.succeeded)} signature(s).")
print(f"Signed file saved at: {output_pdf}")
7. เสริมความปลอดภัย – ลบอัลกอริทึมที่ไม่ปลอดภัย
RC2, DES, TripleDES และโหมด AES ที่อ่อนแอได้ ถูกลบออก จากสแตกการเข้ารหัสแล้ว มีเพียงอัลกอริทึมสมัยใหม่ที่ผ่านการรับรองของ NIST เท่านั้น ส่งผลให้เอกสารที่ลงลายเซ็นมีความปลอดภัยโดยค่าเริ่มต้นสูงขึ้น
8. ปรับปรุงการสืบค้นสไตล์ LINQ
ตอนนี้การ search และ verify ของลายเซ็นรับ ฟังก์ชัน predicate ที่กรองลายเซ็น ก่อน ขั้นตอนประมวลผลหนัก ๆ ทำให้ใช้หน่วยความจำน้อยลงและความเร็วเพิ่มขึ้นในงานแบช
ค้นหาด้วย predicate
import groupdocs.signature as gs
import groupdocs.signature.options as gso
import groupdocs.signature.domain as gsd
with gs.Signature("document.pdf") as signature:
search_options = [gso.TextSearchOptions()]
# Keep only text signatures that contain the word "Approved"
result = signature.search(search_options,
lambda sig: isinstance(sig, gsd.TextSignature) and "Approved" in sig.text)
for sig in result.signatures:
print(f"Found: {sig.text}")
ตรวจสอบด้วย predicate
with gs.Signature("signed_document.pdf") as signature:
verify_options = gso.TextVerifyOptions("John Smith")
# Verify only signatures on page 1
result = signature.verify(verify_options,
lambda sig: sig.page_number == 1)
print(f"Found {len(result)} verified signatures on page 1")
9. แก้ไขการพังของการแสดงตัวอย่าง DOC บน Linux
GeneratePreview() ไม่ทิ้งข้อยกเว้น TypeInitializerException อีกต่อไปเมื่อประมวลผลไฟล์ Microsoft Word (.doc) บน Linux ทำให้ฟีเจอร์แสดงตัวอย่างข้ามแพลตฟอร์มทำงานได้ตามปกติ
คำแนะนำการอัปเกรด
pip install --upgrade groupdocs-signature-net
Note: ชื่อแพคเกจ
groupdocs-signature-netใช้สำหรับ wrapper Python‑via‑.NET
แหล่งข้อมูล
- บันทึกประจำรุ่นเต็ม: (ลิงก์ไปยังหน้าบันทึกประจำรุ่นอย่างเป็นทางการ หากมี)
- เอกสาร: https://docs.groupdocs.com/signature/python/
- ชุมชน & การสนับสนุน: https://forum.groupdocs.com/c/signature/10
ติดตามข่าวอัปเดตต่อไปและตรวจสอบบล็อกอย่างเป็นทางการเพื่อรับเคล็ดลับประสิทธิภาพและแนวทางปฏิบัติที่ดีที่สุด.