pdfMachine SDK Readme

 

Overview

pdfMachine SDK is a Software Development Kit (SDK) for PDF conversion and manipulation.

• Easily convert your HTML, text and Microsoft Office files to PDF.

• Integrate PDF generation into virtually any application that can print.

• Manipulate existing PDF documents.

• pdfMachine SDK runs on Windows 2008/2012/2016/Vista/7/8/10

• COM API and command line interface.

 

Prerequisites

• pdfMachine 15.40 or later must be installed. The latest version of pdfMachine is available at https://pdfmachine.com/pdfMachine.exe
• Internet Explorer 11
 

 

Installation - Out of Process COM Server

1. Download 
Download and unzip the SDK to a suitable directory.
 e.g. c:\pdfMachineSDK

2. Register the COM server
From the command line, run:

pdfServMachine /RegServer

Depending upon the your security settings, you may be able to now use pdfMachine SDK or you may need use dcomcnfg.exe to add your users to the access list.  See the section on dcomcnfg.exe in the service installation instructions if required.

 

Installation - Service

Before installing the service, think very hard as to whether this is the way to go for you, as it adds a lot of extra configuration steps.  In most cases it is unnecessary to install pdfMachine SDK as a service.

click here for details on service installation

   

Un-Installation

From the command line, run:

pdfServMachine.exe /UnregServer

 

 

Run pdfMachine SDK as a webservice

Once the pdfMachine SDK has been installed, you can run it as a webservice.

From the command line, run:

pdfServMachine.exe /WebService /Port 3981

The default TCP port is 3981, so you can leave off the "/Port 3981" if you are happy with this port.

To turn on logging for the SOAP web service use the parameter /logPath which sets the path and prefix for the log file. If it is not set or invalid then no log file is created. A new log file is created daily using the date.

pdfServMachine.exe /WebService /Port 3981 /LogPath d:/tmp/pdfservmachine_

Windows 2008 / Windows 2012 / Windows 2016 / Windows 2019 / Windows 7 / Windows 8 / Windows 10 - make sure you run pdfServMachine from a command line that  has not been invoked with "run as administrator" selected.

The WSDL file describing the webservice is shipped as part of the SDK.  Its called pdfServMachine.wsdl.

 

If you want the SDK to run the SOAP web service as a windows service then you also need the /Service parameter. From the command line, run:

pdfServMachine /Service /WebService /Port 3981.

Refer to the instructions on how to install as a Windows service.

 

Examples

The following JavaScript, C++ and ASP examples will help you use pdfMachine SDK.

The JavaScript examples can be be saved to a file with a ".js" extension and executed with either wscript.exe or cscript.exe WSH (Windows Script Host).

Alternatively, the examples can be converted to Visual Basic/VB/VBScript/C# that do the same thing.
 

HTML to PDF Example

The Look at the following sample javascript to see how easy it is to use pdfMachine SDK:

// Example javascript script to convert the
// www.google.com web page to a PDF file

var conv = new ActiveXObject("pdfServMachine.converter");
conv.convert("https://www.google.com", "c:\\google.pdf", 1);
WScript.Echo("finished conversion");

 

Convert HTML to PDF Example

Sets margins, headers, footers and page orientation.
Notice the conversion can be done in landscape so the web pages look nice.
Also, you can customize margins and headers and footers.

// Example javascript script to convert
// HTML to PDF setting page layout .

var conv = new ActiveXObject("pdfServMachine.converter");
conv.marginLeft = 20;
conv.marginRight = 20;
conv.marginTop = 0;
conv.marginBottom = 20;
conv.header = "&w &bPage &p of &P &b&b&D";
conv.footer = "&b&u";
conv.pageOrientation = "landscape";

conv.convert("http://www.pdfmachine.com/genp/overview.html", "c:\\pdfmachine.pdf", 1);

Convert then Append Example

Converts several html files to PDF and appends them all to one PDF object.

try
{
var conv = new ActiveXObject("pdfServMachine.converter");
var pdf = new ActiveXObject("pdfServMachine.Pdf");
conv.pageOrientation = "landscape";
conv.scriptEnabled = false; // Turns off webpage javascript

if (!pdf.convertThenAppend("http://www.yahoo.com/",  conv))
        throw  	"convert failed :" +
	     	pdf.getErrorMessage() + " " +
        	conv.getErrorMessage();

if (!pdf.convertThenAppend("file:///c:/tmp/test.html",  conv))
        throw  	"convert failed :" +
	     	pdf.getErrorMessage() + " " +
        	conv.getErrorMessage();

if (!pdf.convertThenAppend("http://www.google.com", conv))
	throw	"convert failed :" +
		pdf.getErrorMessage() + " " +
		conv.getErrorMessage();

if (!pdf.convertThenAppend("http://www.pdfmachine.com/genp/overview.html",  conv))
        throw  	"convert failed :" +
	     	pdf.getErrorMessage() + " " +
        	conv.getErrorMessage();

if (!pdf.saveAs("c:\\x.pdf"))
    throw "saveas failed :" + pdf.getErrorMessage();

WScript.Echo("done");

}
catch(e)
{
    WScript.Echo("exception thrown: "+e);
}

Convert  to PDF example -  the calling app prints

This time around the calling application starts the windows print job. The file c:\x.txt is converted to the PDF file c:\x.pdf, but Notepad.exe does the printing. 

var conv = new ActiveXObject("pdfServMachine.converter");
var shell = new ActiveXObject("WScript.Shell");

conv.printJobStart("c:\\x.pdf", true);
shell.Run("notepad.exe /p c:\\x.txt");
conv.printJobEnd(true, false);
WScript.Echo("finished conversion");

Append PDF example

// Example javascript script to that merges
// several PDFs into one big PDF.

var pdf = new ActiveXObject("pdfServMachine.Pdf");
pdf.append("c:\\afile.pdf");
pdf.append("c:\\bfile.pdf");
pdf.append("c:\\cfile.pdf");
pdf.saveAs("c:\\mergedFile.pdf");


Add Signature Example

//
// Example javascript that signs the document c:\x.pdf and saves
// it as c:\withSig.pdf
//


var pdf = new ActiveXObject("pdfServMachine.Pdf")

