Summary of steps
To convert any of the supported types to a PDF document, perform the following steps:
- Include project files.
- Create a Distiller service client.
- Retrieve the file to convert.
- Invoke the PDF creation operation.
- Save the PDF document.
Include project files
Include the necessary files in your development project. If you are creating a client application by using Java, include the necessary JAR files. If you are using web services, make sure you include the proxy files.
Create a Distiller service client
Before you can programmatically perform a Distiller service operation, you must create a Distiller service client. If you are using the Java API, create a DistillerServiceClient
object. If you are using the web service API, create a DistillerServiceService
object.
Retrieve the file to convert
Retrieve the file that you want to convert. For example, to convert a PS file to a PDF document, you must retrieve the PS file.
Invoke the PDF creation operation
After you create the service client, you can then invoke the PDF creation operation. This operation will need information about the document to be converted, including the path to the target document.
Save the PDF document
You can save the PDF document as a PDF file.
See also
Convert a PostScript file to PDF using the Java API
Converting a PostScript file to PDF using the web service API
Convert a PostScript file to PDF using the Java API
Convert a PostScript file to PDF document by using the Distiller Service API (Java):
-
Include project files.
Include client JAR files, such as adobe-distiller-client.jar, in your Java project’s class path.
-
Create a Distiller service client.
- Create a
ServiceClientFactory
object that contains connection properties. - Create an
DistillerServiceClient
object by using its constructor and passing theServiceClientFactory
object.
- Create a
-
Retrieve the file to convert.
- Create a
java.io.FileInputStream
object that represents the file to convert by using its constructor and passing a string value that specifies the location of the file. - Create a
com.adobe.idp.Document
object by using its constructor and passing thejava.io.FileInputStream
object.
- Create a
-
Invoke the PDF creation operation.
Invoke the
DistillerServiceClient
object’screatePDF
method and pass the following values:- The
com.adobe.idp.Document
object that represents the PS, EPS, or PRN file to be converted - A
java.lang.String
object that contains the name of the file to be converted - A
java.lang.String
object that contains the name of the Adobe PDF settings to be used - A
java.lang.String
object that contains the name of the security settings to be used - An optional
com.adobe.idp.Document
object that contains settings to be applied while generating the PDF document - An optional
com.adobe.idp.Document
object that contains metadata information to be applied to the PDF document
The
createPDF
method returns aCreatePDFResult
object that contains the new PDF document and a log file that may be generated. The log file typically contains error or warning messages that are generated by the conversion request. - The
-
Save the PDF document.
To obtain the newly created PDF document, perform the following actions:
- Invoke the
CreatePDFResult
object’sgetCreatedDocument
method. This returns acom.adobe.idp.Document
object. - Invoke the
com.adobe.idp.Document
object’scopyToFile
method to extract the PDF document.
Similarly, to obtain the log document, perform the following actions.
- Invoke the
CreatePDFResult
object’sgetLogDocument
method. This returns acom.adobe.idp.Document
object. - Invoke the
com.adobe.idp.Document
object’scopyToFile
method to extract the log document.
- Invoke the
Converting a PostScript file to PDF using the web service API
Convert a PostScript file to PDF document by using the Distiller Service API (web service):
-
Include project files.
Create a Microsoft .NET project that uses MTOM. Ensure that you use the following WSDL definition:
http://localhost:8080/soap/services/DistillerService?WSDL&lc_version=9.0.1
.NOTE
Replacelocalhost
with the IP address of the server hosting AEM Forms. -
Create a Distiller service client.
-
Create a
DistillerServiceClient
object by using its default constructor. -
Create a
DistillerServiceClient.Endpoint.Address
object by using theSystem.ServiceModel.EndpointAddress
constructor. Pass a string value that specifies the WSDL to the AEM Forms service (for example,http://localhost:8080/soap/services/DistillerService?blob=mtom
.) You do not need to use thelc_version
attribute. This attribute is used when you create a service reference. However, specify?blob=mtom
to use MTOM. -
Create a
System.ServiceModel.BasicHttpBinding
object by getting the value of theDistillerServiceClient.Endpoint.Binding
field. Cast the return value toBasicHttpBinding
. -
Set the
System.ServiceModel.BasicHttpBinding
object’sMessageEncoding
field toWSMessageEncoding.Mtom
. This value ensures that MTOM is used. -
Enable basic HTTP authentication by performing the following tasks:
- Assign the AEM forms user name to the field
DistillerServiceClient.ClientCredentials.UserName.UserName
. - Assign the corresponding password value to the field
DistillerServiceClient.ClientCredentials.UserName.Password
. - Assign the constant value
HttpClientCredentialType.Basic
to the fieldBasicHttpBindingSecurity.Transport.ClientCredentialType
. - Assign the constant value
BasicHttpSecurityMode.TransportCredentialOnly
to the fieldBasicHttpBindingSecurity.Security.Mode
.
- Assign the AEM forms user name to the field
-
-
Retrieve the file to convert.
- Create a
BLOB
object by using its constructor. ThisBLOB
object is used to store the file to convert to a PDF document. - Create a
System.IO.FileStream
object by invoking its constructor and passing a string value that represents the file location and the mode to open the file in. - Create a byte array that stores the content of the
System.IO.FileStream
object. You can determine the size of the byte array by getting theSystem.IO.FileStream
object’sLength
property. - Populate the byte array with stream data by invoking the
System.IO.FileStream
object’sRead
method and passing the byte array, the starting position, and the stream length to read. - Populate the
BLOB
object by assigning itsMTOM
property with the contents of the byte array.
- Create a
-
Invoke the PDF creation operation.
Invoke the
DistillerServiceService
object’sCreatePDF2
method and pass the following required values:- The
BLOB
object that represents the PS file to convert - A string that contains the path name of the file to be convert
- A string object that contains the Adobe PDF settings to be used (for example,
Standard
) - A string object that contains the security settings to be used (for example,
No Securit
y) - An optional
BLOB
object that contains settings to be applied while generating the PDF document - An optional
BLOB
object that contains metadata information to be applied to the PDF document - A
BLOB
output parameter used to store the PDF document - A
BLOB
output parameter used to store the log
- The
-
Save the PDF document.
- Create a
System.IO.FileStream
object by invoking its constructor. Pass a string value that represents the file location of the signed PDF document and the mode in which to open the file. - Create a byte array that stores the content of the
BLOB
object that was returned by theCreatePDF2
method (the output parameter). Populate the byte array by getting the value of theBLOB
object’sMTOM
data member. - Create a
System.IO.BinaryWriter
object by invoking its constructor and passing theSystem.IO.FileStream
object. - Write the contents of the byte array to a PDF file by invoking the
System.IO.BinaryWriter
object’sWrite
method and passing the byte array.
- Create a
Experience Manager
Espressos & Experience Manager: AEM Forms
Espressos & Experience Manager
Thursday, Mar 6, 7:00 PM UTC
Join Adobe's AEM product team as they highlight AEM Forms' latest innovations, including: the new Gen AI Assistant, Unified Composition with AEM Sites, and new ways to deploy forms through conversations.
RegisterThe True Cost of a Failed Implementation
A failed implementation isn’t just an inconvenience — it costs real revenue. Poor execution and misaligned tools disrupt pipelines,...
Wed, Mar 19, 2:00 PM PDT (9:00 PM UTC)
Rapid Feature Releases with AEM Cloud: Telegraph Media Group’s RDE Strategy
Hear how Telegraph Media Group, the award-winning publisher of The Daily Telegraph, The Sunday Telegraph, The Telegraph Magazine,...
Wed, Mar 19, 3:30 PM PDT (10:30 PM UTC)
Connect with Experience League at Summit!
Get front-row access to top sessions, hands-on activities, and networking—wherever you are!
Learn more