PDF/A is based on PDF 1.4 and places a certain number of constraints on PDF files to ensure that the files will remain readable with newer versions of operating systems and PDF readers.
PDF/A has now become an ISO standard: ISO 19005-1 norm for Electronic document file format for long-term preservation.
PDF/A-3 is based on PDF 1.7 and is also known as ISO standard ISO 19005-3.
The main constraints that are placed on PDF files include:
All fonts must be embedded with Unicode conversion tables
Colorspaces specified in a device-independent manner.
Audio and video content, Javascript, AutoPrint and encryption are forbidden.
PDF files should contain XMP based metadata.
The PDF/A ISO specifications define three conformance levels for PDF/A:
Level A: The PDF file contains tags that define the structure of the document. Examples of structured elements can be start or end of paragraph, start or end of a chapter or many more. Creating a true level A PDF/A file requires complete knowledge of the internal structure of a document and can rarely be produced by automatically converting documents from other formats.
Level B: The PDF file does not contain structured elements and the fonts may not include the Unicode encoding tables (although this is recommended).
Level U (PDF/A-3 only): The PDF file does not contain structured elements. All fonts included in the PDF file include an encoding table that maps all characters to their Unicode value. This makes the file searchable.
To enable PDF/A when converting documents using PDF Converter, you should set the following flags in the imageOptions property or function call:
ImageOptions |
Description |
Value |
---|---|---|
IO_XMPMETADATA |
Add XMP metadata to PDF files (can be used independently of PDF/A). |
0x00000010 |
IO_OUTPUTPDFA |
Create PDF/A files. |
0x00000008 |
And these following flags in the FileNameOptionsEx property or function call:
FileNameOptionsEx |
Description |
Value |
---|---|---|
EmbedFonts |
Enable embedding of fonts used in the source document. |
0x00000010 |
MultilingualSupport |
Add supports for international character sets. |
0x00000080 |
EmbedStandardFonts |
Embed standard fonts such as Arial, Times, etc. |
0x00200000 |
EmbedLicensedFonts |
Embed fonts requiring a license. |
0x00400000 |
ImageOptions = IO_OUTPUTPDFA | IO_XMPMETADATA
FileNameOptionsEx = NoPrompt | EmbedFonts | MultilingualSupport | EmbedStandardFonts | EmbedLicensedFonts
SetDefaultConfig
Having 2 separate flags will enable the developer to output XMP Metadata independently of PDF/A compatibility. In addition, the developer should always set Multilingual and Font Embedding supports so that the fonts get properly embedded.
For Unicode fonts, full font embedding (FullEmbed) should NOT be used. This is because Unicode font files are usually very large, and will result in very large file sizes.
Earlier versions of Acrobat 7 will flag our files as non PDF/A compatible. Make sure you are using Acrobat 7.0.7 to check for PDF/A compatibility.
By default, PDF Converter will generate PDF/A-1b files, PDF/A part 1 and conformance Level B.
See PDFA Level property to have more information.
In order to succeed with PDF/A document creation is important to follow this:
Include the options of embedFonts, MultilingualSupport, EmbedStandardFonts and EmbedLicensedFonts in the FileNameOptionsEx property.
JBIG2 image compression standard can be used with both PDF/A-1 and PDF/A-3.
JPEG2000 image compression standard is allowed only with PDF/A-3
Any kind of Encryption will not comply with PDF/A standards.
For the PDF/A-3b German ZUGFeRD format requires that the value of Relationship be set to “Alternative” using AddFileAttachmentEx, DocAddFileAttachmentEx
In the case of the evaluation version, the validation could fail, because the trial watermark font is not embedded.
<Flags()>
Public Enum acImageOptions As Integer
IO_NODUPLICATES = &H1
IO_DOWNSAMPLE = &H2
IO_CONVERTTOCMYK = &H4
IO_OUTPUTPDFA = &H8
IO_XMPMETADATA = &H10
IO_OUTPUTPDFA8 = &H20
IO_NOPRECOMPRESSED = &H40
IO_OUTPUTPDFX1 = &H80
IO_OUTPUTPDFX3 = &H100
IO_COMPRESSJBIG2 = &H200 ' Allowed Only with PDF/A-1 and PDF/A-3
IO_ENABLEEPS = &H40000000
IO_SIMPOSTSCRIPT = &H80000000
End Enum
<Flags()>
Public Enum acFileNameOptions As Integer
' Please check FileNameOptions for the complete version of the flags
NoPrompt = &H1
UseFileName = &H2
Concatenate = &H4
DisableCompression = &H8
EmbedFonts = &H10
BroadcastMessages = &H20
PrintWatermark = &H40
MultilingualSupport = &H80
EncryptDocument = &H100 ' It cannot be used with PDF/A standard
EmbedStandardFonts = &H200000
EmbedLicensedFonts = &H400000
Jpeg2000Compression = &H1000000 ' Allowed Only with PDF/A-3
EncryptDocument128 = &H40000000 ' It cannot be used with PDF/A standard
End Enum
Sub Sample()
' Constants for Activation codes
Const strLicenseTo As String = "Amyuni PDF Converter Evaluation"
Const strActivationCode As String = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
Const AMYUNIPRINTERNAME As String = "Amyuni PDF Converter"
' Declare a new cdintfex object if it does not exist in the form.
Dim PDF As New CDIntfEx.CDIntfEx
' Get a reference to the installed printer.
' This will fail if the printer name passed to the DriverInit method is
' not found in the printer’s folder
PDF.DriverInit(AMYUNIPRINTERNAME)
' The SetDefaultPrinter function sets the system default printer to the one
' initialized by the DriverInit functions.
PDF.SetDefaultPrinter()
' The EnablePrinter() method needs to be called right before each print job.
' and before the configuration
' Calling the EnablePrinter() method will start a 20 second time-out value
PDF.EnablePrinter(strLicenseTo, strActivationCode)
' Resulting PDF document stored here
PDF.DefaultDirectory = "C:\Temp"
' Set Printer options
PDF.FileNameOptionsEx = acFileNameOptions.NoPrompt Or acFileNameOptions.EmbedFonts _
Or acFileNameOptions.MultilingualSupport Or acFileNameOptions.EmbedStandardFonts _
Or acFileNameOptions.EmbedLicensedFonts
' Set Image conversion options
' IO_COMPRESSJBIG2 It cannot be used with PDF/A standard
PDF.ImageOptions = acImageOptions.IO_OUTPUTPDFA8 Or acImageOptions.IO_XMPMETADATA
' Set parameters for PDF/A-1b
Dim part As Integer = 1 ' part = 1
Dim conformance As Integer = Asc("B") ' Conformance "Level B"
PDF.SetPrinterParamInt("PDFALevel", conformance << 8 Or part)
' Apply Settings
PDF.SetDefaultConfig()
' The BatchConvert method converts a number of files to PDF.
PDF.BatchConvert("C:\Temp\*.docx")
' The RestoreDefaultPrinter function resets the system default printer
' to the printer that was the default before the call to SetDefaultPrinter.
PDF.RestoreDefaultPrinter()
' This function will simply detach from an existing printer because the handle was created using DriverInit
PDF.DriverEnd()
End Sub
[Flags]
public enum acImageOptions
{
IO_NODUPLICATES = 0x00000001,
IO_DOWNSAMPLE = 0x00000002,
IO_CONVERTTOCMYK = 0x00000004,
IO_OUTPUTPDFA = 0x00000008,
IO_XMPMETADATA = 0x00000010,
IO_OUTPUTPDFA8 = 0x00000020,
IO_NOPRECOMPRESSED = 0x00000040,
IO_OUTPUTPDFX1 = 0x00000080,
IO_OUTPUTPDFX3 = 0x00000100,
IO_COMPRESSJBIG2 = 0x00000200, // Allowed Only with PDF/A-1 and PDF/A-3
IO_ENABLEEPS = 0x40000000,
IO_SIMPOSTSCRIPT = unchecked((int)0x80000000)
}
[Flags]
public enum acFileNameOptions
{
// Please check FileNameOptions for the complete version of the flags
NoPrompt = 0x00000001,
UseFileName = 0x00000002,
Concatenate = 0x00000004,
DisableCompression = 0x00000008,
EmbedFonts = 0x00000010,
BroadcastMessages = 0x00000020,
PrintWatermark = 0x00000040,
MultilingualSupport = 0x00000080,
EncryptDocument = 0x00000100, // It cannot be used with PDF/A standard
EmbedStandardFonts = 0x00200000,
EmbedLicensedFonts = 0x00400000,
Jpeg2000Compression = 0x01000000, // Allowed Only with PDF/A-3
EncryptDocument128 = 0x40000000 // It cannot be used with PDF/A standard
}
private void PDFASupport()
{
// Constants for Activation codes
const string strLicenseTo = "Amyuni PDF Converter Evaluation";
const string strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";
const string AMYUNIPRINTERNAME = "Amyuni PDF Converter";
// Declare a new cdintfex object if it does not exist in the form.
CDIntfEx.CDIntfEx PDF = new CDIntfEx.CDIntfEx();
// Get a reference to the installed printer.
// This will fail if the printer name passed to the DriverInit method is
// not found in the printer’s folder
PDF.DriverInit(AMYUNIPRINTERNAME);
// The SetDefaultPrinter function sets the system default printer to the one
// initialized by the DriverInit functions.
PDF.SetDefaultPrinter();
// The EnablePrinter() method needs to be called right before each print job.
// and before the configuration
// Calling the EnablePrinter() method will start a 20 second time-out value
PDF.EnablePrinter(strLicenseTo, strActivationCode);
// Resulting PDF document stored here
PDF.DefaultDirectory = @"C:\Temp";
// Set Printer options
PDF.FileNameOptionsEx = (int)(acFileNameOptions.NoPrompt | acFileNameOptions.EmbedFonts
| acFileNameOptions.MultilingualSupport | acFileNameOptions.EmbedStandardFonts
| acFileNameOptions.EmbedLicensedFonts);
// Set Image conversion options
// IO_COMPRESSJBIG2 It cannot be used with PDF/A standard
PDF.ImageOptions= (int)(acImageOptions.IO_OUTPUTPDFA8 | acImageOptions.IO_XMPMETADATA);
// Set parameters for PDF/A-1b
int part = 1; // part = 1
int conformance = ' B' ; // Conformance "Level B"
PDF.SetPrinterParamInt("PDFALevel", conformance << 8 | part);
// Apply Settings
PDF.SetDefaultConfig();
// The BatchConvert method converts a number of files to PDF.
PDF.BatchConvert(@"C:\Temp\*.docx");
// The RestoreDefaultPrinter function resets the system default printer
// to the printer that was the default before the call to SetDefaultPrinter.
PDF.RestoreDefaultPrinter();
// This function will simply detach from an existing printer because the handle was created using DriverInit
PDF.DriverEnd();
}
// PDF Converter Cpp.cpp : Defines the entry point for the console application.
//
# include <Windows.h>
# include <string>
# include <iostream>
# include "CdIntf.h"
# pragma comment (lib, "CDIntf.lib")
using namespace std;
int main()
{
// Constants for Activation codes
# define strLicenseTo "Amyuni PDF Converter Evaluation"
# define strActivationCode "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
# define AMYUNIPRINTERNAME "Amyuni PDF Converter"
// Get a reference to the installed printer.
// This will fail if the printer name passed to the DriverInit method is
// not found in the printer’s folder
HANDLE PDF = DriverInit(AMYUNIPRINTERNAME);
// The CDISetDefaultPrinter function sets the system default printer to the one
// initialized by the DriverInit functions.
CDISetDefaultPrinter(PDF);
// The EnablePrinter() method needs to be called right before each print job.
// and before the configuration
// Calling the EnablePrinter() method will start a 20 second time-out value
EnablePrinter(PDF, strLicenseTo, strActivationCode);
// Resulting PDF document stored here
SetDefaultDirectory(PDF, "C:\temp");
// Set Printer options
// EncryptDocument, Jpeg2000Compression nor EncryptDocument128 cannot be used with PDF/A standard
SetFileNameOptions(PDF, NoPrompt | EmbedFonts | MultilingualSupport | EmbedStandardFonts | EmbedLicensedFonts | FullEmbed);
// Set Image conversion options
// IO_COMPRESSJBIG2 It cannot be used with PDF/A standard
SetImageOptions(PDF, IO_OUTPUTPDFA8 | IO_XMPMETADATA);
// Set parameters for PDF/A-1b
int part = 1; // part = 1
int conformance = ' B' ; // Conformance "Level B"
SetPrinterParamInt(PDF, "PDFALevel", conformance << 8 | part);
// Apply Settings
SetDefaultConfig(PDF);
// The BatchConvert method converts a number of files to PDF.
BatchConvertEx(PDF, "C:\temp\\*.docx");
// The RestoreDefaultPrinter function resets the system default printer
// to the printer that was the default before the call to SetDefaultPrinter.
RestoreDefaultPrinter(PDF);
// This function will simply detach from an existing printer because the handle was created using DriverInit
DriverEnd(PDF);
// Destroy PDF object
PDF = nullptr;
return 0;
}
package Example;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
public class PDFAsupport {
public enum acImageOptions
{
IO_NODUPLICATES(0x00000001),
IO_DOWNSAMPLE(0x00000002),
IO_CONVERTTOCMYK(0x00000004),
IO_OUTPUTPDFA(0x00000008),
IO_XMPMETADATA(0x00000010),
IO_OUTPUTPDFA8(0x00000020),
IO_NOPRECOMPRESSED(0x00000040),
IO_OUTPUTPDFX1(0x00000080),
IO_OUTPUTPDFX3(0x00000100),
IO_COMPRESSJBIG2(0x00000100), // Allowed Only with PDF/A-1 and PDF/A-3
IO_SIMPOSTSCRIPT(0x80000000);
private int value;
private acImageOptions(int value)
{
this.value = value;
}
public Object value(){
return value;
}
}
public enum acFileNameOptions
{
// Please check FileNameOptions for the complete version of the flags
NoPrompt(0x00000001),
UseFileName(0x00000002),
Concatenate(0x00000004),
DisableCompression(0x00000008),
EmbedFonts(0x00000010),
BroadcastMessages(0x00000020),
PrintWatermark(0x00000040),
MultilingualSupport(0x00000080),
EncryptDocument(0x00000100), // It cannot be used for PDF/A creation
EmbedStandardFonts(0x00200000),
EmbedLicensedFonts(0x00400000),
Jpeg2000Compression(0x01000000), // Allowed Only with PDF/A-3
EncryptDocument128(0x40000000); // It cannot be used for PDF/A creation
private int value;
private acFileNameOptions(int value)
{
this.value = value;
}
public Object value(){
return value;
} }
public static void main(String[] args)
{
// Constants for Activation codes
String strLicenseTo = "Amyuni PDF Converter Evaluation";
String strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";
String AMYUNIPRINTERNAME = "Amyuni PDF Converter";
// Declare a new cdintfex object if it doesn' t exist in the form.
ActiveXComponent pdf = new ActiveXComponent("CDIntfEx.CDIntfEx.6.5");
// Get a reference to the installed printer.
// This will fail if the printer name passed to the DriverInit method is
// not found in the printer’s folder
Dispatch.call(pdf,"DriverInit",AMYUNIPRINTERNAME);
// The SetDefaultPrinter function sets the system default printer to the one
// initialized by the DriverInit functions.
Dispatch.call(pdf,"SetDefaultPrinter");
// The EnablePrinter() method needs to be called right before each print job.
// and before the configuration
// Calling the EnablePrinter() method will start a 20 second time-out value
Dispatch.call(pdf,"EnablePrinter", strLicenseTo, strActivationCode);
// Resulting PDF document stored here
Dispatch.put(pdf,"DefaultDirectory","C:\temp");
// Set Printer options
Dispatch.put(pdf,"FileNameOptionsEx",acFileNameOptions.NoPrompt.value | acFileNameOptions.EmbedFonts.value
| acFileNameOptions.MultilingualSupport.value | acFileNameOptions.EmbedStandardFonts.value
| acFileNameOptions.EmbedLicensedFonts.value);
// Set Image conversion options
// IO_COMPRESSJBIG2 It cannot be used with PDF/A standard
Dispatch.call(pdf, "ImageOptions", acImageOptions.IO_OUTPUTPDFA8.value | acImageOptions.IO_XMPMETADATA.value);
// Set parameters for PDF/A-1b
int part = 1; // part = 1
int conformance = ' B' ; // Conformance "Level B"
Dispatch.call(pdf, "SetPrinterParamInt", "PDFALevel", conformance << 8 | part);
// Apply Settings
Dispatch.call(pdf, "SetDefaultConfig");
// The BatchConvert method converts a number of files to PDF.
Dispatch.call(pdf,"BatchConvert","C:\temp\\*.docx");
// The RestoreDefaultPrinter function resets the system default printer
// to the printer that was the default before the call to SetDefaultPrinter.
Dispatch.call(pdf,"RestoreDefaultPrinter");
// Close Printer
Dispatch.call(pdf,"DriverEnd");
// Destroy PDF Object
pdf = null;
}
}
$acImageOptions = @{
IO_NODUPLICATES = 0x00000001
IO_DOWNSAMPLE = 0x00000002
IO_CONVERTTOCMYK = 0x00000004
IO_OUTPUTPDFA = 0x00000008
IO_XMPMETADATA = 0x00000010
IO_OUTPUTPDFA8 = 0x00000020
IO_NOPRECOMPRESSED = 0x00000040
IO_OUTPUTPDFX1 = 0x00000080
IO_OUTPUTPDFX3 = 0x00000100
IO_COMPRESSJBIG2 = 0x00000200 # Allowed Only with PDF/A-1 and PDF/A-3
IO_ENABLEEPS = 0x40000000
IO_SIMPOSTSCRIPT = 0x80000000
}
# Please check FileNameOptions for the complete version of the flags
$acFileNameOptions = @{
NoPrompt = 0x00000001
UseFileName = 0x00000002
Concatenate = 0x00000004
DisableCompression = 0x00000008
EmbedFonts = 0x00000010
BroadcastMessages = 0x00000020
PrintWatermark = 0x00000040
MultilingualSupport = 0x00000080
EncryptDocument = 0x00000100 # It cannot be used with PDF/A standard
EmbedStandardFonts = 0x00200000
EmbedLicensedFonts = 0x00400000
Jpeg2000Compression = 0x01000000 # Allowed Only with PDF/A-3
EncryptDocument128 = 0x40000000 # It cannot be used with PDF/A standard
}
# Constants for Activation codes
$strLicenseTo = "Amyuni PDF Converter Evaluation"
$strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
$AMYUNIPRINTERNAME = "Amyuni PDF Converter"
# Declare a new cdintfex object if it doesn' t exist in the form.
$PDF = New-Object -ComObject CDIntfEx.CDIntfEx.6.5
# Get a reference to the installed printer.
# This will fail if the printer name passed to the DriverInit method is
# not found in the printer’s folder
[System.__ComObject].InvokeMember('DriverInit', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$AMYUNIPRINTERNAME)
# The SetDefaultPrinter function sets the system default printer to the one
# initialized by the DriverInit functions.
[System.__ComObject].InvokeMember('SetDefaultPrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null)
# The EnablePrinter()method needs to be called right before each print job.
# and before the configuration
# Calling the EnablePrinter()method will start a 20 second time-out value
[System.__ComObject].InvokeMember('EnablePrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, @($strLicenseTo, $strActivationCode))
# Resulting PDF document stored here
[System.__ComObject].InvokeMember('DefaultDirectory', [System.Reflection.BindingFlags]::SetProperty,$null,$PDF,"C:/Temp")
# Set Printer options
[System.__ComObject].InvokeMember('FileNameOptionsEx', [System.Reflection.BindingFlags]::SetProperty,$null,$PDF,$acFileNameOptions::NoPrompt `
-bOr $acFileNameOptions::EmbedFonts -bOr $acFileNameOptions::MultilingualSupport -bOr $acFileNameOptions::EmbedStandardFonts `
-bOr $acFileNameOptions::EmbedLicensedFonts)
# Set Image conversion options
# IO_COMPRESSJBIG2 It cannot be used with PDF/A standard
[System.__ComObject].InvokeMember('ImageOptions', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, @($acImageOptions::IO_OUTPUTPDFA8 -bOr $acImageOptions::IO_XMPMETADATA))
# Set parameters for PDF/A-1b
$part = 1 #part = 1
$conformance = [byte][char] "B" #Conformance "Level B"
$PDFALevel = (1 -shl 8)*$conformance -bOr $part
[System.__ComObject].InvokeMember('SetPrinterParamInt', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, @("PDFALevel", $PDFALevel))
# Apply Settings
[System.__ComObject].InvokeMember('SetDefaultConfig', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, $null)
# The BatchConvert method converts a number of files to PDF.
[System.__ComObject].InvokeMember('BatchConvert', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, "C:\Temp\*.docx")
# The RestoreDefaultPrinter function resets the system default printer
# to the printer that was the default before the call to SetDefaultPrinter.
[System.__ComObject].InvokeMember('RestoreDefaultPrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null)
# This function will simply detach from an existing printer because the handle was created using DriverInit
[System.__ComObject].InvokeMember('DriverEnd', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null)
# Destroy Object
$PDF = $null
' ImageOptions Constants
Const IO_NODUPLICATES = &H1
Const IO_DOWNSAMPLE = &H2
Const IO_CONVERTTOCMYK = &H4
Const IO_OUTPUTPDFA = &H8
Const IO_XMPMETADATA = &H10
Const IO_OUTPUTPDFA8 = &H20
Const IO_NOPRECOMPRESSED = &H40
Const IO_OUTPUTPDFX1 = &H80
Const IO_OUTPUTPDFX3 = &H100
Const IO_COMPRESSJBIG2 = &H200 ' Allowed Only with PDF/A-1 and PDF/A-3
Const IO_ENABLEEPS = &H40000000
Const IO_SIMPOSTSCRIPT = &H80000000
' FileNameOptions constants
' Please check FileNameOptions for the complete version of the flags
NoPrompt = &H1
UseFileName = &H2
Concatenate = &H4
DisableCompression = &H8
EmbedFonts = &H10
BroadcastMessages = &H20
PrintWatermark = &H40
MultilingualSupport = &H80
EncryptDocument = &H100 ' It cannot be used with PDF/A standard
EmbedStandardFonts = &H200000
EmbedLicensedFonts = &H400000
Jpeg2000Compression = &H1000000 ' Allowed Only with PDF/A-3
EncryptDocument128 = &H40000000 ' It cannot be used with PDF/A standard
' Constants for Activation codes
Const strLicenseTo = "Amyuni PDF Converter Evaluation"
Const strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
Const AMYUNIPRINTERNAME = "Amyuni PDF Converter"
' Declare a new cdintfex object
Dim PDF
Set PDF = CreateObject("CDIntfEx.CDIntfEx.6.5")
' Get a reference to the installed printer.
' This will fail if the printer name passed to the DriverInit method is
' not found in the printer’s folder
PDF.DriverInit AMYUNIPRINTERNAME
' The SetDefaultPrinter function sets the system default printer to the one
' initialized by the DriverInit functions.
PDF.SetDefaultPrinter
' The EnablePrinter() method needs to be called right before each print job.
' and before the configuration
' Calling the EnablePrinter() method will start a 20 second time-out value
PDF.EnablePrinter strLicenseTo, strActivationCode
' Resulting PDF document stored here
PDF.DefaultDirectory = "C:\Temp"
' Set Printer options
PDF.FileNameOptionsEx = NoPrompt Or EmbedFonts Or MultilingualSupport Or EmbedStandardFonts Or EmbedLicensedFonts
' Set Image conversion options
' IO_COMPRESSJBIG2 It cannot be used with PDF/A standard
PDF.ImageOptions = IO_OUTPUTPDFA8 Or IO_XMPMETADATA
' Set parameters for PDF/A-1b
Dim part
part = 1 ' part = 1
Dim conformance
conformance = Asc("B") ' Conformance "Level B"
PDF.SetPrinterParamInt "PDFALevel", 256 * conformance Or part
' Apply Settings
PDF.SetDefaultConfig
' The BatchConvert method converts a number of files to PDF.
PDF.BatchConvert "C:\Temp\*.docx"
' The RestoreDefaultPrinter function resets the system default printer
' to the printer that was the default before the call to SetDefaultPrinter.
PDF.RestoreDefaultPrinter
' This function will simply detach from an existing printer because the handle was created using DriverInit
PDF.DriverEnd
' Destroy object
Set Set PDF = Nothing
<Flags()>
Public Enum acImageOptions As Integer
IO_NODUPLICATES = &H1
IO_DOWNSAMPLE = &H2
IO_CONVERTTOCMYK = &H4
IO_OUTPUTPDFA = &H8
IO_XMPMETADATA = &H10
IO_OUTPUTPDFA8 = &H20
IO_NOPRECOMPRESSED = &H40
IO_OUTPUTPDFX1 = &H80
IO_OUTPUTPDFX3 = &H100
IO_COMPRESSJBIG2 = &H200 ' Allowed Only with PDF/A-1 and PDF/A-3
IO_ENABLEEPS = &H40000000
IO_SIMPOSTSCRIPT = &H80000000
End Enum
<Flags()>
Public Enum acFileNameOptions As Integer
' Please check FileNameOptions for the complete version of the flags
NoPrompt = &H1
UseFileName = &H2
Concatenate = &H4
DisableCompression = &H8
EmbedFonts = &H10
BroadcastMessages = &H20
PrintWatermark = &H40
MultilingualSupport = &H80
EncryptDocument = &H100 ' It cannot be used with PDF/A standard
EmbedStandardFonts = &H200000
EmbedLicensedFonts = &H400000
Jpeg2000Compression = &H1000000 ' Allowed Only with PDF/A-3
EncryptDocument128 = &H40000000 ' It cannot be used with PDF/A standard
End Enum
Sub Sample()
' Constants for Activation codes
Const strLicenseTo As String = "Amyuni PDF Converter Evaluation"
Const strActivationCode As String = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
Const AMYUNIPRINTERNAME As String = "Amyuni PDF Converter"
' Declare a new cdintfex object if it does not exist in the form.
Dim PDF As New CDIntfEx.CDIntfEx
' Get a reference to the installed printer.
' This will fail if the printer name passed to the DriverInit method is
' not found in the printer’s folder
PDF.DriverInit(AMYUNIPRINTERNAME)
' The SetDefaultPrinter function sets the system default printer to the one
' initialized by the DriverInit functions.
PDF.SetDefaultPrinter()
' The EnablePrinter() method needs to be called right before each print job.
' and before the configuration
' Calling the EnablePrinter() method will start a 20 second time-out value
PDF.EnablePrinter(strLicenseTo, strActivationCode)
' Resulting PDF document stored here
PDF.DefaultDirectory = "C:\Temp"
' Set Printer options
PDF.FileNameOptionsEx = acFileNameOptions.NoPrompt Or acFileNameOptions.EmbedFonts _
Or acFileNameOptions.MultilingualSupport Or acFileNameOptions.EmbedStandardFonts _
Or acFileNameOptions.EmbedLicensedFonts
' Set Image conversion options
' IO_COMPRESSJBIG2 It cannot be used with PDF/A standard
PDF.ImageOptions = acImageOptions.IO_OUTPUTPDFA8 Or acImageOptions.IO_XMPMETADATA
' Set parameters for PDF/A-1a
Dim part As Integer = 1 ' part = 1
Dim conformance As Integer = Asc("A") ' Conformance "Level A"
PDF.SetPrinterParamInt("PDFALevel", conformance << 8 Or part)
' Apply Settings
PDF.SetDefaultConfig()
' The BatchConvert method converts a number of files to PDF.
PDF.BatchConvert("C:\Temp\test.doc")
' The RestoreDefaultPrinter function resets the system default printer
' to the printer that was the default before the call to SetDefaultPrinter.
PDF.RestoreDefaultPrinter()
' This function will simply detach from an existing printer because the handle was created using DriverInit
PDF.DriverEnd()
' Declare a new Document object
Dim pdfDoc As New CDIntfEx.Document
' The SetLicenseKey method should be called after creating an object of type
' CDIntfEx.Document to activate the advanced methods that require the object
' activation code to work properly
pdfDoc.SetLicenseKey(strLicenseTo, strActivationCode)
' Open the PDF/A file with Document Object
pdfDoc.Open("C:\Temp\test.pdf")
' This code adds a structure type of CHAP and assign it a name
pdfDoc.SetMarkedContent(1, 0, 0, 0, 0, "/S /Chap1 /Alt (Hello)", "/Author (Amyuni)")
pdfDoc.SetMarkedContent(2, 0, 0, 0, 0, "/S /Chap2", "/Author (Amyuni)")
pdfDoc.SetMarkedContent(3, 0, 0, 0, 0, "/S /Chap3", "/Author (Amyuni)")
' Save the File
pdfDoc.Save("C:\Temp\test.pdf")
End Sub
[Flags]
public enum acImageOptions
{
IO_NODUPLICATES = 0x00000001,
IO_DOWNSAMPLE = 0x00000002,
IO_CONVERTTOCMYK = 0x00000004,
IO_OUTPUTPDFA = 0x00000008,
IO_XMPMETADATA = 0x00000010,
IO_OUTPUTPDFA8 = 0x00000020,
IO_NOPRECOMPRESSED = 0x00000040,
IO_OUTPUTPDFX1 = 0x00000080,
IO_OUTPUTPDFX3 = 0x00000100,
IO_COMPRESSJBIG2 = 0x00000200, // Allowed Only with PDF/A-1 and PDF/A-3
IO_ENABLEEPS = 0x40000000,
IO_SIMPOSTSCRIPT = unchecked((int)0x80000000)
}
[Flags]
public enum acFileNameOptions
{
// Please check FileNameOptions for the complete version of the flags
NoPrompt = 0x00000001,
UseFileName = 0x00000002,
Concatenate = 0x00000004,
DisableCompression = 0x00000008,
EmbedFonts = 0x00000010,
BroadcastMessages = 0x00000020,
PrintWatermark = 0x00000040,
MultilingualSupport = 0x00000080,
EncryptDocument = 0x00000100, // It cannot be used with PDF/A standard
EmbedStandardFonts = 0x00200000,
EmbedLicensedFonts = 0x00400000,
Jpeg2000Compression = 0x01000000, // Allowed Only with PDF/A-3
EncryptDocument128 = 0x40000000 // It cannot be used with PDF/A standard
}
static void Sample()
{
// Constants for Activation codes
const string strLicenseTo = "Amyuni PDF Converter Evaluation";
const string strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";
const string AMYUNIPRINTERNAME = "Amyuni PDF Converter";
// Declare a new cdintfex object if it does not exist in the form.
CDIntfEx.CDIntfEx PDF = new CDIntfEx.CDIntfEx();
// Get a reference to the installed printer.
// This will fail if the printer name passed to the DriverInit method is
// not found in the printer’s folder
PDF.DriverInit(AMYUNIPRINTERNAME);
// The SetDefaultPrinter function sets the system default printer to the one
// initialized by the DriverInit functions.
PDF.SetDefaultPrinter();
// The EnablePrinter() method needs to be called right before each print job.
// and before the configuration
// Calling the EnablePrinter() method will start a 20 second time-out value
PDF.EnablePrinter(strLicenseTo, strActivationCode);
// Resulting PDF document stored here
PDF.DefaultDirectory = @"C:\Temp";
// Set Printer options
PDF.FileNameOptionsEx = (int)(acFileNameOptions.NoPrompt | acFileNameOptions.EmbedFonts
| acFileNameOptions.MultilingualSupport | acFileNameOptions.EmbedStandardFonts
| acFileNameOptions.EmbedLicensedFonts);
// Set Image conversion options
// IO_COMPRESSJBIG2 It cannot be used with PDF/A standard
PDF.ImageOptions= (int)(acImageOptions.IO_OUTPUTPDFA8 | acImageOptions.IO_XMPMETADATA);
// Set parameters for PDF/A-1a
int part = 1; // part = 1
int conformance = ' A' ; // Conformance "Level A"
PDF.SetPrinterParamInt("PDFALevel", conformance << 8 | part);
// Apply Settings
PDF.SetDefaultConfig();
// The BatchConvert method converts a number of files to PDF.
PDF.BatchConvert(@"C:\Temp\*.docx");
// The RestoreDefaultPrinter function resets the system default printer
// to the printer that was the default before the call to SetDefaultPrinter.
PDF.RestoreDefaultPrinter();
// This function will simply detach from an existing printer because the handle was created using DriverInit
PDF.DriverEnd();
// Declare a new Document object
CDIntfEx.Document pdfDoc = new CDIntfEx.Document();
// The SetLicenseKey method should be called after creating an object of type
// CDIntfEx.Document to activate the advanced methods that require the object
// activation code to work properly
pdfDoc.SetLicenseKey(strLicenseTo, strActivationCode);
// Open the PDF/A file with Document Object
pdfDoc.Open(@"C:\Temp\test.pdf");
// This code adds a structure type of CHAP and assign it a name
pdfDoc.SetMarkedContent(1, 0, 0, 0, 0, "/S /Chap1 /Alt (Hello)", "/Author (Amyuni)");
pdfDoc.SetMarkedContent(2, 0, 0, 0, 0, "/S /Chap2", "/Author (Amyuni)");
pdfDoc.SetMarkedContent(3, 0, 0, 0, 0, "/S /Chap3", "/Author (Amyuni)");
// Save the File
pdfDoc.Save(@"C:\Temp\test.pdf");
}
// PDF Converter Cpp.cpp : Defines the entry point for the console application.
//
# include <Windows.h>
# include <string>
# include <iostream>
# include "CdIntf.h"
# pragma comment (lib, "CDIntf.lib")
using namespace std;
int main()
{
// Constants for Activation codes
# define strLicenseTo "Amyuni PDF Converter Evaluation"
# define strActivationCode "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
# define AMYUNIPRINTERNAME "Amyuni PDF Converter"
// Get a reference to the installed printer.
// This will fail if the printer name passed to the DriverInit method is
// not found in the printer’s folder
HANDLE PDF = DriverInit(AMYUNIPRINTERNAME);
// The CDISetDefaultPrinter function sets the system default printer to the one
// initialized by the DriverInit functions.
CDISetDefaultPrinter(PDF);
// The EnablePrinter() method needs to be called right before each print job.
// and before the configuration
// Calling the EnablePrinter() method will start a 20 second time-out value
EnablePrinter(PDF, strLicenseTo, strActivationCode);
// Resulting PDF document stored here
SetDefaultDirectory(PDF, "C:\temp");
// Set Printer options
// EncryptDocument, Jpeg2000Compression nor EncryptDocument128 cannot be used with PDF/A standard
SetFileNameOptions(PDF, NoPrompt | EmbedFonts | MultilingualSupport | EmbedStandardFonts | EmbedLicensedFonts | FullEmbed);
// Set Image conversion options
// IO_COMPRESSJBIG2 It cannot be used with PDF/A standard
SetImageOptions(PDF, IO_OUTPUTPDFA8 | IO_XMPMETADATA);
// Set parameters for PDF/A-1a
int part = 1; // part = 1
int conformance = ' A' ; // Conformance "Level A"
SetPrinterParamInt(PDF, "PDFALevel", conformance << 8 | part);
// Apply Settings
SetDefaultConfig(PDF);
// The BatchConvert method converts a number of files to PDF.
BatchConvertEx(PDF, "C:\temp\\test.doc");
// The RestoreDefaultPrinter function resets the system default printer
// to the printer that was the default before the call to SetDefaultPrinter.
RestoreDefaultPrinter(PDF);
// This function will simply detach from an existing printer because the handle was created using DriverInit
DriverEnd(PDF);
// Destroy PDF object
PDF = nullptr;
// Declare a new Document object
EXTDOCHANDLE pdfDoc;
// The SetLicenseKey method should be called after creating an object of type
// CDIntfEx.Document to activate the advanced methods that require the object
// activation code to work properly
SetLicenseKeyA(strLicenseTo, strActivationCode);
// Open the PDF/A file with Document Object
LPBYTE passWord = nullptr;
DocOpenA(&pdfDoc, "C:\temp\\test.pdf", passWord);
// This code adds a structure type of CHAP and assign it a name
DocSetMarkedContentA(pdfDoc, 1, 0, 0, 0, 0, "/S /Chap1 /Alt (Hello)", "/Author (Amyuni)");
DocSetMarkedContentA(pdfDoc, 2, 0, 0, 0, 0, "/S /Chap2", "/Author (Amyuni)");
DocSetMarkedContentA(pdfDoc, 3, 0, 0, 0, 0, "/S /Chap3", "/Author (Amyuni)");
// Save the document
DocSaveA(pdfDoc, "C:\temp\\test.pdf");
// Destroy pdfDoc object
DocClose(pdfDoc);
pdfDoc = nullptr;
return 0;
}
package Example;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
public class PDFAsupport2 {
public enum acImageOptions
{
IO_NODUPLICATES(0x00000001),
IO_DOWNSAMPLE(0x00000002),
IO_CONVERTTOCMYK(0x00000004),
IO_OUTPUTPDFA(0x00000008),
IO_XMPMETADATA(0x00000010),
IO_OUTPUTPDFA8(0x00000020),
IO_NOPRECOMPRESSED(0x00000040),
IO_OUTPUTPDFX1(0x00000080),
IO_OUTPUTPDFX3(0x00000100),
IO_COMPRESSJBIG2(0x00000100), // Allowed Only with PDF/A-1 and PDF/A-3
IO_SIMPOSTSCRIPT(0x80000000);
private int value;
private acImageOptions(int value)
{
this.value = value;
}
public Object value(){
return value;
}
}
public enum acFileNameOptions
{
// Please check FileNameOptions for the complete version of the flags
NoPrompt(0x00000001),
UseFileName(0x00000002),
Concatenate(0x00000004),
DisableCompression(0x00000008),
EmbedFonts(0x00000010),
BroadcastMessages(0x00000020),
PrintWatermark(0x00000040),
MultilingualSupport(0x00000080),
EncryptDocument(0x00000100), // It cannot be used for PDF/A creation
EmbedStandardFonts(0x00200000),
EmbedLicensedFonts(0x00400000),
Jpeg2000Compression(0x01000000), // Allowed Only with PDF/A-3
EncryptDocument128(0x40000000); // It cannot be used for PDF/A creation
private int value;
private acFileNameOptions(int value)
{
this.value = value;
}
public Object value(){
return value;
} }
public static void main(String[] args)
{
// Constants for Activation codes
String strLicenseTo = "Amyuni PDF Converter Evaluation";
String strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";
String AMYUNIPRINTERNAME = "Amyuni PDF Converter";
// Declare a new cdintfex object if it doesn' t exist in the form.
ActiveXComponent pdf = new ActiveXComponent("CDIntfEx.CDIntfEx.6.5");
// Get a reference to the installed printer.
// This will fail if the printer name passed to the DriverInit method is
// not found in the printer’s folder
Dispatch.call(pdf,"DriverInit",AMYUNIPRINTERNAME);
// The SetDefaultPrinter function sets the system default printer to the one
// initialized by the DriverInit functions.
Dispatch.call(pdf,"SetDefaultPrinter");
// The EnablePrinter() method needs to be called right before each print job.
// and before the configuration
// Calling the EnablePrinter() method will start a 20 second time-out value
Dispatch.call(pdf,"EnablePrinter", strLicenseTo, strActivationCode);
// Resulting PDF document stored here
Dispatch.put(pdf,"DefaultDirectory","C:\temp");
// Set Printer options
Dispatch.put(pdf,"FileNameOptionsEx",acFileNameOptions.NoPrompt.value | acFileNameOptions.EmbedFonts.value
| acFileNameOptions.MultilingualSupport.value | acFileNameOptions.EmbedStandardFonts.value
| acFileNameOptions.EmbedLicensedFonts.value);
// Set Image conversion options
// IO_COMPRESSJBIG2 It cannot be used with PDF/A standard
Dispatch.call(pdf, "ImageOptions", acImageOptions.IO_OUTPUTPDFA8.value | acImageOptions.IO_XMPMETADATA.value);
// Set parameters for PDF/A-1a
int part = 1; // part = 1
int conformance = ' A' ; // Conformance "Level A"
Dispatch.call(pdf, "SetPrinterParamInt", "PDFALevel", conformance << 8 | part);
// Apply Settings
Dispatch.call(pdf, "SetDefaultConfig");
// The BatchConvert method converts a number of files to PDF.
Dispatch.call(pdf,"BatchConvert","C:\temp\\test.doc");
// The RestoreDefaultPrinter function resets the system default printer
// to the printer that was the default before the call to SetDefaultPrinter.
Dispatch.call(pdf,"RestoreDefaultPrinter");
// Close Printer
Dispatch.call(pdf,"DriverEnd");
// Destroy PDF Object
pdf = null;
// Declare a new Document object
ActiveXComponent pdfDoc = new ActiveXComponent("CDIntfEx.Document.6.5");
// The SetLicenseKey method should be called after creating an object of type
// CDIntfEx.Document to activate the advanced methods that require the object
// activation code to work properly
Dispatch.call(pdfDoc, "SetLicenseKey", strLicenseTo, strActivationCode);
// Open the PDF/A file with Document Object
Dispatch.call(pdfDoc, "Open","C:\temp\\test.pdf");
// This code adds a structure type of CHAP and assign it a name
Dispatch.call(pdfDoc, "SetMarkedContent", 1, 0, 0, 0, 0, "/S /Chap1 /Alt (Hello)", "/Author (Amyuni)");
Dispatch.call(pdfDoc, "SetMarkedContent", 2, 0, 0, 0, 0, "/S /Chap2", "/Author (Amyuni)");
Dispatch.call(pdfDoc, "SetMarkedContent", 3, 0, 0, 0, 0, "/S /Chap3", "/Author (Amyuni)");
// Save the PDF/A-1A File
Dispatch.call(pdfDoc, "Save","C:\temp\\test.pdf");
// Destroy pdfDoc Object
pdfDoc = null;
}
}
$acImageOptions = @{
IO_NODUPLICATES = 0x00000001
IO_DOWNSAMPLE = 0x00000002
IO_CONVERTTOCMYK = 0x00000004
IO_OUTPUTPDFA = 0x00000008
IO_XMPMETADATA = 0x00000010
IO_OUTPUTPDFA8 = 0x00000020
IO_NOPRECOMPRESSED = 0x00000040
IO_OUTPUTPDFX1 = 0x00000080
IO_OUTPUTPDFX3 = 0x00000100
IO_COMPRESSJBIG2 = 0x00000200 #Allowed Only with PDF/A-1 and PDF/A-3
IO_ENABLEEPS = 0x40000000
IO_SIMPOSTSCRIPT = 0x80000000
}
# Please check FileNameOptions for the complete version of the flags
$acFileNameOptions = @{
NoPrompt = 0x00000001
UseFileName = 0x00000002
Concatenate = 0x00000004
DisableCompression = 0x00000008
EmbedFonts = 0x00000010
BroadcastMessages = 0x00000020
PrintWatermark = 0x00000040
MultilingualSupport = 0x00000080
EncryptDocument = 0x00000100 # It cannot be used with PDF/A standard
EmbedStandardFonts = 0x00200000
EmbedLicensedFonts = 0x00400000
Jpeg2000Compression = 0x01000000 #Allowed Only with PDF/A-3
EncryptDocument128 = 0x40000000 # It cannot be used with PDF/A standard
}
# Constants for Activation codes
$strLicenseTo = "Amyuni PDF Converter Evaluation"
$strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
$AMYUNIPRINTERNAME = "Amyuni PDF Converter"
# Declare a new cdintfex object if it doesn' t exist in the form.
$PDF = New-Object -ComObject CDIntfEx.CDIntfEx.6.5
# Get a reference to the installed printer.
# This will fail if the printer name passed to the DriverInit method is
# not found in the printer’s folder
[System.__ComObject].InvokeMember('DriverInit', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$AMYUNIPRINTERNAME)
# The SetDefaultPrinter function sets the system default printer to the one
# initialized by the DriverInit functions.
[System.__ComObject].InvokeMember('SetDefaultPrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null)
# The EnablePrinter()method needs to be called right before each print job.
# and before the configuration
# Calling the EnablePrinter()method will start a 20 second time-out value
[System.__ComObject].InvokeMember('EnablePrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, @($strLicenseTo, $strActivationCode))
# Resulting PDF document stored here
[System.__ComObject].InvokeMember('DefaultDirectory', [System.Reflection.BindingFlags]::SetProperty,$null,$PDF,"C:/Temp")
# Set Printer options
[System.__ComObject].InvokeMember('FileNameOptionsEx', [System.Reflection.BindingFlags]::SetProperty,$null,$PDF,$acFileNameOptions::NoPrompt `
-bOr $acFileNameOptions::EmbedFonts -bOr $acFileNameOptions::MultilingualSupport -bOr $acFileNameOptions::EmbedStandardFonts `
-bOr $acFileNameOptions::EmbedLicensedFonts)
# Set Image conversion options
# IO_COMPRESSJBIG2 It cannot be used with PDF/A standard
[System.__ComObject].InvokeMember('ImageOptions', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, @($acImageOptions::IO_OUTPUTPDFA8 -bOr $acImageOptions::IO_XMPMETADATA))
# Set parameters for PDF/A-1a
$part = 1 #part = 1
$conformance = [byte][char] "A" #Conformance "Level A"
$PDFALevel = (1 -shl 8)*$conformance -bOr $part
[System.__ComObject].InvokeMember('SetPrinterParamInt', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, @("PDFALevel", $PDFALevel))
# Apply Settings
[System.__ComObject].InvokeMember('SetDefaultConfig', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, $null)
# The BatchConvert method converts a number of files to PDF.
[System.__ComObject].InvokeMember('BatchConvert', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, "C:\Temp\test.doc")
# The RestoreDefaultPrinter function resets the system default printer
# to the printer that was the default before the call to SetDefaultPrinter.
[System.__ComObject].InvokeMember('RestoreDefaultPrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null)
# This function will simply detach from an existing printer because the handle was created using DriverInit
[System.__ComObject].InvokeMember('DriverEnd', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null)
# Destroy Object
$PDF = $null
# Declare a new Document object
$pdfDoc = New-Object -ComObject CDIntfEx.Document.6.5
# The SetLicenseKey method should be called after creating an object of type
# CDIntfEx.Document to activate the advanced methods that require the object
# activation code to work properly
[System.__ComObject].InvokeMember('SetLicenseKey', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc, @($strLicenseTo, $strActivationCode))
# Open the PDF/A file with Document Object
[System.__ComObject].InvokeMember('Open', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc, "C:\Temp\test.pdf")
# This code adds a structure of CHAP and assing it a name
[System.__ComObject].InvokeMember('SetMarkedContent', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc, @(1, 0, 0, 0, 0, "/S /Chap1 /Alt (Hello)", "/Author (Amyuni)"))
[System.__ComObject].InvokeMember('SetMarkedContent', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc, @(2, 0, 0, 0, 0, "/S /Chap2", "/Author (Amyuni)"))
[System.__ComObject].InvokeMember('SetMarkedContent', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc, @(3, 0, 0, 0, 0, "/S /Chap3", "/Author (Amyuni)"))
# Save the PDF/A-1A File
[System.__ComObject].InvokeMember('Save', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc, "C:\Temp\test.pdf")
# Destroy Object
$docPdf = $null
' ImageOptions Constants
Const IO_NODUPLICATES = &H1
Const IO_DOWNSAMPLE = &H2
Const IO_CONVERTTOCMYK = &H4
Const IO_OUTPUTPDFA = &H8
Const IO_XMPMETADATA = &H10
Const IO_OUTPUTPDFA8 = &H20
Const IO_NOPRECOMPRESSED = &H40
Const IO_OUTPUTPDFX1 = &H80
Const IO_OUTPUTPDFX3 = &H100
Const IO_COMPRESSJBIG2 = &H200 ' Allowed Only with PDF/A-1 and PDF/A-3
Const IO_ENABLEEPS = &H40000000
Const IO_SIMPOSTSCRIPT = &H80000000
' FileNameOptions constants
' Please check FileNameOptions for the complete version of the flags
NoPrompt = &H1
UseFileName = &H2
Concatenate = &H4
DisableCompression = &H8
EmbedFonts = &H10
BroadcastMessages = &H20
PrintWatermark = &H40
MultilingualSupport = &H80
EncryptDocument = &H100 ' It cannot be used with PDF/A standard
EmbedStandardFonts = &H200000
EmbedLicensedFonts = &H400000
Jpeg2000Compression = &H1000000 ' Allowed Only with PDF/A-3
EncryptDocument128 = &H40000000 ' It cannot be used with PDF/A standard
' Constants for Activation codes
Const strLicenseTo = "Amyuni PDF Converter Evaluation"
Const strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
Const AMYUNIPRINTERNAME = "Amyuni PDF Converter"
' Declare a new cdintfex object
Dim PDF
Set PDF = CreateObject("CDIntfEx.CDIntfEx.6.5")
' Get a reference to the installed printer.
' This will fail if the printer name passed to the DriverInit method is
' not found in the printer’s folder
PDF.DriverInit AMYUNIPRINTERNAME
' The SetDefaultPrinter function sets the system default printer to the one
' initialized by the DriverInit functions.
PDF.SetDefaultPrinter
' The EnablePrinter() method needs to be called right before each print job.
' and before the configuration
' Calling the EnablePrinter() method will start a 20 second time-out value
PDF.EnablePrinter strLicenseTo, strActivationCode
' Resulting PDF document stored here
PDF.DefaultDirectory = "C:\Temp"
' Set Printer options
PDF.FileNameOptionsEx = NoPrompt Or EmbedFonts Or MultilingualSupport Or EmbedStandardFonts Or EmbedLicensedFonts
' Set Image conversion options
' IO_COMPRESSJBIG2 It cannot be used with PDF/A standard
PDF.ImageOptions = IO_OUTPUTPDFA8 Or IO_XMPMETADATA
' Set parameters for PDF/A-1a
Dim part
part = 1 ' part = 1
Dim conformance
conformance = Asc("A") ' Conformance "Level A"
PDF.SetPrinterParamInt "PDFALevel", 256 * conformance Or part
' Apply Settings
PDF.SetDefaultConfig
' The BatchConvert method converts a number of files to PDF.
PDF.BatchConvert "C:\Temp\test.doc"
' The RestoreDefaultPrinter function resets the system default printer
' to the printer that was the default before the call to SetDefaultPrinter.
PDF.RestoreDefaultPrinter
' This function will simply detach from an existing printer because the handle was created using DriverInit
PDF.DriverEnd
' Destroy object
Set PDF = Nothing
' Declare a new Document object
Dim pdfDoc
Set pdfDoc = CreateObject("CDIntfEx.Document.6.5")
' The SetLicenseKey method should be called after creating an object of type
' CDIntfEx.Document to activate the advanced methods that require the object
' activation code to work properly
pdfDoc.SetLicenseKey strLicenseTo, strActivationCode
' Open the PDF/A file with Document Object
pdfDoc.Open "C:\Temp\test.pdf"
' This code adds a structure type of CHAP and assign it a name
pdfDoc.SetMarkedContent 1, 0, 0, 0, 0, "/S /Chap1 /Alt (Hello)", "/Author (Amyuni)"
pdfDoc.SetMarkedContent 2, 0, 0, 0, 0, "/S /Chap2", "/Author (Amyuni)"
pdfDoc.SetMarkedContent 3, 0, 0, 0, 0, "/S /Chap3", "/Author (Amyuni)"
' Save the File
pdfDoc.Save("C:\Temp\test.pdf")
' Destroy object
Set pdfDoc = Nothing
The Evaluation License adds a watermark which breaks the PDF/A specification. Only the Full License will give you a proper PDF/A file.
<Flags()>
Public Enum acImageOptions As Integer
IO_NODUPLICATES = &H1
IO_DOWNSAMPLE = &H2
IO_CONVERTTOCMYK = &H4
IO_OUTPUTPDFA = &H8
IO_XMPMETADATA = &H10
IO_OUTPUTPDFA8 = &H20
IO_NOPRECOMPRESSED = &H40
IO_OUTPUTPDFX1 = &H80
IO_OUTPUTPDFX3 = &H100
IO_COMPRESSJBIG2 = &H200 ' Allowed Only with PDF/A-1 and PDF/A-3
IO_ENABLEEPS = &H40000000
IO_SIMPOSTSCRIPT = &H80000000
End Enum
<Flags()>
Public Enum acFileNameOptions As Integer
' Please check FileNameOptions for the complete version of the flags
NoPrompt = &H1
UseFileName = &H2
Concatenate = &H4
DisableCompression = &H8
EmbedFonts = &H10
BroadcastMessages = &H20
PrintWatermark = &H40
MultilingualSupport = &H80
EncryptDocument = &H100 ' It cannot be used with PDF/A standard
EmbedStandardFonts = &H200000
EmbedLicensedFonts = &H400000
Jpeg2000Compression = &H1000000 ' Allowed Only with PDF/A-3
EncryptDocument128 = &H40000000 ' It cannot be used with PDF/A standard
End Enum
Sub Sample()
' Constants for Activation codes
Const strLicenseTo As String = "Amyuni PDF Converter Evaluation"
Const strActivationCode As String = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
Const AMYUNIPRINTERNAME As String = "Amyuni PDF Converter"
' Declare a new cdintfex object if it does not exist in the form.
Dim PDF As New CDIntfEx.CDIntfEx
' Get a reference to the installed printer.
' This will fail if the printer name passed to the DriverInit method is
' not found in the printer’s folder
PDF.DriverInit(AMYUNIPRINTERNAME)
' The SetDefaultPrinter function sets the system default printer to the one
' initialized by the DriverInit functions.
PDF.SetDefaultPrinter()
' The EnablePrinter() method needs to be called right before each print job.
' and before the configuration
' Calling the EnablePrinter() method will start a 20 second time-out value
PDF.EnablePrinter(strLicenseTo, strActivationCode)
' Resulting PDF document stored here
PDF.DefaultDirectory = "C:\Temp"
' Set Printer options
PDF.FileNameOptionsEx = acFileNameOptions.NoPrompt Or acFileNameOptions.EmbedFonts _
Or acFileNameOptions.MultilingualSupport Or acFileNameOptions.EmbedStandardFonts _
Or acFileNameOptions.EmbedLicensedFonts
' Set Image conversion options
' IO_COMPRESSJBIG2 It cannot be used with PDF/A standard
PDF.ImageOptions = acImageOptions.IO_OUTPUTPDFA8 Or acImageOptions.IO_XMPMETADATA
' Set parameters for PDF/A-3b
Dim part As Integer = 3 ' part = 3
Dim conformance As Integer = Asc("B") ' Conformance "Level B"
PDF.SetPrinterParamInt("PDFALevel", conformance << 8 Or part)
' Apply Settings
PDF.SetDefaultConfig()
' The BatchConvert method converts a number of files to PDF.
PDF.BatchConvert("C:\Temp\test.doc")
' The RestoreDefaultPrinter function resets the system default printer
' to the printer that was the default before the call to SetDefaultPrinter.
PDF.RestoreDefaultPrinter()
' This function will simply detach from an existing printer because the handle was created using DriverInit
PDF.DriverEnd()
' Declare a new cdintfex document if it does not exist in the form.
Dim pdfDoc As New CDIntfEx.Document
' The SetLicenseKey method should be called after creating an object of type
' CDIntfEx.Document to activate the advanced methods that require the object
' activation code to work properly
pdfDoc.SetLicenseKey(strLicenseTo, strActivationCode)
' Open the document
pdfDoc.Open("C:\Temp\test.pdf")
' Add files attachments to the current document
pdfDoc.AddFileAttachmentEx("photo.jpg", "c:\temp\photo.jpg", "Portrait Photo", "image/jpeg", "Alternative")
' Save the PDF/A-3b File with attachments
pdfDoc.Save("C:\Temp\test.pdf")
End Sub
[Flags]
public enum acImageOptions
{
IO_NODUPLICATES = 0x00000001,
IO_DOWNSAMPLE = 0x00000002,
IO_CONVERTTOCMYK = 0x00000004,
IO_OUTPUTPDFA = 0x00000008,
IO_XMPMETADATA = 0x00000010,
IO_OUTPUTPDFA8 = 0x00000020,
IO_NOPRECOMPRESSED = 0x00000040,
IO_OUTPUTPDFX1 = 0x00000080,
IO_OUTPUTPDFX3 = 0x00000100,
IO_COMPRESSJBIG2 = 0x00000200, // Allowed Only with PDF/A-1 and PDF/A-3
IO_ENABLEEPS = 0x40000000,
IO_SIMPOSTSCRIPT = unchecked((int)0x80000000)
}
[Flags]
public enum acFileNameOptions
{
// Please check FileNameOptions for the complete version of the flags
NoPrompt = 0x00000001,
UseFileName = 0x00000002,
Concatenate = 0x00000004,
DisableCompression = 0x00000008,
EmbedFonts = 0x00000010,
BroadcastMessages = 0x00000020,
PrintWatermark = 0x00000040,
MultilingualSupport = 0x00000080,
EncryptDocument = 0x00000100, // It cannot be used with PDF/A standard
EmbedStandardFonts = 0x00200000,
EmbedLicensedFonts = 0x00400000,
Jpeg2000Compression = 0x01000000, // Allowed Only with PDF/A-3
EncryptDocument128 = 0x40000000 // It cannot be used with PDF/A standard
}
static void Main()
{
// Constants for Activation codes
const string strLicenseTo = "Amyuni PDF Converter Evaluation";
const string strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";
const string AMYUNIPRINTERNAME = "Amyuni PDF Converter";
// Declare a new cdintfex object if it does not exist in the form.
CDIntfEx.CDIntfEx PDF = new CDIntfEx.CDIntfEx();
// Get a reference to the installed printer.
// This will fail if the printer name passed to the DriverInit method is
// not found in the printer’s folder
PDF.DriverInit(AMYUNIPRINTERNAME);
// The SetDefaultPrinter function sets the system default printer to the one
// initialized by the DriverInit functions.
PDF.SetDefaultPrinter();
// The EnablePrinter() method needs to be called right before each print job.
// and before the configuration
// Calling the EnablePrinter() method will start a 20 second time-out value
PDF.EnablePrinter(strLicenseTo, strActivationCode);
// Resulting PDF document stored here
PDF.DefaultDirectory = @"C:\Temp";
// Set Printer options
PDF.FileNameOptionsEx = (int)(acFileNameOptions.NoPrompt | acFileNameOptions.EmbedFonts
| acFileNameOptions.MultilingualSupport | acFileNameOptions.EmbedStandardFonts
| acFileNameOptions.EmbedLicensedFonts);
// Set Image conversion options
// IO_COMPRESSJBIG2 It cannot be used with PDF/A standard
PDF.ImageOptions= (int)(acImageOptions.IO_OUTPUTPDFA8 | acImageOptions.IO_XMPMETADATA);
// Set parameters for PDF/A-3b
int part = 3; // part = 1
int conformance = ' B' ; // Conformance "Level A"
PDF.SetPrinterParamInt("PDFALevel", conformance << 8 | part);
// Apply Settings
PDF.SetDefaultConfig();
// The BatchConvert method converts a number of files to PDF.
PDF.BatchConvert(@"C:\Temp\test.doc");
// The RestoreDefaultPrinter function resets the system default printer
// to the printer that was the default before the call to SetDefaultPrinter.
PDF.RestoreDefaultPrinter();
// This function will simply detach from an existing printer because the handle was created using DriverInit
PDF.DriverEnd();
// Declare a new Document object
CDIntfEx.Document pdfDoc = new CDIntfEx.Document();
// The SetLicenseKey method should be called after creating an object of type
// CDIntfEx.Document to activate the advanced methods that require the object
// activation code to work properly
pdfDoc.SetLicenseKey(strLicenseTo, strActivationCode);
// Open the PDF/A file with Document Object
pdfDoc.Open(@"C:\Temp\test.pdf");
// Add files attachments to the current document
pdfDoc.AddFileAttachmentEx("photo.jpg", "C:\temp\\photo.jpg", "Portrait Photo", "image/jpeg", "Alternative");
// Save the PDF/A-3b File with attachments
pdfDoc.Save(@"C:\Temp\test.pdf");
}
// PDF Converter Cpp.cpp : Defines the entry point for the console application.
//
# include <Windows.h>
# include <string>
# include <iostream>
# include "CdIntf.h"
# pragma comment (lib, "CDIntf.lib")
using namespace std;
int main()
{
// Constants for Activation codes
# define strLicenseTo "Amyuni PDF Converter Evaluation"
# define strActivationCode "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
# define AMYUNIPRINTERNAME "Amyuni PDF Converter"
// Get a reference to the installed printer.
// This will fail if the printer name passed to the DriverInit method is
// not found in the printer’s folder
HANDLE PDF = DriverInit(AMYUNIPRINTERNAME);
// The CDISetDefaultPrinter function sets the system default printer to the one
// initialized by the DriverInit functions.
CDISetDefaultPrinter(PDF);
// The EnablePrinter() method needs to be called right before each print job.
// and before the configuration
// Calling the EnablePrinter() method will start a 20 second time-out value
EnablePrinter(PDF, strLicenseTo, strActivationCode);
// Resulting PDF document stored here
SetDefaultDirectory(PDF, "C:\temp");
// Set Printer options
// EncryptDocument, Jpeg2000Compression nor EncryptDocument128 cannot be used with PDF/A standard
SetFileNameOptions(PDF, NoPrompt | EmbedFonts | MultilingualSupport | EmbedStandardFonts | EmbedLicensedFonts | FullEmbed);
// Set Image conversion options
// IO_COMPRESSJBIG2 It cannot be used with PDF/A standard
SetImageOptions(PDF, IO_OUTPUTPDFA8 | IO_XMPMETADATA);
// Set parameters for PDF/A-3b
int part = 3; // part = 1
int conformance = ' B' ; // Conformance "Level B"
SetPrinterParamInt(PDF, "PDFALevel", conformance << 8 | part);
// Apply Settings
SetDefaultConfig(PDF);
// The BatchConvert method converts a number of files to PDF.
BatchConvertEx(PDF, "C:\temp\\test.doc");
// The RestoreDefaultPrinter function resets the system default printer
// to the printer that was the default before the call to SetDefaultPrinter.
RestoreDefaultPrinter(PDF);
// This function will simply detach from an existing printer because the handle was created using DriverInit
DriverEnd(PDF);
// Destroy PDF object
PDF = nullptr;
// Declare a new Document object
EXTDOCHANDLE pdfDoc;
// The SetLicenseKey method should be called after creating an object of type
// CDIntfEx.Document to activate the advanced methods that require the object
// activation code to work properly
SetLicenseKeyA(strLicenseTo, strActivationCode);
// Open the PDF/A file with Document Object
LPBYTE passWord = nullptr;
DocOpenA(&pdfDoc, "C:\temp\\test.pdf", passWord);
// Add files attachments to the current document
DocAddFileAttachmentExA(pdfDoc, "photo.jpg", "C:\temp\\photo.jpg", "Portrait Photo", "image/jpeg", "Alternative");
// Save the PDF/A-3b File with attachments
DocSaveA(pdfDoc, "C:\temp\\test.pdf");
// Destroy pdfDoc object
DocClose(pdfDoc);
pdfDoc = nullptr;
return 0;
}
package Example;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
public class PDFAsupport3 {
public enum acImageOptions
{
IO_NODUPLICATES(0x00000001),
IO_DOWNSAMPLE(0x00000002),
IO_CONVERTTOCMYK(0x00000004),
IO_OUTPUTPDFA(0x00000008),
IO_XMPMETADATA(0x00000010),
IO_OUTPUTPDFA8(0x00000020),
IO_NOPRECOMPRESSED(0x00000040),
IO_OUTPUTPDFX1(0x00000080),
IO_OUTPUTPDFX3(0x00000100),
IO_COMPRESSJBIG2(0x00000100), // Allowed Only with PDF/A-1 and PDF/A-3
IO_SIMPOSTSCRIPT(0x80000000);
private int value;
private acImageOptions(int value)
{
this.value = value;
}
public Object value(){
return value;
}
}
public enum acFileNameOptions
{
// Please check FileNameOptions for the complete version of the flags
NoPrompt(0x00000001),
UseFileName(0x00000002),
Concatenate(0x00000004),
DisableCompression(0x00000008),
EmbedFonts(0x00000010),
BroadcastMessages(0x00000020),
PrintWatermark(0x00000040),
MultilingualSupport(0x00000080),
EncryptDocument(0x00000100), // It cannot be used for PDF/A creation
EmbedStandardFonts(0x00200000),
EmbedLicensedFonts(0x00400000),
Jpeg2000Compression(0x01000000), // Allowed Only with PDF/A-3
EncryptDocument128(0x40000000); // It cannot be used for PDF/A creation
private int value;
private acFileNameOptions(int value)
{
this.value = value;
}
public Object value(){
return value;
} }
public static void main(String[] args)
{
// Constants for Activation codes
String strLicenseTo = "Amyuni PDF Converter Evaluation";
String strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";
String AMYUNIPRINTERNAME = "Amyuni PDF Converter";
// Declare a new cdintfex object if it doesn' t exist in the form.
ActiveXComponent pdf = new ActiveXComponent("CDIntfEx.CDIntfEx.6.5");
// Get a reference to the installed printer.
// This will fail if the printer name passed to the DriverInit method is
// not found in the printer’s folder
Dispatch.call(pdf,"DriverInit",AMYUNIPRINTERNAME);
// The SetDefaultPrinter function sets the system default printer to the one
// initialized by the DriverInit functions.
Dispatch.call(pdf,"SetDefaultPrinter");
// The EnablePrinter() method needs to be called right before each print job.
// and before the configuration
// Calling the EnablePrinter() method will start a 20 second time-out value
Dispatch.call(pdf,"EnablePrinter", strLicenseTo, strActivationCode);
// Resulting PDF document stored here
Dispatch.put(pdf,"DefaultDirectory","C:\temp");
// Set Printer options
Dispatch.put(pdf,"FileNameOptionsEx",acFileNameOptions.NoPrompt.value | acFileNameOptions.EmbedFonts.value
| acFileNameOptions.MultilingualSupport.value | acFileNameOptions.EmbedStandardFonts.value
| acFileNameOptions.EmbedLicensedFonts.value);
// Set Image conversion options
// IO_COMPRESSJBIG2 It cannot be used with PDF/A standard
Dispatch.call(pdf, "ImageOptions", acImageOptions.IO_OUTPUTPDFA8.value | acImageOptions.IO_XMPMETADATA.value);
// Set parameters for PDF/A-3b
int part = 3; // part = 3
int conformance = ' B' ; // Conformance "Level B"
Dispatch.call(pdf, "SetPrinterParamInt", "PDFALevel", conformance << 8 | part);
// Apply Settings
Dispatch.call(pdf, "SetDefaultConfig");
// The BatchConvert method converts a number of files to PDF.
Dispatch.call(pdf,"BatchConvert","C:\temp\\test.doc");
// The RestoreDefaultPrinter function resets the system default printer
// to the printer that was the default before the call to SetDefaultPrinter.
Dispatch.call(pdf,"RestoreDefaultPrinter");
// Close Printer
Dispatch.call(pdf,"DriverEnd");
// Destroy PDF Object
pdf = null;
// Declare a new Document object
ActiveXComponent pdfDoc = new ActiveXComponent("CDIntfEx.Document.6.5");
// The SetLicenseKey method should be called after creating an object of type
// CDIntfEx.Document to activate the advanced methods that require the object
// activation code to work properly
Dispatch.call(pdfDoc, "SetLicenseKey", strLicenseTo, strActivationCode);
// Open the PDF/A file with Document Object
Dispatch.call(pdfDoc, "Open","C:\temp\\test.pdf");
// Add files attachments to the current document
Dispatch.call(pdfDoc, "AddFileAttachmentEx", "photo.jpg", "C:\temp\\photo.jpg", "Portrait Photo", "image/jpeg", "Alternative");
// Save the PDF/A-3b File with attachments
Dispatch.call(pdfDoc, "Save","C:\temp\\test.pdf");
// Destroy PDF Object
pdfDoc = null;
}
}
$acImageOptions = @{
IO_NODUPLICATES = 0x00000001
IO_DOWNSAMPLE = 0x00000002
IO_CONVERTTOCMYK = 0x00000004
IO_OUTPUTPDFA = 0x00000008
IO_XMPMETADATA = 0x00000010
IO_OUTPUTPDFA8 = 0x00000020
IO_NOPRECOMPRESSED = 0x00000040
IO_OUTPUTPDFX1 = 0x00000080
IO_OUTPUTPDFX3 = 0x00000100
IO_COMPRESSJBIG2 = 0x00000200 # Allowed Only with PDF/A-1 and PDF/A-3
IO_ENABLEEPS = 0x40000000
IO_SIMPOSTSCRIPT = 0x80000000
}
# Please check FileNameOptions for the complete version of the flags
$acFileNameOptions = @{
NoPrompt = 0x00000001
UseFileName = 0x00000002
Concatenate = 0x00000004
DisableCompression = 0x00000008
EmbedFonts = 0x00000010
BroadcastMessages = 0x00000020
PrintWatermark = 0x00000040
MultilingualSupport = 0x00000080
EncryptDocument = 0x00000100 # It cannot be used with PDF/A standard
EmbedStandardFonts = 0x00200000
EmbedLicensedFonts = 0x00400000
Jpeg2000Compression = 0x01000000 # Allowed Only with PDF/A-3
EncryptDocument128 = 0x40000000 # It cannot be used with PDF/A standard
}
# Constants for Activation codes
$strLicenseTo = "Amyuni PDF Converter Evaluation"
$strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
$AMYUNIPRINTERNAME = "Amyuni PDF Converter"
# Declare a new cdintfex object if it doesn' t exist in the form.
$PDF = New-Object -ComObject CDIntfEx.CDIntfEx.6.5
# Get a reference to the installed printer.
# This will fail if the printer name passed to the DriverInit method is
# not found in the printer’s folder
[System.__ComObject].InvokeMember('DriverInit', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$AMYUNIPRINTERNAME)
# The SetDefaultPrinter function sets the system default printer to the one
# initialized by the DriverInit functions.
[System.__ComObject].InvokeMember('SetDefaultPrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null)
# The EnablePrinter()method needs to be called right before each print job.
# and before the configuration
# Calling the EnablePrinter()method will start a 20 second time-out value
[System.__ComObject].InvokeMember('EnablePrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, @($strLicenseTo, $strActivationCode))
# Resulting PDF document stored here
[System.__ComObject].InvokeMember('DefaultDirectory', [System.Reflection.BindingFlags]::SetProperty,$null,$PDF,"C:/Temp")
# Set Printer options
[System.__ComObject].InvokeMember('FileNameOptionsEx', [System.Reflection.BindingFlags]::SetProperty,$null,$PDF,$acFileNameOptions::NoPrompt `
-bOr $acFileNameOptions::EmbedFonts -bOr $acFileNameOptions::MultilingualSupport -bOr $acFileNameOptions::EmbedStandardFonts `
-bOr $acFileNameOptions::EmbedLicensedFonts)
# Set Image conversion options
# IO_COMPRESSJBIG2 It cannot be used with PDF/A standard
[System.__ComObject].InvokeMember('ImageOptions', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, @($acImageOptions::IO_OUTPUTPDFA8 -bOr $acImageOptions::IO_XMPMETADATA))
# Set parameters for PDF/A-3b
$part = 3 #part = 3
$conformance = [byte][char] "B" #Conformance "Level B"
$PDFALevel = (1 -shl 8)*$conformance -bOr $part
[System.__ComObject].InvokeMember('SetPrinterParamInt', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, @("PDFALevel", $PDFALevel))
# Apply Settings
[System.__ComObject].InvokeMember('SetDefaultConfig', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, $null)
# The BatchConvert method converts a number of files to PDF.
[System.__ComObject].InvokeMember('BatchConvert', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF, "C:\Temp\test.doc")
# The RestoreDefaultPrinter function resets the system default printer
# to the printer that was the default before the call to SetDefaultPrinter.
[System.__ComObject].InvokeMember('RestoreDefaultPrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null)
# This function will simply detach from an existing printer because the handle was created using DriverInit
[System.__ComObject].InvokeMember('DriverEnd', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null)
# Destroy Object
$PDF = $null
# Declare a new Document object
$pdfDoc = New-Object -ComObject CDIntfEx.Document.6.5
# The SetLicenseKey method should be called after creating an object of type
# CDIntfEx.Document to activate the advanced methods that require the object
# activation code to work properly
[System.__ComObject].InvokeMember('SetLicenseKey', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc, @($strLicenseTo, $strActivationCode))
# Open the PDF/A file with Document Object
[System.__ComObject].InvokeMember('Open', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc, "C:\Temp\test.pdf")
# Add files attachments to the current document
[System.__ComObject].InvokeMember('AddFileAttachmentEx', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc,
@("photo.jpg", "c:\temp\photo.jpg", "Portrait Photo", "image/jpeg", "Alternative"))
# Save the PDF/A-3b File with attachments
[System.__ComObject].InvokeMember('Save', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc, "C:\Temp\test.pdf")
# Destroy Object
$docPdf = $null
' ImageOptions Constants
Const IO_NODUPLICATES = &H1
Const IO_DOWNSAMPLE = &H2
Const IO_CONVERTTOCMYK = &H4
Const IO_OUTPUTPDFA = &H8
Const IO_XMPMETADATA = &H10
Const IO_OUTPUTPDFA8 = &H20
Const IO_NOPRECOMPRESSED = &H40
Const IO_OUTPUTPDFX1 = &H80
Const IO_OUTPUTPDFX3 = &H100
Const IO_COMPRESSJBIG2 = &H200 ' Allowed Only with PDF/A-1 and PDF/A-3
Const IO_ENABLEEPS = &H40000000
Const IO_SIMPOSTSCRIPT = &H80000000
' FileNameOptions constants
' Please check FileNameOptions for the complete version of the flags
NoPrompt = &H1
UseFileName = &H2
Concatenate = &H4
DisableCompression = &H8
EmbedFonts = &H10
BroadcastMessages = &H20
PrintWatermark = &H40
MultilingualSupport = &H80
EncryptDocument = &H100 ' It cannot be used with PDF/A standard
EmbedStandardFonts = &H200000
EmbedLicensedFonts = &H400000
Jpeg2000Compression = &H1000000 ' Allowed Only with PDF/A-3
EncryptDocument128 = &H40000000 ' It cannot be used with PDF/A standard
' Constants for Activation codes
Const strLicenseTo = "Amyuni PDF Converter Evaluation"
Const strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
Const AMYUNIPRINTERNAME = "Amyuni PDF Converter"
' Declare a new cdintfex object
Dim PDF
Set PDF = CreateObject("CDIntfEx.CDIntfEx.6.5")
' Get a reference to the installed printer.
' This will fail if the printer name passed to the DriverInit method is
' not found in the printer’s folder
PDF.DriverInit AMYUNIPRINTERNAME
' The SetDefaultPrinter function sets the system default printer to the one
' initialized by the DriverInit functions.
PDF.SetDefaultPrinter
' The EnablePrinter() method needs to be called right before each print job.
' and before the configuration
' Calling the EnablePrinter() method will start a 20 second time-out value
PDF.EnablePrinter strLicenseTo, strActivationCode
' Resulting PDF document stored here
PDF.DefaultDirectory = "C:\Temp"
' Set Printer options
PDF.FileNameOptionsEx = NoPrompt Or EmbedFonts Or MultilingualSupport Or EmbedStandardFonts Or EmbedLicensedFonts
' Set Image conversion options
' IO_COMPRESSJBIG2 It cannot be used with PDF/A standard
PDF.ImageOptions = IO_OUTPUTPDFA8 Or IO_XMPMETADATA
' Set parameters for PDF/A-3b
Dim part
part = 3 ' part = 3
Dim conformance
conformance = Asc("B") ' Conformance "Level B"
PDF.SetPrinterParamInt "PDFALevel", 256 * conformance Or part
' Apply Settings
PDF.SetDefaultConfig
' The BatchConvert method converts a number of files to PDF.
PDF.BatchConvert "C:\Temp\test.doc"
' The RestoreDefaultPrinter function resets the system default printer
' to the printer that was the default before the call to SetDefaultPrinter.
PDF.RestoreDefaultPrinter
' This function will simply detach from an existing printer because the handle was created using DriverInit
PDF.DriverEnd
' Destroy Object
Set PDF = Nothing
' Declare a new Document object
Dim pdfDoc
Set pdfDoc = CreateObject("CDIntfEx.Document.6.5")
' The SetLicenseKey method should be called after creating an object of type
' CDIntfEx.Document to activate the advanced methods that require the object
' activation code to work properly
pdfDoc.SetLicenseKey strLicenseTo, strActivationCode
' Open the PDF/A file with Document Object
pdfDoc.Open "C:\Temp\test.pdf"
' Add files attachments to the current document
pdfDoc.AddFileAttachmentEx "photo.jpg", "c:\temp\photo.jpg", "Portrait Photo", "image/jpeg", "Alternative"
' Save the PDF/A-3b File with attachments
pdfDoc.Save("C:\Temp\test.pdf")
' Destroy Object
Set pdfDoc = Nothing