try
{
    if (!pdf.open("c:\\x.pdf"))
        throw "open failed";

    if (!pdf.addSignature3(
        true, // isVisible
        "My",
        "ef34e3548a30321e34556e37a92c8ff26ea3b352",
        keyBlob, // key blob (optional to avoid prompts)
        "City", // location
        "I agree", // reason
        "c:\\sig.jpg", // image file
        1, // Display flag - show reason text
        1, // page num
        50, 50, 300, 150, // xoffset, yoffset,width, height
        "https://signer1.broadgun.com:7070 https://signer2.broadgun.com:7070",
        1)) // Certification
        throw "addSignature failed";

    if (!pdf.saveAs("c:\\withSig.pdf"))
        throw "saveAs failed";

    WScript.Echo("The file c:\\withSig.pdf has been signed");
}
catch(e)
{
    WScript.Echo("Exception " + e + "\nError:
                    "+pdf.getErrorMessage());
}

Add Signature From Server Example

// Example that signs the document c:\x.pdf on the server
// and saves it as c:\withSig.pdf

try
{
    var pdf = new ActiveXObject("pdfServMachine.Pdf")

    if (!pdf.open("c:/tmp/x.pdf"))
        throw "open failed";

    if (!pdf.addSignatureFromServer(
	"", // server urls, go with defaults
	"", // server certificate thumbprint, go with default
	"some location",
	"",              // reason
	"d:/sig3.gif",   // image file (optional)
	1,               // image as background
	0x11,            // Display flags - show reason text
	40, 110,         // text offset
	1,               // page num
	"center",        // position relative to
	0, 0, 200, 200,
	0 ))             // certified
        throw "addSignature failed";

    if (!pdf.saveAs("c:/tmp/withSig.pdf"))
        throw "saveAs failed";

    WScript.Echo("The file c:/tmp/withSig.pdf has been signed");
}
catch(e)
{
    WScript.Echo("Exception " + e + "\nError: "+pdf.getErrorMessage());
}

Create Self Signed Certificate Example

//
// Example javascript that creates a self signed certificate in
// the default cert store.
//

var pdf = new ActiveXObject("pdfServMachine.Pdf")

try
{
    var certName = "self signer test cert"

    if (!pdf.createSelfSignedCertificate(
        certName,
        "Development",              // org unit
        "Broadgun",                 // org name
        "test@blah.com",            // email
        "Melbourne",                // locale
        "Victoria",                 // state
        "AU"))                      // 2 char country code

        throw "createSelfSignedCertificate failed";

    WScript.Echo("The certificate has been created.  Cert name: "
	+certName);

}
catch(e)
{
    WScript.Echo("Exception " + e + "\nError: "+
		pdf.getErrorMessage());
}

Print from Excel Example

The following is an example javascript program that prints an excel document and converts it to PDF using pdfServMachine. Call the following script (or similar) from your program using cscript.exe as the interpreter, or write your own code in VB or C# that does the same.

// converts the Excel file c:\x.xls to c:\x.pdf
    // using Excel Object model and pdfServMachine.
    try
    {
    conv = new ActiveXObject("pdfServMachine.converter");

    // tell pdfServMachine where to put resulting PDF
    if (!conv.printJobStart("c:\\x.pdf", true))
    throw "printJobStart failed";

    // print the excel file, using Excel object model
    objXL = new ActiveXObject("Excel.Application");
    workbook = objXL.Workbooks.Open("c:\\x.xls", 3, false );
    workbook.PrintOut();
    // this stops any dialog boxes from showing when we Quit
    objXL.DisplayAlerts = false;
    objXL.Quit();


    // tell pdfServMachine the print has finished
    if (!conv.printJobEnd(true, true))
    throw "printJobWaitUntilFinished failed";
    }
    catch(e)
    {
    WScript.Echo("Exception caught: "+e);
    }
    

Export key, then Sign Example

You can export the key once, and then sign multiple documents without being prompted for authorization to use the key.

//
// Example javascript that signs the document c:\x.pdf and
// saves it as c:\withSig.pdf
// First exports key to a string.
//


var pdf = new ActiveXObject("pdfServMachine.Pdf")

try
{
    var thumbprint = "ef34e3548a30321e34556e37a92c8ff26ea3b352" //thumbprint of certificate

   if (!pdf.open("c:/x.pdf"))
        throw "open failed";

	var keyString = ""
	keyString = pdf.exportKeysByThumbprint(thumbprint)
	if (keyString.length == 0)
		throw "exportKeysByThumbprint failed";



    if (!pdf.addSignature3(
            true,               // is signature visible
            "My",               // store
            thumbprint,         // certificate thumbprint
            keyString,          // key blob (optional)
            "",                 // location (optional)
            "I agree",          // reason
            "",                 // image file (optional)
            0x01,               // Display flags - show reason text
            1,                  // page num
            200, 200, 100, 100,  // xoffset, yoffset, width, height
			"",
			0))

            throw "addSignature failed";

    if (!pdf.saveAs("c:/withSig.pdf"))
		throw "SaveAs failed";

    WScript.Echo("The file c:/withSig.pdf has been signed");
}
catch(e)
{
    WScript.Echo("Exception " + e + "\nError: "
                   +pdf.getErrorMessage());
}

C++ Example

// Example that generates a PDF file by explicitly
// printing to the pdfMachine printer.

// Compiled with msvc ++ 2003
// Compiler command line used: cl /EHsc print2pdf.cpp


#include <stdio.h>
#include <tchar.h>
#include <time.h>

// generates all the code for the smart pointers
#import "c:/dev/pdfservmachine/release/pdfservmachine.exe"

const TCHAR *errMsg = 0;

// initializes a devmode for printing
void initDevmode(DEVMODE *dm)
{
   memset(dm, 0, sizeof(DEVMODE));

   dm->dmSize = sizeof(DEVMODE);
   dm->dmOrientation = DMORIENT_PORTRAIT ;
   _tcscpy((TCHAR*)dm->dmFormName, TEXT("A4"));
   dm->dmFields = DM_ORIENTATION | DM_FORMNAME;
}


// Prints "numPages" of boring text to the printer "printerName".
bool doPrint(const TCHAR *printerName, int numPages)
{
   if (printerName == 0 || _tcslen(printerName) == 0 )
      printerName = _T("Broadgun pdfMachine");

   DEVMODE dm;
   initDevmode(&dm);

   HDC dc = CreateDC(0, printerName, 0,&dm);
   if (!dc)
   {
      errMsg = "CreateDC failed";
      return false;
   }

   DOCINFO di = {0};
   di.cbSize = sizeof(di);
   di.lpszDocName = "doc name";
   int rc = StartDoc(dc, &di);
   if (rc == SP_ERROR)
   {
      errMsg = "StartDoc failed";
      return false;
   }

   char str[100];
   sprintf(str, "On Page %d", 0);

   SIZE sz;
   GetTextExtentPoint32(dc, str, (int)strlen(str), &sz);

   for (int i = 0; i < numPages; i++)
   {
      rc = StartPage(dc);
      if (rc <= 0)
      {
         errMsg = "StartPage failed";
         return false;
      }
      SetMapMode(dc, MM_TEXT);
      LOGFONT lf = {0};
      lf.lfHeight = 50;
      strcpy(lf.lfFaceName, "Arial");
      HFONT font = CreateFontIndirect(&lf);
      HFONT oldFont = (HFONT)SelectObject(dc, font);

      sprintf(str, "On Page %d", i);
      for (int j = 0; j < 2; j++)
      {
         TextOut(dc, 0, sz.cy*j, str, (int)strlen(str));
      }
      rc = EndPage(dc);
      if (rc <= 0)
      {
         errMsg = "EndPage failed";
         return false;
      }
      SelectObject(dc, oldFont);
      DeleteObject(font);
   }

   rc = EndDoc(dc);
   if (rc <= 0)
   {
      errMsg = "EndDoc failed";
      return false;
   }
   DeleteDC(dc);
   return true;
}

// Generates a PDF files.
// The number of files generated is controlled by the "numFiles".
void doTest(int numFiles)
{
   TCHAR filename[MAX_PATH];

   pdfServMachineLib::IconverterPtr conv;
   conv.CreateInstance(L"pdfServMachine.converter");
   if (conv == 0)
   {
      _tprintf(_T("Error: could not create pdfServMachine.converter\n"));
      return;
   }

   srand(time(0));
   int randNum = rand();

   for (int i = 0; i < numFiles; i++)
   {
      _stprintf(filename, _T("C:/tmp/Ptest_%d_%d.pdf"), randNum, i);
      if (!conv->printJobStart(_bstr_t(filename), false))
         goto fail;

      if (!doPrint(_T("Broadgun pdfMachine"), 10))
      {
         _tprintf(_T("print doc failed: %s\n"), errMsg);
         break;
      }

      if (!conv->printJobEnd(false, false))
         goto fail;

   }
   _tprintf(_T("Created %d files. Last file [%s].\n"), i, filename);
   return;

   fail:
   {
      _bstr_t err = conv->getErrorMessage();
      _tprintf(_T("Error: %s\n"), (const TCHAR *)err);
      _tprintf(_T("Created %d files. Last file [%s].\n"), i, filename);
   }


}


void _tmain(int argc, TCHAR *argv[])
{
   // read in command line parameter for number of files to generate
   int numFiles = 1;
   if (argc > 1)
      numFiles = _ttoi(argv[1]);

   CoInitialize(0);
   try
   {
      doTest(numFiles);
   }
   catch (_com_error &e)
   {
      _tprintf(_T("COM Error: %d. %s\n"), e.Error(),
	(const TCHAR*)e.ErrorMessage());
   }
   CoUninitialize();
}
 

Classic ASP example

Follow these steps to use pdfMachine SDK with ASP:

1. Install IIS

2. Install pdfMachine

3. Install pdfMachine SDK as a service by following the instructions in the readme.html in the downloaded pdfServMachine.zip file and https://broadgun.com/pdfservmachine/serviceInstall.html. You must setup a user account that has administrator privileges to run the service.

4. Then run dcomcnfg again (as per instructions for installing as a service). On the same "Security" tab, set the "Launch and Activation Permissions" to include the account that the ASP will run under.  In IIS 7 this defaults to IUSR. 

5. Adjust the NTFS permissions on the pdfServMachine.exe file so the ASP user account  (default IUSR on IIS 7) has read and execute permissions.

 

The following is the source code for a basic ASP page

<html>
<body>

<%

Dim conv
Set conv = Server.CreateObject("pdfServMachine.converter")

If conv.convert("http://www.google.com", "c:/tmp/x.pdf", 0) = 0 Then
    Response.Write (conv.getErrorMessage())
End If

Set conv = nothing
%>
</body>
</html>

  

ASP.net C# example

Follow these steps to use pdfMachine SDK with ASP.NET:

1. Install IIS, Install .NET redistributable, Install .NET SDK.

2. Install pdfMachine

3. Install pdfMachine SDK as a service by following the instructions in the readme.html in the downloaded pdfServMachine.zip file and https://broadgun.com/pdfservmachine/serviceInstall.html. You must setup a user account that has administrator privileges to run the service.

4. In Visual Studio run File | New | Project | ASP.NET Web Application.

5. Then run dcomcnfg again (as per instructions for installing as a service). On the same "Security" tab, set the "Launch and Activation Permissions" to include the account called ASPNET. This will allow the ASP.NET page to use pdfMachine SDK.

6. In your Visual Studio project, select the "Solution Explorer" tab, right click the "References" node of the tree, and select "Add Reference", then select the "COM" tab, then select "pdfServMachine". This step generates pdfServMachineLib which contains the C# wrapper classes for calling pdfServMachine.
 

The following is the source code for the ASP.NET page

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using pdfServMachineLib;

namespace pdfServMachine
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{

private void Page_Load(object sender, System.EventArgs
e)
{
   converterClass conv;
   conv = new converterClass();
   conv.convert("c:\\doc with images.doc",
      "C:\\Inetpub\\wwwroot\\pdfServMachine\\output.pdf", 0);
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
   //
   // CODEGEN: This call is required by the ASP.NET
   //Web Form Designer.
  //
   InitializeComponent();
   base.OnInit(e);
}

   /// <summary>
   /// Required method for Designer support - do not
   /// modify the contents of this method with the code
   /// editor.
   /// </summary>
   private void InitializeComponent()
   {
      this.Load += new
      System.EventHandler(this.Page_Load);

   }
   #endregion
}
}

