Pdf995 Pdf995
Pdf995 Pdf995 Pdf995 Pdf995 Pdf995 Pdf995 Pdf995

Developer's FAQ

How can I bypass the Save As dialog?
PdfEdit includes 2 auto-name settings:
1. Fixed filename
2. Name the PDF based on the original document name (recommended). This enables applications to specify the final PDF document programmatically.

If option 2 is specified, adding "Output Folder="c:\myfolder" will cause all documents to be saved to the specified folder. The default folder is c:\pdf995\output.

Adding "Fixed Dir=c:\myfolder" to the [Parameters] section of pdf995.ini will cause the Save As dialog to always open to the same folder. Default behavior is to open to the last folder to which a PDF was saved.

A third option will allow PDF documents to be named by number. Adding "Output File=1" to the [Parameters] section of pdf995 will incrementally number PDF's starting with 1.

How can I modify the functionality of Pdf995 programmatically?
PdfEdit modifies c:\pdf995\res\pdf995.ini to control the functionality of Pdf995. Programmers may invoke many of the features of PdfEdit by direct modification of pdf995.ini.

How can I programmatically control Pdf995 and OmniFormat to create PDF's?

You may bypass the save as dialog of PDF995 in order to programmatically generate PDFs. See how pdfEdit's autoname options configure pdf995 by adjusting the ..pdf995\res\pdf995.ini file. You can modify the ini file without pdfEdit installed. The middle option (name the pdf based on the name of the document being printed) allows you to specify the name of the PDF from your application. It is possible to temporarily name the document before sending it to the printer. The third option allows you to specify the name and path of the filename you wish to create.

In addition to programmatic control of pdf995 output via the pd995.ini file, Pdf995 v6.52 and later support control by passing the desired output file in the lpszDocName member of the DOCINFO windows structure. The DOCINFO structure is an argument of the StartDoc Windows API function. The lpszDocName must include: "<pdf995:filename>" where "filename" is the requested pdf output. A sample MFC application illustrating programmatic printing to pdf995 can be found at www.freeware995.com/misc/Snippet995.zip. A method for ensuring the PDF is complete may be found at www.freeware995.com/misc/pdf995printing.zip

The code at www.freeware995.com/misc/vbacode.txt and www.freeware995.com/misc/vbacode1.txt can be used to convert Access Reports to PDF. The latter code sample can be used to give the PDF a name other than the report name.

You may also modify psconvert.exe. Its source is available from the bottom of our FAQ.

Note that OmniFormat offers a command line interface to converting Office documents, text files and HTML to PDF. OmniFormat and HTML2PDF995 (included with OmniFormat) may be run from IIS and other web servers. Instructions for this are included in the readme file in the HTML2PDF995 section. The instructions apply to calling OmniFormat as well. OmniFormat also includes command line utilities for changing default page size and orientation.

Aside from the developers FAQ, we do not currently documentation for the pdf995.ini parameters. However, they are generally configurable via pdfedit. Therefore we recommend configuring pdf995 using pdfedit and then noting how the pdf995.ini file was adjusted.

You can determine when a print job is complete by creating a temporary "flag" file and specifying a processpdf handler (you could specify a batch file for example) that deletes the file. Thus, when the flag files has been deleted, the pdf has been created.

How can I modify the Postscript file before it is converted to PDF?
Add "ProcessPS=c:\myfolder\mypsapp.exe" to the [Parameters] section of pdf995.ini. Pdf995 will run this specified executable after c:\pdf995\temp.ps has been created. It will wait to convert it to PDF until the specified executable has closed.

This feature accommodates insertion of dynamically generated stationery (enables inclusion of time of creation etc.) into PDF documents if the file .\documents and settings\all users\application data\pdf995\stationery.eps or .\documents and settings\<username>\application data\pdf995\stationery.eps is first modified and then pdfedit is called with an argument of "stationery" (c:\pdf995\res\utilities\pdfedit995.exe stationery).

Note: Postscript files generated with the default Pdf995 printer drivers may be concatenated to generate PDF's containing content from multiple sources. Applications may use the ProcessPS feature to store the PS files so that it may be concatenated with other PS files before conversion to PDF.

How can I integrate Pdf995 with Workflow and Document Management systems?
Add "ProcessPDF= c:\myfolder\mypdfapp.exe" to the [Parameters] section of pdf995.ini. Pdf995 will run this specified executable or batch command after the PDF file has been created. It will wait until the specified executable has been closed before continuing. The application may determine the name of the PDF generated by referring to the "Launch" parameter of pdf995.ini.

In order to run a batch file so that is not visible, add

Show Process=0

to the [Parameters] section of pdf995.ini.

This feature enables custom processing and routing of PDF documents once they have been created.

How can I print to Pdf995 from my Visual Basic application?
The following sample opens c:\sample.doc and prints it:

Private Sub Command1_Click()

Dim wd As New Word.Application
Set wd = New Word.Application

wd.Documents.Open FileName:="""c:\sample.doc""", _

ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _

wd.Documents.Application.ActivePrinter = "PDF995"
wd.Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _

wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
Collate:=False, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, _ PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0

End Sub

How do I use a ProcessPDF handler to programmatically determine when a pdf is complete?

1. Before printing to pdf995:

