diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-11-24 21:03:59 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-11-25 09:13:12 +0100 |
commit | 2c9f4c6a5e1a9ce5ef501c8f5a7f5cd421bf86f7 (patch) | |
tree | 7c8fde238416db29a73336431af0c07188193f71 /vcl | |
parent | b22e2548a4ac7a4395b3e50b82f23a46cbd6104a (diff) |
pdfium: add sig getters: ByteRange, DocMDPPermission, Contents and SubFilter
Change-Id: Ieab577de92898568e27a879af1ca1bda170a307d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106554
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/pdf/PDFiumLibrary.cxx | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx index 3e9ae64dc950..a1d618e33105 100644 --- a/vcl/source/pdf/PDFiumLibrary.cxx +++ b/vcl/source/pdf/PDFiumLibrary.cxx @@ -196,6 +196,47 @@ PDFiumSignature::PDFiumSignature(FPDF_SIGNATURE pSignature) { } +std::vector<int> PDFiumSignature::getByteRange() +{ + int nByteRangeLen = FPDFSignatureObj_GetByteRange(mpSignature, nullptr, 0); + std::vector<int> aByteRange(nByteRangeLen); + if (nByteRangeLen <= 0) + { + return aByteRange; + } + + FPDFSignatureObj_GetByteRange(mpSignature, aByteRange.data(), aByteRange.size()); + return aByteRange; +} + +int PDFiumSignature::getDocMDPPermission() +{ + return FPDFSignatureObj_GetDocMDPPermission(mpSignature); +} + +std::vector<unsigned char> PDFiumSignature::getContents() +{ + int nContentsLen = FPDFSignatureObj_GetContents(mpSignature, nullptr, 0); + std::vector<unsigned char> aContents(nContentsLen); + if (aContents.empty()) + { + return aContents; + } + + FPDFSignatureObj_GetContents(mpSignature, aContents.data(), aContents.size()); + return aContents; +} + +OString PDFiumSignature::getSubFilter() +{ + int nSubFilterLen = FPDFSignatureObj_GetSubFilter(mpSignature, nullptr, 0); + std::vector<char> aSubFilterBuf(nSubFilterLen); + FPDFSignatureObj_GetSubFilter(mpSignature, aSubFilterBuf.data(), aSubFilterBuf.size()); + // Buffer is NUL-terminated. + OString aSubFilter(aSubFilterBuf.data(), aSubFilterBuf.size() - 1); + return aSubFilter; +} + PDFiumDocument::PDFiumDocument(FPDF_DOCUMENT pPdfDocument) : mpPdfDocument(pPdfDocument) { |