Press F5 to compile and run it, it should produce a google1.pdf in the c:\ directory.

Convert Word document to PDF C#

The Word object model is used with pdfServMachine to convert a Word document to PDF. The following is a C# example.

using System;

namespace WordTest
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
   /// <summary>
   /// The main entry point for the application.
   /// </summary>
   [STAThread]
   static void Main(string[] args)
   {
   // create new pdfServMachine convert object
   pdfServMachineLib.converterClass conv;
   conv = new pdfServMachineLib.converterClass();

   // create Word app object
   Word.ApplicationClass wordApp = new Word.ApplicationClass();

   object fileName = "c:\\x.doc";
   object trueOb = true;
   object falseOb = false;
   object readOnly = false;
   object isVisible = false;
   object missing = System.Reflection.Missing.Value;

   wordApp.DisplayAlerts = (Word.WdAlertLevel) 0;
   wordApp.Visible = false;

   Word.Document doc = wordApp.Documents.Open(
   ref fileName, // filename
   ref falseOb, // confirm conversions
   ref trueOb, // ReadOnly
   ref missing, // AddToRecentFiles
   ref missing, // PasswordDocument
   ref missing, // Password Template
   ref missing, // Revert
   ref missing, // mtAutoritePasswordDocument
   ref missing, // WritePasswordTemplate
   ref missing, // wdOpenFormatAutoormat
   ref missing, // Encoding
   ref isVisible, // Visible
   ref missing,
   ref missing,
   ref missing,
   ref missing);

   conv.printJobStart("c:\\x.pdf", 1);
   try
   {
      doc.Activate();
      doc.PrintOut(ref falseOb, ref missing, ref missing,
      ref missing, ref missing, ref missing, ref missing,
      ref missing, ref missing, ref missing, ref missing,
      ref missing, ref missing, ref missing, ref missing,
      ref missing, ref missing, ref missing);
   }
   catch(Exception ex)
   {
      Console.Write(ex);
   }
   wordApp.Quit(ref falseOb, ref falseOb, ref falseOb);
   conv.printJobEnd(1, 0);

   }
}
}