GetPrivateProfileString(TEXT("Parameters"),TEXT("ProcessPDF"), "", szprocesspdf, sizeof(szprocesspdf), GetPdf995Path() + "pdf995\\res\\pdf995.ini");
szDefaultProcessPDF = szprocesspdf;

WritePrivateProfileString(TEXT("Parameters"),TEXT("ProcessPDF"), applicationthatdeletesflagfilethatyousupply, GetPdf995Path() + "pdf995\\res\\pdf995.ini");

HANDLE hndFlag = CreateFile(GetPdf995Path() + "pdf995\\flag", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); CloseHandle(hndFlag);

2. Print to pdf995. When pdf995 created the pdf, it will call applicationthatdeletesflagfilethatyousupply. That will delete the flag file. Wait as follows until the pdf is complete:

CFileStatus status;
CString szRoot = GetPdf995Path();
while(CFile::GetStatus( szRoot + "pdf995\\flag", status ))

WritePrivateProfileString(TEXT("Parameters"),TEXT("ProcessPDF"), szDefaultProcessPDF, GetPdf995Path() + "pdf995\\res\\pdf995.ini");

3. This is used in the above example:
CString GetPdf995Path()
HKEY hkey1;
int rc;
CString szpath = "c:\\";
CString KEYz = "Software\\Pdf995";
if ((rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, KEYz, 0,
DWORD cbData;
//dwlen = 4;

cbData = 10000;
type1 = REG_SZ;
BYTE *buf = new BYTE[cbData];
memset (buf, NULL, cbData);
if (!RegQueryValueEx(hkey1, "Path", NULL, &type1,
(LPBYTE)buf, &cbData) == ERROR_SUCCESS)
delete [] buf;
return szpath;

szpath = buf;
delete [] buf;
return szpath;


Can Pdf995 add additional features to Pdf995 or develop custom ProcessPS or ProcessPdf handlers?
Yes. Please email us at support@software995.com

Can I create PDF's programmatically with the UltraPdf SDK?
No. The UltraPdf allows you to create UltraPDF documents programmatically from PDF's, Office Documents, Flash files and HTML. PDF's may be created programmatically by bypassing the Save As dialog as described above.

What is the easiest way to convert XML to formatted PDF?
OmniFormat will convert XML to PDF using a DOC file as a layout template. It may be run from the command line. It is free and may be downloaded from www.omniformat.com .

What is the easiest way to convert Microsoft Office and HTML files to PDF?
OmniFormat will convert over 75 file formats including DOC, XLS, PPT, HTML and XML to PDF. It may be run from the command line. It is free and may be downloaded from www.omniformat.com .

Automated bookmark insertion:
It is possible to automatically add bookmarks specified using pdfEdit v5.2 or later to all PDF's created with Pdf995 by adding the following to the [Parameters] section of pdf995.ini:

ProcessPS=c:\pdf995\res\utilities\pdfedit995.exe InsertBookMarks

The auto-insertion process will refer to .\documents and settings\all users\application data\pdf995\bookmarks.xml for the bookmark list (if user mode is selected then it will be .\documents and settings\username\application data\pdf995\bookmarks.xml). A sample bookmarks.xml file may be created by using pdfEdit995 to impose bookmarks on a PDF. This file may be manually or progammatically edited. This will also affect OmniFormat output.

Automated PDF Security:
This downloadable utility will automatically secure all PDFs created with PDF995.

Note: OmniFormat can also be used to batch autoencrypt documents. The following is for Pdf995.

Please install Signature995 and the Standard Encryption module (free).

Place the exe in the c:\pdf995\res folder and double click it to register it. To unregister it remove the ProcessPDF line in c:\pdf995\res\pdf995.ini. Add the following entries to the paramters section of pdf995.ini:

Encryption String=10100000 128
Encryption UserPassword=userpassword
Encryption OwnerPassword=ownerpassword

Encryption OwnerPassword=RANDOM
then the module will generate a random owner password each time the pdf is encrypted.

You may customize the security settings. See the Standard Encryption module
for information.

How can I programmatically obtain information about a digital signature of a PDF or Microsoft Office document signed with Signature995?
Software995 offers a free DLL libary that can programmatically extract the signed document, validate the signatures and determine the issuers of the digital certificates. It can be downloaded at www.freeware995.com/signaturae995/lib995.zip. A signature995 key will disable the sponsor pages. The libary supports documents that have been signed by one or more parties using Signature995.

How can I send a print job to both Pdf995 and a local or network printer at the same time?
AutoPrint (www.freeware995.com/misc/autoprint.exe) is a free utility intended to automatically print the output of Pdf995 to any system or network printer when the PDF is complete. AutoPrint requires that PdfEdit995 is installed.

Place autoprint.exe in the .\pdf995\res folder. Execute it once to register it with Pdf995 as a processpdf handler (or add a processpdf entry in the pdf995.ini file manually). By default, the software will print 1 copy to the default printer. The following parameters may be specified in the [Auto Print] section of the ..pdf995\res\pdf995.ini file to specify a different printer or multiple copies:


Each time a pdf is created with Pdf995, AutoPrint will be invoked and print the PDF to the specified printer. AutoPrint can be uninstalled by removing the ProcessPDF entry in the [Parameters] section of ..pdf995\res\pdf995.ini.

How can I convert an Access Report to a PDF file?
The code at www.freeware995.com/misc/vbacode.txt was used on Access 2002, but should work with any version. Also, it has been tested on XP and 2000.