mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Signature plugin: invisible digital signature
This commit is contained in:
@ -4567,6 +4567,37 @@ PDFObjectReference PDFDocumentBuilder::createFormFieldSignature(QString fieldNam
|
||||
}
|
||||
|
||||
|
||||
void PDFDocumentBuilder::createInvisibleFormFieldWidget(PDFObjectReference formField,
|
||||
PDFObjectReference page)
|
||||
{
|
||||
PDFObjectFactory objectBuilder;
|
||||
|
||||
objectBuilder.beginDictionary();
|
||||
objectBuilder.beginDictionaryItem("P");
|
||||
objectBuilder << page;
|
||||
objectBuilder.endDictionaryItem();
|
||||
objectBuilder.beginDictionaryItem("Rect");
|
||||
objectBuilder << std::array{ 0.0, 0.0, 0.0, 0.0 };
|
||||
objectBuilder.endDictionaryItem();
|
||||
objectBuilder.beginDictionaryItem("Subtype");
|
||||
objectBuilder << WrapName("Widget");
|
||||
objectBuilder.endDictionaryItem();
|
||||
objectBuilder.beginDictionaryItem("Type");
|
||||
objectBuilder << WrapName("Annot");
|
||||
objectBuilder.endDictionaryItem();
|
||||
objectBuilder.endDictionary();
|
||||
PDFObject widgetObject = objectBuilder.takeObject();
|
||||
objectBuilder.beginDictionary();
|
||||
objectBuilder.beginDictionaryItem("Annots");
|
||||
objectBuilder << std::array{ formField };
|
||||
objectBuilder.endDictionaryItem();
|
||||
objectBuilder.endDictionary();
|
||||
PDFObject pageObject = objectBuilder.takeObject();
|
||||
mergeTo(formField, widgetObject);
|
||||
appendTo(page, pageObject);
|
||||
}
|
||||
|
||||
|
||||
PDFObjectReference PDFDocumentBuilder::createSignatureDictionary(QByteArray filter,
|
||||
QByteArray subfilter,
|
||||
QByteArray contents,
|
||||
@ -4589,7 +4620,7 @@ PDFObjectReference PDFDocumentBuilder::createSignatureDictionary(QByteArray filt
|
||||
objectBuilder << std::array{ byteRangeItem, byteRangeItem, byteRangeItem, byteRangeItem };
|
||||
objectBuilder.endDictionaryItem();
|
||||
objectBuilder.beginDictionaryItem("Contents");
|
||||
objectBuilder << contents;
|
||||
objectBuilder << WrapString(contents);
|
||||
objectBuilder.endDictionaryItem();
|
||||
objectBuilder.beginDictionaryItem("M");
|
||||
objectBuilder << signingTime;
|
||||
@ -5100,14 +5131,6 @@ void PDFDocumentBuilder::setFormFieldValue(PDFObjectReference formField,
|
||||
}
|
||||
|
||||
|
||||
void PDFDocumentBuilder::setLanguage(QLocale locale)
|
||||
{
|
||||
PDFObjectFactory objectBuilder;
|
||||
|
||||
setLanguage(locale.name());
|
||||
}
|
||||
|
||||
|
||||
void PDFDocumentBuilder::setLanguage(QString language)
|
||||
{
|
||||
PDFObjectFactory objectBuilder;
|
||||
@ -5122,6 +5145,14 @@ void PDFDocumentBuilder::setLanguage(QString language)
|
||||
}
|
||||
|
||||
|
||||
void PDFDocumentBuilder::setLanguage(QLocale locale)
|
||||
{
|
||||
PDFObjectFactory objectBuilder;
|
||||
|
||||
setLanguage(locale.name());
|
||||
}
|
||||
|
||||
|
||||
void PDFDocumentBuilder::setOutline(PDFObjectReference outline)
|
||||
{
|
||||
PDFObjectFactory objectBuilder;
|
||||
@ -5256,6 +5287,36 @@ void PDFDocumentBuilder::setPageUserUnit(PDFObjectReference page,
|
||||
}
|
||||
|
||||
|
||||
void PDFDocumentBuilder::setSignatureContactInfo(PDFObjectReference signatureDictionary,
|
||||
QString contactInfoText)
|
||||
{
|
||||
PDFObjectFactory objectBuilder;
|
||||
|
||||
objectBuilder.beginDictionary();
|
||||
objectBuilder.beginDictionaryItem("ContactInfo");
|
||||
objectBuilder << contactInfoText;
|
||||
objectBuilder.endDictionaryItem();
|
||||
objectBuilder.endDictionary();
|
||||
PDFObject updatedSignatureDictionary = objectBuilder.takeObject();
|
||||
mergeTo(signatureDictionary, updatedSignatureDictionary);
|
||||
}
|
||||
|
||||
|
||||
void PDFDocumentBuilder::setSignatureReason(PDFObjectReference signatureDictionary,
|
||||
QString reasonText)
|
||||
{
|
||||
PDFObjectFactory objectBuilder;
|
||||
|
||||
objectBuilder.beginDictionary();
|
||||
objectBuilder.beginDictionaryItem("Reason");
|
||||
objectBuilder << reasonText;
|
||||
objectBuilder.endDictionaryItem();
|
||||
objectBuilder.endDictionary();
|
||||
PDFObject updatedSignatureDictionary = objectBuilder.takeObject();
|
||||
mergeTo(signatureDictionary, updatedSignatureDictionary);
|
||||
}
|
||||
|
||||
|
||||
void PDFDocumentBuilder::updateTrailerDictionary(PDFInteger objectCount)
|
||||
{
|
||||
PDFObjectFactory objectBuilder;
|
||||
|
Reference in New Issue
Block a user