Webservice client in C#

The following console program connects to the pdfMachine SDK webservice and converts a html url to a PDF.

using System;
using System.Text;
using System.IO;

namespace CSharpSoapClientTest
{
    class Program
    {
        static void Main(string[] args)
        {

            ServiceReference1.pdfServMachinePortTypeClient conv =
           	 new ServiceReference1.pdfServMachinePortTypeClient();

            try
            {
                ServiceReference1.ConvertParams parms =
                  new ServiceReference1.ConvertParams();
                parms.inFile = "http://www.google.com";
                parms.outFile = "c:\\tmp\\google.pdf";
                parms.ieFooter =  "IE Footer test";
                parms.ieHeader =  "IE Header test";
                parms.ieMarginLeft = 30;
                parms.ieMarginRight = 30;
                parms.ieMarginBottom = 25;
                string errorMsg = conv.convert(parms);
                if (errorMsg.Length > 0)
                    System.Console.WriteLine(errorMsg);
            }
            catch (System.Exception ex)
            {
                System.Console.WriteLine(ex);
            }
		}
    }
}

Webservice client in PHP

The following php code converts the web page www.google.com  to a PDF.

<?php

//
// This is an example using PHP SOAP to call the
// pdfMachine SDK web service.
// note: your PHP must have been installed with the Soap
// option enabled.
//

class ConvertParams {
  public $inFile = "http://www.google.com";
  public $outFile = "c:/tmp/google.pdf";
  public $postProcessing = false;
  public $printerName = "";
  public $ieScriptEnabled = false;
  public $ieFooter = "";
  public $ieHeader = "ie header here...";
  public $ieMarginBottom = 0;
  public $ieMarginTop = 0;
  public $ieMarginLeft = 0;
  public $ieMarginRight = 0;
  public $iePageOrientation = "";
}

$client = new SoapClient("pdfServMachine.wsdl", array('trace' => 1));
$result = $client->convert( array("params" => new ConvertParams()) );
echo "result: ".$result->errorMessage;

?>

Javascript COM example, to attach a file to a PDF.

This example demonstrates how to use the attachFiles API call

Read here to create a ZUGFeRD 1.0 file

A PDF and a list of files to be attached are passed in, the SDK embeds the file(s) in the PDF.

The attachFiles API call is used. The attachFileNames is a semi-colon list of files (with full path) to be attached to the PDF. ZUGFeRDtype should be blank.

	try
	{
		var pdf = new ActiveXObject("pdfServMachine.Pdf")
		var inFileName = "C:/test.pdf";
		var attachFileName = "d:/tmp/y.pdf";
		var attachFileNames = "d:/tmp/a.xml;d:/tmp/x.txt";
		var outFileName = "d:/tmp/withAttachedFiles.pdf";

		//this will create a PDF with 2 attached files
		if (!pdf.attachFiles(inFileName, attachFileNames, outFileName, ""))
				throw "attachFiles failed";
		WScript.Echo("A PDF with the files " + attachFileNames + " was created, saved as " + outFileName);
	}
	catch(e)
	{
		WScript.Echo("Exception " + e + "\nError: "+pdf.getErrorMessage());
	}

Command Line Examples

Convert Word to PDF.  Convert Word document "report.doc" to "report.pdf" in the current directory.  Links in the document will be present in the PDF.  If the document has a Table Of Contents, this will be present in the PDF as bookmarks.

ConvertToPdf report.doc

 

Convert an Excel to PDF.  Excel file "report.xls" to "output.pdf" in the current directory.

ConvertToPdf report.xls output.pdf

 

Convert a PowerPoint to PDF.  Powerpoint file "report.ppt" to "output.pdf" in the current directory, on printer named "Draft Stamp".

ConvertToPdf report.ppt output.pdf "Draft Stamp"

 

Convert an internet URL to PDF.  URL "http://www.pdfmachine.com" to "pdfmachine.pdf" in the current directory, with a navigation timeout of 20 seconds.

ConvertToPdf "http://www.pdfmachine.com" pdfmachine.pdf "Broadgun pdfMachine" /NavTimeoutMs 20000

 

Convert a HTML to PDF.   HTML file "hello.html" to "hello.pdf" in the current directory, without clickable links.

ConvertToPdf hello.html "Broadgun pdfMachine" /Links 0

 

HTA application for sending encrypted PDF emails

What follows is a simple HTA application. If your not familiar with HTA's, they are HTML applications that run on your machine that use JavaScript to do the coding.  They are not restricted security wise as normal html files are. Google them to know more.

This HTA allows you to create a list of files, asks you for passwords and email details, then sends an email with a list of encrypted PDF attachments using Microsoft Outlook. To use, just save the following out as a file with the .hta extension and run.

<html><head>

<HTA:APPLICATION
APPLICATIONNAME="EncryptAndSendPDF" ID="oHTA" BORDER="thick"
BORDERSTYLE="normal" CAPTION="yes" CONTEXTMENU="yes"
INNERBORDER="no" MAXIMIZEBUTTON="yes" MINIMIZEBUTTON="yes"
NAVIGABLE="yes"
ICON="NOTEPAD.EXE" SCROLL="no" SCROLLFLAT="no"
SELECTION="no" SHOWINTASKBAR="yes" SINGLEINSTANCE="no"
SYSMENU="yes" VERSION="0.3" WINDOWSTATE="normal">


<script>
var fileNames = new Array()

