c++ Usage

All Aloaha APIs are implemented as automation compatible COM Objects. The advantage is that the Aloaha APIs can be used by any language which does support COM Objects.

Most variables have to be passed by reference (as pointers). Some programming language handle this automatically, in some others you need to define that in the code.

For programmers which have problems to pass variables by reference we introdced in Build 3.0.171 a new function which expects the variables by value. 

The function is called Sign_PDF_EML and is identically to the function sign_pdf_file explained here. The only difference is that is supports by value instead of by reference. The EML in the function name furhtermore shows that this function is also able to handle emails as explained here.

This new function was introduced in Aloaha Build 3.0.171

Please note that this function requires a valid license key! Please contact aloaha@wrocklage.de for an evaluation key.


c++ code sample

 main.cpp (1,32 KB)

#include "windows.h"
#include <atlbase.h>
#import "C:\Program Files\Common Files\aloaha\aloahapdf.dll" auto_rename, auto_search

BOOL DigSignPDFFile(LPCWSTR lpszsrcpdf, LPCWSTR lpszdstpdf,
LPCWSTR lpszsignreason, LPCWSTR lpszsignlocation)
{
try
{
// Create COM object smart pointer class.
CComPtr<aloahapdf::_edit> editpdf;

// Create an instance of the "aloahapdf.edit" COM object.
if (FAILED(editpdf.CoCreateInstance(L"aloahapdf.edit", NULL, CLSCTX_INPROC_SERVER)))
return FALSE;

// Please set empty for an invisible signature
// If you use as content a path to a 24Bit JPG Image it will be used as signature image
// See also http://www.aloaha.com/software-development/signature-types.php
editpdf->signaturecontent = _bstr_t(L"");

// Call the sign PDF function.
// _bstr_t(L"0") stands for first card reader
// it can be set also to UniqueContainerName of SerialNumber of Certificate
if (editpdf->Sign_PDF_EML(_bstr_t(lpszsrcpdf), _bstr_t(lpszdstpdf),
0, 0, 11, 8, 21, 2, _bstr_t(lpszsignreason), _bstr_t(lpszsignlocation),
_bstr_t(L"0"), _bstr_t(L"")) == VARIANT_FALSE) return FALSE;
}
catch(_com_error)
{
// Catch any COM exceptions.
return FALSE;
}

// Success.
return TRUE;
}

void main(void)
{
::CoInitialize(NULL);

DigSignPDFFile(L"C:\\test.pdf", L"C:\\test_sign.pdf", L"Reason", L"Location");

::CoUninitialize();
}

 main.cpp (1,32 KB)

Should have any questions or should you require other APIs by value instead of by ref please do not hesitate to contact us via the form below.



Company
Contact Person  
E-Mail
Telephone
Fax
Comment:

Please enter the code shown on the left in the following field: (This is to prevent automatic spammers)


Aloaha Software / Knowledge Base / PDF SDK / PDF Signature API / c++ Usage
create PDF Software

c++ Usage

Any questions?
Aloaha Software - Knowledge Base / PDF SDK / PDF Signature API / c++ Usage
ProductsKnowledge BaseShopSupportPress
Deutsche VersionEnglish version