Unser Kunde Matthew Ciantar hat uns mit einem exzellenten C# Codebeispiel beliefert. Dieses Beispiel zeigt, wie die Aloaha APIs in C# benutzt werden können. Nachfolgend sehen Sie den Quellcode dazu. Am Ende der Seite können Sie die Dateien herunterladen.
/*
* This command line applications uses Aloaha PDF Crypter
* to encrypt a PDF File with a given Public Key (Cer File).
*
* Author: Matthew Ciantar
* Date: 2006/01/20
*
* License for the Aloaha PDF Crypter is required
* Evaluation of API works without valid License
*
**/
using System;
using System.IO;
using System.Reflection;
namespace PDFCrypterTool
{
class Crypter
{
static void Main(string[] args)
{
if (args.Length == 3)
{
// Store Arguments in Local Variables
string CertificateFilePath = args[0];
string PDFSourceFilePath = args[1];
string PDFDestinationFilePath = args[2];
// Check existance of Certificate and Source File
if (File.Exists(CertificateFilePath) && File.Exists(PDFSourceFilePath))
{
Type aloahapdf = Type.GetTypeFromProgID("aloahapdf.edit");
object aloahapdfLateBound = Activator.CreateInstance(aloahapdf);