function addFile()
{
ComDlg = new ActiveXObject("MSComDlg.CommonDialog");

ComDlg.Filter = "All Files(*.*)|*.*";
ComDlg.FilterIndex = 1;
ComDlg.Flags = 0x200 | 0x1000 | 0x80000;
ComDlg.MaxFileSize = 512;

ComDlg.ShowOpen();
document.getElementById("files").innerHTML += ComDlg.FileName +"<br>";
fileNames.push( ComDlg.FileName );

}

var pdf = new ActiveXObject("pdfServMachine.Pdf");

var objOutlook = new ActiveXObject("Outlook.Application")
var objOutlookMsg ;

function encPdf()
{
objOutlookMsg = objOutlook.CreateItem(0)

objOutlookMsg.To =document.getElementById("emailTo").value;
objOutlookMsg.Subject = document.getElementById("emailSubject").value;
objOutlookMsg.Body = document.getElementById("emailBody").value;


var userPass = document.getElementById("userPass").value;
var ownerPass = document.getElementById("ownerPass").value;
for (var i = 0; i < fileNames.length; i++)
{
pdf.open(fileNames[i]);

var flags = pdf.makeEncryptFlags128(true, true, true, true, true, true, true, true);
var fn = fileNames[i] + "_enc.pdf";
pdf.saveWithSecurity(fn, userPass, ownerPass, flags, 128);

// add attachment
objOutlookMsg.Attachments.Add (fn);
}

// send the email
objOutlookMsg.Display()
//objOutlookMsg.Send()

}
</script>

<body>
<h2>HTA for encrypting and emailing PDF's </h2>
<input type=button onclick="addFile()" value = "add file">
<h3>Files:</h3>
<span id=files></span>

<h3>Owner Password</h3>
<input type=text id=ownerPass>
<h3>User Password</h3>
<input type=text id=userPass>

<h3>Email to address</h3>
<input type=text id=emailTo>

<h3>Email Subject</h3>
<input type=text id=emailSubject>

<h3>Email Body</h3>
<textarea rows=3 cols=70 id =emailBody>
</textarea>
<p>
<input type=button onclick="encPdf()" value = "Encrypt PDF's and send emails" >

</body>
</html>

COM API for "pdfServMachine.converter"

 

convert

Converts a document or web page to a PDF file.

BOOL convert(
   BSTR inFileName,
   BSTR outFileName,
   BOOL postProcess    )

Parameters

BSTR inFileName

The full path of the document to be converted to PDF. This can be a document that can be printed with the Shellexec api, such as a MS Word file or a text file or it can be the url of a web page. 

BSTR outFileName

The resulting PDF filename.

BOOL postProcess

If TRUE, normal pdfMachine processing of the PDF file occurs applying features such as encryption, N-Up, stationery, and  doc. info. - if they are enabled. These features can be enabled within the pdfMachine options dialog.

Setting this to TRUE will slow PDF production.
 

Returns

TRUE if success, otherwise FALSE.

 

printJobStart

Used when the calling application is starting the Windows print job. Must be followed by a printJobEnd() after the print job has been started.

BOOL printJobStart(
   BSTR outFileName,
   BOOL setDefPrinter )

Parameters

BSTR outFileName

The resulting PDF filename.

BOOL setDefPrinter

If TRUE, the Windows default printer is set to the current pdfMachine printer, usually "Broadgun pdfMachine".  The default printer prior to this call can be restored by setting the "restoreDefPrinter" flag in the corresonding printJobEnd call.

Returns

TRUE if success, otherwise FALSE.

 

printJobEnd

Ends a print job previously opened with printJobStart().   This call blocks until the print spooler has finished printing. 

BOOL printJobEnd(BOOL restoreDefPrinter, BOOL postProcess)
    

Parameters

BOOL restoreDefPrinter

If TRUE, the default windows printer is restored to what it was previously, otherwise it is left alone.

BOOL postProcess

If TRUE, normal pdfMachine processing of the PDF file occurs applying features such as encryption, N-Up, stationery and  doc. info. - if they are enabled. These features can be enabled within the pdfMachine options dialog, or by directly setting registry entries. If you wish to directly set a registry entry, please read https://broadgun.com/pdfmachine/developer.htm for details. 

Setting this to TRUE will slow PDF production.
 

 

Returns

TRUE if success, otherwise FALSE.

 

property: pageOrientation

Type: BSTR

The current page orientation. Can be either "landscape" or "portrait". Currently only used when printing html.

 

property: marginLeft

Type: LONG

The left page margin. Units are in millimeters. Currently only used when printing html.  The default is 5mm.

 

property: marginRight

Type: LONG

The right page margin. Units are in millimeters. Currently only used when printing html. The default is 5mm.

 

property: marginTop

Type: LONG

The top page margin. Units are in millimeters. Currently only used when printing html. The default is 5mm.

 

property: marginBottom

Type: LONG

The bottom page margin. Units are in millimeters. Currently only used when printing html. The default is 5mm.

   

property: header

property: footer

Type: BSTR

The page header/footer. Currently only used when printing html. The syntax is the same as that for Internet Explorer page header/footer.

To format a custom header or footer, use the following codes to specify the information to be printed. The codes can be combined with text (for example, "Page &p of &P").

Desired Text
Code
Window title
&w
Page address (URL)
&u
Date in short format (as specified by Regional Settings in Control Panel)
&d
Date in long format (as specified by Regional Settings in Control Panel)
&D
Time in the format specified by Regional Settings in Control Panel
&t
Time in 24-hour format
&T
Current page number
&p
Total number of pages
&P
Centered text (following &b)
&b
Right-aligned text (following &b&b)
&b&b
A single ampersand (&)
&&&
 

property: doPostProcessing

Type: BOOL/LONG

Primarily used prior to the Pdf.convertThenAppend() call.

If TRUE, normal pdfMachine processing of the PDF file occurs applying features such as encryption, N-Up, stationery and  doc. info. - if they are enabled. These features can be enabled within the pdfMachine options dialog, or by directly setting registry entries. If you wish to directly set a registry entry, please read https://broadgun.com/pdfmachine/developer.htm for details. 

Setting this to TRUE will slow PDF production.
 

 

 

property: scriptEnabled

Type: BOOL/LONG

Controls if JavaScript is enabled when printing HTML in subsequent convert() calls.   Defaults to TRUE.  

Sometimes JavaScript may effect the appearance of a web page when printed or may cause the page to halt processing while waiting for user input - this offers a way to disable it.

If TRUE, JavaScript is enabled, otherwise its disabled.

 

COM API for "pdfServMachine.Pdf"

 

open

Opens a PDF file ready for manipulation. 

BOOL open(BSTR fileName)
    

Parameters

BSTR fileName

The full path of the PDF file to be opened.

