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;
|
||||
|
@@ -1235,6 +1235,13 @@ public:
|
||||
PDFObjectReference signatureValue);
|
||||
|
||||
|
||||
///
|
||||
/// \param formField Form field reference
|
||||
/// \param page Page reference
|
||||
void createInvisibleFormFieldWidget(PDFObjectReference formField,
|
||||
PDFObjectReference page);
|
||||
|
||||
|
||||
/// Creates signature dictionary used for preparation in signing process. Can define parameters of the
|
||||
/// signature.
|
||||
/// \param filter Filter (for example, Adobe.PPKLite, Entrust.PPKEF, CiCi.SignIt, ...)
|
||||
@@ -1450,11 +1457,6 @@ public:
|
||||
PDFObject value);
|
||||
|
||||
|
||||
/// Set document language.
|
||||
/// \param locale Locale, from which is language determined
|
||||
void setLanguage(QLocale locale);
|
||||
|
||||
|
||||
/// Set document language.
|
||||
/// \param language Document language. It should be a language identifier, as defined in ISO 639
|
||||
/// and ISO 3166. For example, "en-US", where first two letter means language code (en =
|
||||
@@ -1462,6 +1464,11 @@ public:
|
||||
void setLanguage(QString language);
|
||||
|
||||
|
||||
/// Set document language.
|
||||
/// \param locale Locale, from which is language determined
|
||||
void setLanguage(QLocale locale);
|
||||
|
||||
|
||||
/// Set document outline.
|
||||
/// \param outline Document outline root
|
||||
void setOutline(PDFObjectReference outline);
|
||||
@@ -1527,6 +1534,20 @@ public:
|
||||
PDFReal unit);
|
||||
|
||||
|
||||
/// Sets signature contact info field.
|
||||
/// \param signatureDictionary Signature dictionary reference
|
||||
/// \param contactInfoText Contact info text
|
||||
void setSignatureContactInfo(PDFObjectReference signatureDictionary,
|
||||
QString contactInfoText);
|
||||
|
||||
|
||||
/// Sets signature reason field.
|
||||
/// \param signatureDictionary Signature dictionary reference
|
||||
/// \param reasonText Reason text
|
||||
void setSignatureReason(PDFObjectReference signatureDictionary,
|
||||
QString reasonText);
|
||||
|
||||
|
||||
/// This function is used to update trailer dictionary. Must be called each time the final document is
|
||||
/// being built.
|
||||
/// \param objectCount Number of objects (including empty ones)
|
||||
|
Reference in New Issue
Block a user