Image embedding API
- Image embedding API. Supported formats: PNG, JPEG.
- Tests for image embedding API.
- API to create a signature with background image.
Example
bool createSignatureWithImage(PDFDoc &doc)
{
const int PAGE_NUM = 1;
const double fontSize = 11.0;
const std::string signatureText = "\n\n My signature";
const char *outputPath = "signed.pdf";
const char *certificate = "Imported Certificate";
const char *password = "password";
const std::string imagePath = "signature.png";
GooString fieldName = GooString("my-signature-field");
PDFRectangle rect = { 337.3, 550.3, 441.5, 619.1 };
std::unique_ptr<GooString> gSignatureText = std::unique_ptr<GooString>(utf8ToUtf16WithBom(signatureText));
std::unique_ptr<AnnotColor> fontColor = std::unique_ptr<AnnotColor>(new AnnotColor(0.0, 0.57, 0.87));
return doc.sign(outputPath, certificate, password, fieldName.copy(), PAGE_NUM,
rect, *gSignatureText, GooString(), fontSize,
std::move(fontColor), 0, {}, {}, nullptr, nullptr, imagePath);
}
Files: signature.png, signed.pdf
Edited by Georgiy Sgibnev