Returns

TRUE if success, otherwise FALSE.

 

saveAs

Creates a PDF file containing the result of the PDF manipulation. 

BOOL saveAs(BSTR fileName)
    

Parameters

BSTR fileName

The full path of the PDF file to be written to.

Returns

TRUE if success, otherwise FALSE.

 

convertThenAppend

Converts a file to a PDF then appends that file to our internal representation.

BOOL convertThenAppend(BSTR inFileName, IDispatch *conv)

Parameters

BSTR inFileName

The full path of the document to be converted to PDF. This can be a document that can be printed with the Shellexec api, such as a MS Word file or a text file or it can be the url of a web page. 

IDispatch *conv

An IDispatch COM object implementing the "PdfServMachine.converter" interface. This allows the user to provide details such as pageOrientation, margins etc.

Returns

TRUE if success, otherwise FALSE.

 

append

Opens the PDF file 'fileName' and appends the contents to our internal representation.

BOOL append(BSTR fileName)

Parameters

BSTR fileName

The full path of the PDF file that will be read in.

Returns

TRUE if success, otherwise FALSE.

 

deletePage

Deletes a page.

BOOL deletePage(int pageNum)

Parameters

int pageNum

The number of the page to be deleted.

Returns

TRUE if success, otherwise FALSE.

 

getNumPages

Deletes a page.

int getNumPages()

Returns

The number of pages.

 

setStationery

Applies stationery.  The first page of the 'stationeryFile' is drawn on each page specified.

BOOL setStationery(BSTR stationeryFile,
	int startPage, int endPage, BOOL ontop)

Parameters

BSTR stationeryFile

The path of the file to be read in and used as stationery.

int startPage

The first page to have stationery applied.

int endPage

The last page to have stationery applied is endPage -1. If endPage is -1, then all pages will have stationery applied.

BOOL ontop

If TRUE, the stationery is drawn after the existing page has been drawn, otherwise it is drawn first.

Returns

TRUE if success, otherwise FALSE.

 

applyNup

Applies N-Up processing, where 2, 4 or 8 pages are shrunk and drawn on the one page.

BOOL applyNup(
   BSTR pageSize,
   int numPagesOnEachPage,
   int margin,
   int borderThickness   )

Parameters

BSTR pageSize

A common page name, such as "A4" or "Letter". Valid values are: 4A, 2A, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, 4B, 2B, B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, SRA0, SRA1, SRA2, SRA3, SRA4, RA0, RA1, RA2, C0, C1, C2, C3, C4, C5, C6, C7/6, C7, DL, A3, extra, A4, extra, Letter, Legal, Executive, Ledger, Tabloid.
 

int numPagesOnEachPage

Either 1, 2, 4 or 8.

int margin

The size of the margin between pages, measured in points.

int borderThickness

The size of the border drawn around each page measured in points. -1 means no border, 0 means as thin as possible.

Returns

TRUE if success, otherwise FALSE.

 

getErrorMessage

Retrieves the last error message.

BSTR getErrorMessage()

Returns

A description of what went wrong. This is set if any of the functions return FALSE.

 

 

saveWithSecurity

Saves a PDF file with PDF standard security and encryption.

BOOL saveWithSecurity(BSTR fileName, BSTR userPass, BSTR ownerPass,
	int flags, int keysizeInBits)

Parameters

BSTR fileName

The full path of the PDF file to be written to.

BSTR userPass

The password for opening the PDF file.  May be empty.
 

BSTR ownerPass

The password for changing permissions in the PDF file. .
 

int flags

Flags as returned by makeEncryptFlags128() or makeEncryptFlags40().

int keysizeInBits

The key size. The values of 40 or 128 are allowed.

Returns

TRUE if success, otherwise FALSE.

 

makeEncryptFlags40

Creates 40 bit encryption flags for use by saveWithSecurity().

int makeEncryptFlags40(BOOL print, BOOL change,
	BOOL copy, BOOL addnotes)

Parameters

BOOL print

If true, printing will be allowed.

BOOL change

If true, changing of the document will be allowed.

BOOL copy

If true, copying will be allowed.

BOOL addnotes

If true, annotations will be allowed.

Returns

The flags to be passed to saveWithSecurity().

 

makeEncryptFlags128

Creates 128 bit encryption flags for use by saveWithSecurity().

int makeEncryptFlags128(
   BOOL print,
   BOOL change,
   BOOL copyAndExtract,
   BOOL addnotes,
   BOOL formFillOrSign,
   BOOL extractAccessibility,
   BOOL assemble,
   BOOL hiResPrint   )

Parameters

BOOL print

If true, printing will be allowed.

BOOL change

If true, changing of the document will be allowed.

BOOL copyAndExtract

If true, copying and extraction will be allowed.

BOOL addnotes

If true, annotations will be allowed.

BOOL formFillOrSign

If true, filling our of forms and document signing will be allowed.

BOOL extractAccessibility

If true, extraction for accessibility purposes is allowed.

BOOL assemble

If true, document assembly is allowed.

BOOL hiResPrint

If true, hi-res printing is allowed.

Returns

The flags to be passed to saveWithSecurity().

 

 

 

setDocInfo

Sets document information properties.

BOOL setDocInfo(BSTR name, BSTR value)

Parameters

BSTR name

The name of the value to be set.  Allowed values are: Author, Title, Subject, Keywords.

BSTR value

If corresponding value.

Returns

TRUE  if success.

 

 

addPage

Adds a blank new page to the current PDF document.

BOOL addPage(long width, long height)

Parameters

long width

The width of the page in points.

long height

The height of the page in points.

Returns

TRUE  if success.

 

 

addSignature

Adds a digital signature to the PDF.  Uses Windows certificate management.  To see what certificates are installed, open up Control Panel, select "Internet Options", then "Content", then "Certificates".

BOOL addSignature3(
	BOOL isVisible,
	BSTR storeName,
	BSTR thumbprint,
	BSTR keyBlob,
	BSTR location,
	BSTR reason,
	BSTR imageFile,
	LONG textDisplayFlags,
	LONG pageNum,
	LONG x, LONG y, LONG width, LONG height,
	BSTR timestampUrl,
	LONG certification)

BOOL addSignature4(
	BOOL isVisible,
	BSTR storeName,
	BSTR thumbprint,
	BSTR keyBlob,
	BSTR location,
	BSTR reason,
	BSTR imageFile,
	LONG textDisplayFlags,
	LONG pageNum,
	LONG x, LONG y, LONG width, LONG height,
	BSTR timestampUrl,
	LONG certification,
	LONG embedRevocationData)

Parameters
 

