83
3-Heights™ Document Converter, Version 4.6
Page 83 of 90
January 25, 2016
© PDF Tools AG - Premium PDF Technology
troubleshooting hints for problem 1 and 2 above
4. We have installed/updated to
Office 12, but it only works with the
Adhoc Server.
Make sure you have started the office
applications from each user account that is being
used as a service account for the Document
Converter.
Make sure the Office license is activated.
Otherwise, Office applications will not start
properly, but rather show a dialogue asking for
license activation.
5. Conversion of PowerPoint docu-
ments fails (no pages converted)
If you have a PowerPoint version prior to
PowerPoint 2003 installed, make sure that
background printing is disabled (Options menu,
Printing).
6. Our Microsoft Word documents
containing the company logo do not
get converted correctly
Company logos are usually based on a specific
font that needs to be installed on the computer
where the conversion takes place. Verify this by
inspecting the Fonts directory on the server
(usually C:\WINDOWS\Fonts).
7. Our application using the Java
API crashes
The Java API relies on the .NET transport for
accessing the Document Converter. Make sure
the O2PProxyNET.dll is registered in the Global
Assembly Cache. (This is not automatically
performed
by
the
Document
Converter
installation).
Use the Windows file explorer to drag and drop
the O2PProxyNET.dll from the installation
directory to the C:\WINDOWS\assembly folder.
er.
8. The Visual Basic Script sample
does not work
A common cause for this issue is that
O2PProxyNET.dll is not registered in the Global
Assembly Cache (see above no. 7).
9. The installation wizard says on
the “Server Host and Port
Configuration” screen: “It seems
that PDF and/or TIFF printer drivers
are already installed…”
This message is shown when a 3-Heights Port
Monitor is found, and the “PDF and TIFF printer
drivers” feature is selected for installation.
You actually want to install these drivers
separately. In this case, step back to the “Custom
Setup” form and de-select the “PDF and TIFF
printer drivers” feature.
Some of the printer drivers or the port monitors
have not been cleanly de-installed previously.
This can be the case if de-installation was
s
performed before the Document Converter or any
of the office applications did not completely
terminate in time. See next item for
troubleshooting.
10. De-installation is incomplete
(PDF or TIFF driver still installed, or
3-Heights
Port
monitor
still
Method 1: re-install + re-de-install; to install, add
“PDFPRNMONEXISTS=0”
on
the
MSIEXE
command line, and click “ignore” during
62
3-Heights™ Document Converter, Version 4.6
Page 84 of 90
January 25, 2016
© PDF Tools AG - Premium PDF Technology
installed)
installation.
Method 2: download and run the “PdfPrnDiag”
Tool
from
https://www.pdf-
-
tools.com/pdf/Support/Downloads.aspx
Also, make sure the services entries have been
removed from the system. If any remain, use the
service control tool to delete them. (e. g. “SC
DELETE O2PWFS”).
11. HTML conversions do not work Check if IEPRINT is configured to “true”. If yes,
make sure “Internet Explorer Enhanced Security”
is configured “Off”. (Start “Server Manager”,
under “Security Information”, click “Configure IE
ESC”).
12. VBAOff setting has no effect
Microsoft Office 2007 and newer have the VBAOff
flag under \Sofware\Policies\Microsoft\Office,
ffice,
where the user may not have write access.
Solution: using REGEDIT.EXE, either a) configure
write access for the users configured as worker
accounts, or b) directly set the VBAOff flag in the
“Common” key.
13. Web service error 404
When converting large documents via the web
service, the caller gets an HTTP 404 error.
Solution: adjust the maxRequestLength and
maxAllowedContentLength settings in the web
service’ web.config file. Allow sufficient values to
account for encoding and SOAP envelope size.
14. HTTP 2 error
When converting large HTML documents via
“IEPRINT”, this error may show up. It means that
the print operation has timed out. To allow for a
longer timeout, you can create an application
configuration file “IEPRINT.exe.config” and set a
value for “PrintTimeout” (30 is the default, which
is multiplied with the size of the input file in MB).
Note that you also must adjust the
HTMLMAXLOADTIME setting in the HTML section,
as this setting also limits the maximum time
permitted to convert an HTML document.
15. Outlook conversion hangs
There are multiple reasons why Outook may
block when converting certain MSG documents:
- The Outlook profile for the worker user has
has
not yet been initialized: see section 2.2
- A “programmatic access” popup may block
block
Outlook: see section 2.2
- The MSG document may contain links to
o
external images that slow down conversion:
suppress image download by disabling all
7
3-Heights™ Document Converter, Version 4.6
Page 85 of 90
January 25, 2016
© PDF Tools AG - Premium PDF Technology
outgoing connections from Outlook.exe in the
firewall. (Note: trust center settings have no
effect, despite Outlook help suggest so).
50
3-Heights™ Document Converter, Version 4.6
Page 86 of 90
January 25, 2016
© PDF Tools AG - Premium PDF Technology
7
Samples
Examples (C# .NET) are available at the following location:
http://www.pdf-tools.com/public/downloads/samples/DCVESamples.zip
7.1
Command Line Tool
The op2client.exe program prints the following usage text when executed without any
parameters:
Usage: o2pclient [ Options ] office.doc office.xls ...
Options: -sp url service point URL overriding entry in .config file;
NOTE: this must be first option on the command line.
-l list known file extensions
s
-o out.pdf specify name of output file (default: out.pdf)
-j options set job options
-b options set file options
-v verbose
-ax file add XML Metadata from file (unchecked)
-share pass files via shared file system
Job options: PDF.USERPASS=pass;PDF.OWNERPASS=pass;PDF.PERMISSION=-1;
PDF.DATE=20070901120000
File options: "Outline='Bookmark Text;';xz.zip:Outline=Archive XY
Use the following command to convert all documents in a directory to a single PDF/A
compliant PDF document:
o2pclient -o folder.pdf -j PDFA -b Outline=FILENAME .\folder\*.*
Note: you can specify a relative or an absolute path for input files on the command line.
7.2
C API
#include "o2pproxyapi_c.h"
#include "o2perror.h"
int main(int argc, char* argv[])
{
O2PConverter converter = O2PCreateConverter(NULL);
O2PJob job = O2PConverterCreateJob(converter);
O2PJobSetOptionsA(job, "#;");
O2PJobCreateOutput(job, argv[argc-1]);
if(!O2PJobAppendDoc(job, argv[1], NULL))
{
unsigned int iError;
const char* pszText;
O2PJobGetLastErrorA(job, &iError, &pszErrorText);
fprintf(stderr, "Error code: 0x%x\nError text: %s\n", iError, pszText);
xt);
}
O2PJobClose(job);
O2PJobDestroyObject(job);
52
3-Heights™ Document Converter, Version 4.6
Page 87 of 90
January 25, 2016
© PDF Tools AG - Premium PDF Technology
O2PDestroyConverter(converter);
return 0;
}
This sample shows the basic call sequence and usage of the API functions. Error
handling should follow each call.
7.3
C#.NET
using Pdftools.Converter;
try {
job =
ConverterFactory.GetInstance("tcp://servername:7981/O2PService").CreateJob();
);
}
catch(System.Net.Sockets.SocketException se) {
{
ErrText.Value = "Conversion service not available; " + se.Message;
;
return;
}
job.SetOptions("");
job.CreateOutput(null);
if (!job.AppendDoc(pBytes, pOptions)) {
// Error handling
}
job.FinishConversion();
byte[] outBytes = job.RetrieveOutput();
job.Terminate();
The above code sample shows an excerpt from an ASP.NET application that uses the
.NET interface of the Document Converter.
Note that this is the bare remoting interface without any client side logic as in the C or
COM interfaces. Retrieving error information e.g. is a remote call here, while the C and
COM interfaces are caching that information.
To actually run this code from within a .NET executable or ASP.NET, the
O2PProxyNET.DLL must either be explicitly referenced from the application, or it must
be registered in the .NET Global Assembly Cache.
7.4
Visual Basic Script
Set oConv = CreateObject("O2PProxyAPI.ConverterProxy")
oConv.ServicePoint = "tcp://servername:7981/O2PService"
Set oJob = oConv.CreateJob()
If oJob.Create("output.pdf") Then
oJob.AppendDoc "Document1.rtf",""
oJob.Close
Else
WScript.Echo "Create failed: " & oJob.ErrorText
End If
Note: in order to execute this script, the O2PProxyNET.DLL must be registered in the
.NET Global Assembly Cache.
56
3-Heights™ Document Converter, Version 4.6
Page 88 of 90
January 25, 2016
© PDF Tools AG - Premium PDF Technology
7.5
Java
7.5.1 Microsoft.NET based Java API
This program sample illustrates the use of the Microsoft.NET based Java interface that is
available only on Windows platforms. Java applications that are hosted on other
platforms will need to make use of the web service interface.
import com.pdftools.converter.*;
public class DocConv
{
public static void main(String[] args) throws Exception
{
if(args.length < 2) {
System.out.println("Usage: DocConv in1.pdf in2.pdf... out.pdf");
return;
}
Converter conv = Converter.createConverter("tcp://srv:7981/O2PService");
Job job = conv.createJob();
job.createOutput(args[args.length-1]);
for(int i = 0; i < args.length-1; i++)
+)
job.appendDoc(args[i], "");
job.close();
job.destroyObject();
conv.destroyObject();
}
}
Note: in order to execute this java program, the O2PProxyNET.DLL must be registered
in the .NET Global Assembly Cache (unless a copy of O2PProcxNET.DLL is located in the
same folder as java.exe).
7.5.2 Web Service Interface
The ‘wsimport’ tool can be used to generate the Java code necessary to access the web
service (see comment in the sample code below).
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.net.URL;
import javax.xml.namespace.QName;
import com.pdf_tools.ws.o2p.*;
/**
* This java sample shows how to use the Document Converter web service interface.
* The com.pdf_tools.ws.o2p package was created using the wsinport tool:
* wsimport.bat -Xendorsed -extension -keep http://wshostname/Converter.asmx?wsdl
wsdl
*/
public class convert {
public static void main(String[] args) {
if (args.length < 2) {
System.out.println
("Usage: convert [Options] path-to-input-document path-to-
-to-
-
output-file");
System.out.println("Options: -j ConverterOptions");
68
3-Heights™ Document Converter, Version 4.6
Page 89 of 90
January 25, 2016
© PDF Tools AG - Premium PDF Technology
System.out.println(" -sp
http://<servername>/Converter.asmx?wsdl");
return;
}
String input_file = null;
String output_file = null;
String options = "";
String sp = "https://docws.pdf-tools.com/Converter.asmx?wsdl";
int nr = 0;
while (nr < args.length)
{
if ("-j".equals(args[nr]) && nr+1 < args.length)
options = args[++nr];
else if ("-sp".equals(args[nr]) && nr+1 < args.length)
sp = args[++nr];
else if (input_file == null)
input_file = args[nr];
else if (output_file == null)
output_file = args[nr];
else
System.out.println("too many parameters; skipped '" + args[nr]
+ "'");
nr++;
}
try
{
URL url = new URL(sp);
Converter conv = new Converter(url,
new QName("http://pdf-tools.com/ws/o2p/", "Converter"));
ConverterSoap ws = conv.getConverterSoap12();
FileInputStream is = new FileInputStream(input_file);
byte[] inputDocBytes = new byte[is.available()];
int n = is.read(inputDocBytes);
if (n != inputDocBytes.length)
throw new Exception("Error reading bytes for file " +
input_file);
is.close();
int pos = input_file.lastIndexOf('/');
if (pos < 0)
pos = input_file.lastIndexOf('\\');
;
String name = input_file;
if (pos > 0)
name = input_file.substring(pos + 1);
options += ";ORIGINALNAME=" + name;
ConversionResult result = ws.convertFile(inputDocBytes, options,
null);
if(result.getErrorCode() != 0) {
System.out.println("Error: " + result.getErrorCode());
System.out.println(result.getErrorDescription());
}
byte[] outputPdfBytes = result.getDocumentBytes();
if (outputPdfBytes != null)
{
FileOutputStream os = new FileOutputStream(output_file);
os.write(outputPdfBytes);
os.close();
System.out.println("Pages converted: " +
result.getNumPages());
}
}
catch(Exception e1) {
System.out.println(e1);
}
13
3-Heights™ Document Converter, Version 4.6
Page 90 of 90
January 25, 2016
© PDF Tools AG - Premium PDF Technology
}
}
7.5.3 Using MTOM with the Web Service
The web service provided with the Document Converter installation can be enabled to
support MTOM (“Message Transmission Optimization Mechanism”).
The relevant information can be found on the Microsoft support and download pages
related to “Web Services Enhancement (WSE) 3.0 for Microsoft.NET”.
Essentially, enabling of MTOM consist of installing “Microsoft.Web.Services3.dll” and
entering the appropriate entries into the Web.config file.
Documents you may be interested
Documents you may be interested