bool isVisible

If true the signature will be visible on the page, otherwise there will be no appearance, but the signature will be present in the signature tab of acrobat reader.

BSTR storeName

Optional. The name of the Windows certificate store.  Defaults to "My".

BSTR thumbprint

Thumbprint of the certificate to use.  To get a certificate's thumbprint, view the certificate, and then on the details tab, scroll down to the thumbprint entry.  Each certificate has a unique thumbprint.

BSTR keyBlob

Optional.  A hex encoded key used for signing.  This is returned from exportKeysByThumbprint. It is used to avoid Windows showing the "accessing a private key" dialog box, which would be problematic for unattended applications/services.

BSTR location

Optional.  The location string in the signature.  e.g. "City of Melbourne".

BSTR reason

Optional.   The reason string in the signature.  e.g. "I agree".

BSTR imageFile

Optional.  The full path of an image file that will appear in the signature.  JPEG, BMP and GIF files can be used.

long  textDisplayFlags

A bitmask that controls what text appears on the signature appearance.
The following hex values may be OR'ed together.

0x01 - Certificate Name
0x02 - Distinguished Name
0x04 - Location
0x08 - Reason
0x10 - Date and time
0x20 - Big certificate Name
0x40 - Date only
0x80 - Time only

long  pageNum

The page to place the signature on.  1 is the first page, -1 means the last page.

long  X

X coordinate of left side of signature box.  Units are in points.

long  Y

Y coordinate of bottom of signature box. Units are in points.

long  width

The signature width. Units are in points.

long  height

The signature height. Units are in points.

long  timestampUrl

Space separated list of timestamp server urls.
eg. "https://signer1.broadgun.com:7070 https://signer2.broadgun.com:7070"
Server timestamp is not applied if this parameter is empty.

long  certification

This enables certified access permissions / the blue ribbon symbol on the signature.

1 = Changes Not Allowed
2 = Changes to Forms Allowed
3 = Changes to Forms and Annotations Allowed.

Set this value to 0 to disable certified access permissions.

long  embedRevocationData

If set to 1, certificate revocation data is embedded into the digital signature. Revocation data can be in the form of an OCSP response or a certificate revocaton list.

 

Returns

TRUE  if success.

 

 

exportKeysByThumbprint

Exports the keys associated with a certificate as a hex string. The value returned can be used as the keyBlob parameter of the addSignature method.  The returned keys are not encrypted.
This method will  cause Windows to display the "accessing a private key" dialog box, however when the result is passed to addSignature3 or addSignature4, no dialog will be shown. 

BSTR exportKeysByThumbprint(BSTR thumbprint)

Parameters

BSTR thumbprint

The certificate thumbprint.
To get a certificate's thumbprint, view the certificate, and then on the details tab, scroll down to the thumbprint entry.  Each certificate has a unique thumbprint.

Returns

Unencrypted hexencoded key string to be used in the "keyBlob" parameter of addSignature3 or addSignature4.

 

createSelfSignedCertificate

Creates a self signed certificate. The certificate is created in the Windows Certificate "My" store.  

BSTR createSelfSignedCertificate(
   BSTR certName,
   BSTR orgUnit, BSTR orgName,
   BSTR email, BSTR localeName,
   BSTR stateName,
   BSTR countryCode   )

Parameters

BSTR certName

The certificate name.

BSTR orgUnit

Optional. The organizational unit.

BSTR orgName

Optional. The organizational name.

BSTR email

Optional. The email address.

BSTR localeName

Optional. The locale.

BSTR stateName

Optional. The state.

BSTR countryCode

Optional. The 2 char country code.

Returns

The thumbprint of the new certificate.
To see a certificate's thumbprint, view the certificate, and then on the details tab, scroll down to the thumbprint entry.  Each certificate has a unique thumbprint.

 

 

addSignatureFromServer

Adds a signature from a server.  The signature is calculated on the server, using a certificate installed on the server.

BSTR addSignatureFromServer(
	BSTR serverUrlsStr,
	BSTR serverCertThumbprint,
	BSTR location,
	BSTR reason,
	BSTR imageFile,
	LONG imageAsBackground,
	LONG sigTextFlags,
	LONG textOffsetX,
	LONG textOffsetY,
	LONG pageNum,
	BSTR position,
	LONG x, LONG y, LONG width, LONG height,
	LONG certifiedAccessPermission);

Parameters
 

BSTR serverUrlsStr

This is a semi-colon separated list of signing servers to use.  Only one is required, but more can be added for load balancing and fault tolerance.

You can pass in an empty string to use the default value of  "https://signer1.broadgun.com:7070;https://signer2.broadgun.com:7070"
NOTE : Broadgun Software's signing server is not currently operational. If you wish to enquire about a signing server please email enquiries to

BSTR serverCertThumbprint

Thumbprint of the certificate to use on the server.  To get a certificate's thumbprint, view the certificate, and then on the details tab, scroll down to the thumbprint entry.  Each certificate has a unique thumbprint.  You can pass in an empty string to use the default server certificate (the first one).

BSTR location

Optional.  The location string in the signature.  e.g. "City of Melbourne".

BSTR reason

Optional.   The reason string in the signature.  e.g. "I agree".

BSTR imageFile

Optional.  The full path of an image file that will appear in the signature.  JPEG, BMP and GIF files can be used.

LONG imageAsBackground

1 = Use image as background of entire signature box, underneath text.
0 = Image in separate area at left of signature box

long  sigTextFlags

A bitmask that controls what text appears on the signature appearance.
The following hex values may be OR'ed together.

0x01 - Certificate Name
0x02 - Distinguished Name
0x04 - Location
0x08 - Reason
0x10 - Date and time
0x20 - Big certificate Name
0x40 - Date only
0x80 - Time only

long  textOffsetX

X offset relative to the top left of the signature box.

long  textOffsetY

Y offset relative to the top left of the signature box.

long  pageNum

The page to place the signature on.  1 is the first page, -1 means the last page.

BSTR  position

Simple way of specifying position of signature on the page instead of the X and Y parameters.

Valid values are:
"topleft"
"topright"
"bottomleft"
"bottomright"
"center"
"centerleft"
"centerright"
"centertop"
"centerbottom"

long  X

X coordinate of left side of signature box.  Units are in points.  Ignored if position is specified.

long  Y

Y coordinate of bottom of signature box. Units are in points.  Ignored if position is specified.

long  width

The signature width. Units are in points.

long  height

The signature height. Units are in points.

long  certification

This enables certified access permissions / the blue ribbon symbol on the signature.

1 = Changes Not Allowed
2 = Changes to Forms Allowed
3 = Changes to Forms and Annotations Allowed.


Set this value to 0 to disable certified access permissions.


Returns

TRUE  if success.

 

 

attachFiles

Attaches one or more files to a PDF. The file is attached as an embedded file.

BSTR attachFiles(
   BSTR pdfFileName,
   BSTR attachFileNames,
   BSTR outFileName,
   BSTR ZUGFerDtype   );

Parameters

BSTR pdfFileName

This is the full path to the initial PDF which is to have a file(s) attached. 

BSTR attachFileNames

This is a semi-colon list of files (with full path) to be attached to the PDF.

BSTR outFileName

The full path of the resulting PDF.

BSTR ZUGFerDtype

The type of ZUGFeRD profile, eg BASIC, COMFORT or EXTENDED. Read here to create ZUGFeRD invoices.

Returns

TRUE  if success.




 

Command Line ConvertToPdf.exe

ConvertToPdf is a command line utility that converts various file formats to a PDF file. It supports all the same file formats that the pdfMachine SDK supports and any other documents that can be printed with the command line print command. (Some files extension that are setup with the ability to print eg. .txt files etc).

ConvertToPdf has the following syntax, where <> indicates required parameters and [] indicates optional parameters.


Usage:
ConvertToPdf.exe <input path> [output path] [printer name] [options]

<input path>             Required. Path to the file to be converted to pdf.

[output path]            Optional. Path to the PDF file to be created.
                         By default pdf file will be created in current dir.

[printer name]           Optional unless some of the options below are used, then it must be specified. Defaults to "Broadgun pdfMachine"

[options]                Optional. optionName
/Links <1|0>             Enable/disable clickable links in PDF.
                         1 to enable, 0 to disable.  Defaults to 1.
                         For HTML, Word, PowerPoint files.
/Bookmarks <1|0>         Enable/disable bookmarks in PDF
                         1 to enable, 0 to disable.  Defaults to 1.
                         For Word, PowerPoint files.
/PostProcessing <1|0>    Enable/disable post processing.
                         1 to enable, 0 to disable.  Defaults to 1.
/Script <1|0>            Enable/disable javascript.
                         1 to enable, 0 to disable.  Defaults to 1.
                         For HTML files.
/NavTimeoutMs            Navigation timeout in milliseconds
                         For HTML files.
/PrintTimeoutMs          Print timeout in milliseconds.

If there is an error processing the command, an error message will be output to the command line, and is also stored in the registry entry "/HKCU/pdfMachine/Broadgun pdfMachine/ToPdfError".  If you have created different printer names, substitute the appropriate printer name for "Broadgun pdfMachine" in the the registry path.

Enable the /PostProcessing parameter to apply the settings in the pdfMachine Options screens, like watermarks, signatures, etc.  You can have multiple pdfMachine printers setup, each with different settings, then print to a particular pdfMachine printer to use a that printer's settings for /PostProcessing.

You can change the default option values by setting registry entries in the "/HKCU/pdfMachine/Broadgun pdfMachine/" key.   If you have created different printer names, substitute the appropriate printer name for "Broadgun pdfMachine" in the the registry path.  The registry entry names are the same as the command line but with "ToPdf" before them.  eg "ToPdfLinks", "ToPdfBookmarks", "ToPdfScript", "ToPdfNavTimeoutMs" etc.  Command line parameters override registry settings.  If you don't specify a particular command line parameter, the registry is checked, and if there is no registry entry, the default value described in the above usage description is used.

ConvertToPdf.exe is not synchronized.  It is up to you to ensure there is only one command line call in progress at one time.  (NOTE: The COM API is synchronized, so you may prefer to use that)

 

Release History

October 2020 - 2.7.3
Logging for SOAP interface as a Service

September 2020 - 2.7.1
New API calls for ZUGFeRD 2.1.1 / factur-X
Requires version 15.41 of pdfMachine. Latest pdflib.
Logging for SOAP interface
Compatible with Windows 2016

Oct 2019 - 2.6
ZUGFeRD-invoice.xml attachments named specifically in /Names
Fixed bug where postProcessing parameter to web service convert method was not used.
Fixed error on file not found in soap webservice

Mar 2017 - 2.3
Compatible with Windows 2016
Fixed bug where postProcessing parameter to web service convert method was not used.

Oct 2014 - 2.2
Added the ability to specify the ZUGFeRD type when attaching files to a PDF either by COM API or SOAP Web Service.
Allowed the SDK to be run as a Windows service whilst operating as a SOAP Web Service.

Oct 2014 - 2.1
Added the ability to attach files to a PDF either by COM API or SOAP Web Service. This allows PDF ZUGFeRD invoices to be created.
Latest pdflib.

Mar 2014 - 1.99.1
Fixed header from html. Made compatible with version 14.67 of pdfMachine. Latest pdflib.

Note: This version must be used with at least pdfMachine 14.67.

Aug 2012 - 1.99
Added addSignature4. Fixed various bugs. Latest pdflib.

Jul 2008 - 1.94
Fixed issue with printJobStart() not working.

Aug 2007 - 1.92
Fixed bug where margins, orientation, headers and footers were not working with IE7.

Also fixed problem with printJobStart() not saving file in correct location.

Note: This version must be used with at least pdfMachine 12.12.

 

June 2007 - 1.91
Server signature
Support for Word, Excel and PowerPoint files.
Command line interface.
 

Feb 2007
Changed name from pdfServMachine to pdfMachine SDK.
Updated signature interface.

6 May  2006 - 1.7
Updated to work with pdfMachine 11.04, new digital signature mechanism.

29  August  2005 - 1.6.2
Added convertThenAppend, orientation, margins, headers, footers. Improved memory usage while printing html.

 

14 April 2005 - 1.5
Fixed problem with creating multiple signatures on the one PDF.

14 Oct 2004 - 1.4
Fixed problem where createSelfSignedCertificate was failing on NT and W2K. Added more examples to readme file.

 Sep 2004 - 1.3
Fixed bug that displayed signature appearance in wrong spot. Also added new parameter "storeName" to addSignature method.

3 Sep 2004 - 1.2
Added support for digital signatures.

5 Aug 2004 - 1.1
First commercial release.
Added saveWithSecurity, setDocInfo, makeEncryptFlags40, makeEncryptFlags128.

 

26 Feb 2004 - beta5
Added printJobStart() printJobEnd() methods to the Converter object.

20 Feb 2004 - beta4
Improved notes on installation in this file. No changes to the program.

18 Feb 2004 - beta3
Added new COM class, Pdf, for PDF manipulation.

10 Jan 2004 - beta2
First public beta.