OpenOffice - This file contains links to other files.

When trying to open a spreadsheet document (for example, MS Excel) in OpenOffice that contains embedded data or external links a dialog is displayed prompting whether the links should be updated.

This file contains links to other files. Should they be updated?

As OpenOffice runs on the server this can cause issues as nobody is available to process the dialog and the conversion process therefore fails.

The solution is to adjust the options in OpenOffice to supress the message as follows;

Tools > Options > OpenOffice Calc > General - Updating - Update links when opening = Never

By setting the option to Never you shouldn't get the prompt / dialog box displayed.

OpenOffice Conversion Failure - URL seems to be an unsupported one

If DominoPDF logging shows that your attachment / file conversion is failing with the error;

OpenOffice Conversion Failure.

OpenOfficeError: com.sun.star.lang.IllegalArgumentException: URL seems to be an unsupported one

The error that was returned by OpenOffice typically means the specified file cannot be found.

Instead of passing the input file as simply "myfile.xls" the solution is to fully qualify the path, for example, "c:\temp\attach\myfile.xls" and in this manner OpenOffice will successfully find the file.

OpenOffice Interface Security

When using DominoPDF to convert attachments the OpenOffice interface is used. In some cases, security settings may need to be adjusted to allow DominoPDF to interact with OpenOffice.

On the server machine where OpenOffice is installed, execute the following;

Start > Run > dcomcnfg

Navigate to: Component Services > Computers > My Computer > DCOM Config > OpenOffice.org 1.1 Text Document

Open the properties of OpenOffice.org 1.1 Text Document (right-click Properties)

Go to Identify tab

Choose the interactive user radio button

The idea behind this is to tell OpenOffice to run as the currently logged in user.

Alternatively, you can specify an explicit user.

If needed you may have to specify execution priviliges via the Security tab.

Note that instead of "The interactive user" setting you may need to add the account you are currently logged into to the DCOM setting.

Repeat the above process to any of the other OpenOffice DCOM entries.

Running Domino as a Service

If you run the Domino Server as a service you may need to enable the Log On used to interact with the desktop.

Open the Service properties for "Lotus Domino Server" and click the Log On tab.

Enable "Allow service to interact with desktop".

Ping Host with LotusScript

The Ping LotusScript class allows you to pass in an IP address and return whether the ping was successful or not. The class is useful if you're using DominoPDF via HTTP and want to check availability before converting a URL.

Socket Errors when connecting to URL

DominoPDF uses HTTP to process a URL and convert the resulting HTML output to PDF. In some cases the underlying HTTP protocol may return an error (not the fault of DominoPDF) and this error will be flagged in the DominoPDF log file (if enabled).

Below we have provided a list of common Socket errors which will help in establishing the cause of the issue and decide resolution.

Socket error 10004 - Interrupted function call
Socket error 10013 - Permission denied
Socket error 10014 - Bad address
Socket error 10022 - Invalid argument
Socket error 10024 - Too many open files
Socket error 10035 - Resource temporarily unavailable
Socket error 10036 - Operation now in progress
Socket error 10037 - Operation already in progress
Socket error 10038 - Socket operation on non-socket
Socket error 10039 - Destination address required
Socket error 10040 - Message too long
Socket error 10041 - Protocol wrong type for socket
Socket error 10042 - Bad protocol option
Socket error 10043 - Protocol not supported
Socket error 10044 - Socket type not supported
Socket error 10045 - Operation not supported
Socket error 10046 - Protocol family not supported
Socket error 10047 - Address family not supported by protocol family
Socket error 10048 - Address already in use
Socket error 10049 - Cannot assign requested address
Socket error 10050 - Network is down
Socket error 10051 - Network is unreachable
Socket error 10052 - Network dropped connection on reset
Socket error 10053 - Software caused connection abort
Socket error 10054 - Connection reset by peer
Socket error 10055 - No buffer space available
Socket error 10056 - Socket is already connected
Socket error 10057 - Socket is not connected
Socket error 10058 - Cannot send after socket shutdown
Socket error 10060 - Connection timed out
Socket error 10061 - Connection refused
Socket error 10064 - Host is down
Socket error 10065 - No route to host
Socket error 10067 - Too many processes
Socket error 10091 - Network subsystem is unavailable
Socket error 10092 - WINSOCK.DLL version out of range
Socket error 10093 - Successful WSAStartup not yet performed
Socket error 10094 - Graceful shutdown in progress
Socket error 11001 - Host not found
Socket error 11002 - Non-authoritative host not found
Socket error 11003 - This is a non-recoverable error
Socket error 11004 - Valid name, no data record of requested type

SSL Connections In Notes / Domino R8

DominoPDF uses 2 DLL's to connect via HTTPS / SSL which are named ssleay32.dll and libeay32.dll.

Notes / Domino v8 has another version of the SSL DLL (libeay32.dll) in Domino directory; \domino_icc\icc\osslib

This Notes / Domino directory handles the new FIPS 140-2 certified cryptography library for Notes / Domino v8, so if you're looking to deploying FIPS 140-2 certified Notes ID and document encryption there may be a conflict with DominoPDF.

To work around this issue, DominoPDF exposes a setting UseIEHTTP=True, which uses an alternate SSL library.

Tracking issues with a bare bones agent

Enabling DominoPDF logging is the method used for seeing what is happening with DominoPDF.

You can see how to enable logging from our Knowledge Base

When I'm having trouble tracking down an issue with DominoPDF I go for the least code possible to test the integration and file writing etc.

An example of this is to simply add the DominoPDF function call to the (Declarations) section in an agent;

(Declarations)
Declare Function DoPDF Lib "DOMINOPDF.DLL" (Byval szInput As String, Byval szOutput As String, Byval szOptions as String) As Long

Next, in the (Initialize) section I just add a call to the DominoPDF method with a hardcoded URL (one I know works) and a hardcoded PDF path, adding authentication and DominoPDF logging as required. As a safe bet the system temp directory is good to write to as it's generally available for all working tasks;

Call DoPDF("http://www.google.com", "c:\temp\test.pdf", "WebUsername=user;WebPassword=secret;LogFile=c:\temp\dompdf.log.txt")

I then run the agent either locally on the server or remotely etc. and check the output.

If the PDF file is created then I know DominoPDF is installed OK and I can then begin integrating more with dynamic values for URL, file path etc.

If the PDF file is not created I can check the log file and see what the cause was.

If the log file does not exist I usually extend the agent to add LotusScript error handling. For example;

On Error Goto Error_Handler
Call DoPDF("http://www.google.com", "c:\temp\test.pdf", "WebUsername=user;WebPassword=secret;LogFile=c:\temp\dompdf.log.txt")

The_End:
Exit Sub

Error_Handler:
Print "DominoPDF Error: " & Error$

Now when I run the agent I can see if LotusScript throws any errors and examine the Error_Handler statement for the Error$. If there is an Error$ value I can take appropriate action.

If all the above fails I'd start checking to see why the log file did not get created (directory rights, can I save a file with LotusScript itself to that directory etc.) as the log file is the best bet for finding out why DominoPDF fails.

If none of the above helps then we'll need to dig a bit deeper to find the cause so please contact the support team.

Unzip Files From LotusScript

LotusScript does not have a native class for uncompressing files to .zip format.

If you are running Notes or Domino R6 (or newer), by using the ability of LotusScript to make calls to functionality that is available in the Java language via LS2J -- which is documented in Designer Help.

Sub Initialize
 Dim js As JAVASESSION
 Dim zipClass As JAVACLASS
 Dim zipFileObject As JavaObject
 Dim varFileToZip As String, varOutFilePath 
As String, returnCode As String
 
 Set js = New JAVASESSION
 Set zipClass = js.GetClass("ZipFile")
 Set zipFileObject = zipClass.CreateObject
 varFileToZip = "c:tempdocument.doc"
 varOutFilePath = "c:tempthezipfile.zip"
 
 returnCode = zipFileObject.zipMyFile
(varFileToZip, varOutFilePath) 
'Calling the zip function
 
 If Not returnCode = "OK" Then
  Print "An Error occurred"
 Else
  Print "Zip went OK"
 End If
End Sub

In the Options of the agent I have the following:

Uselsx "*javacon" 'Which lets you use
 Java from LotusScript
Use "ZipFile" 'A Java library that holds 
a function to do zipping

Below is the Java Library that makes it possible to zip a file. You create a Java Library in the Designer in Shared code > Script Libraries, click New Java Library, remove the few lines of code that you get as a help for getting started, and paste the code below. Save and call the library "ZipFile."

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.Deflater;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

public class ZipFile {
 public String zipMyFile(String fileToZip, 
String zipFilePath) {
  String result = ""; 

      byte[] buffer = new byte[18024];
 
      // Specify zip file name
      String zipFileName = zipFilePath;
 
      try {

 
        ZipOutputStream out =
          new ZipOutputStream
(new FileOutputStream(zipFileName));
 
        // Set the compression ratio
        out.setLevel
(Deflater.BEST_COMPRESSION);
 
          System.out.println(fileToZip);
          // Associate a file input stream 
for the current file
          FileInputStream in = 
new FileInputStream(fileToZip);
 
          // Add ZIP entry to output stream.
          out.putNextEntry
(new ZipEntry(fileToZip));
 
          // Transfer bytes from 
the current file to the ZIP file
          //out.write(buffer, 0, in.read(buffer));
 
          int len;
         while ((len = in.read(buffer)) > 0) 
         {
         out.write(buffer, 0, len);
        }
 
          // Close the current entry
          out.closeEntry();
 
          // Close the current file input stream
          in.close();
 
        // Close the ZipOutPutStream
        out.close();
      } 
      catch (IllegalArgumentException iae) {
        iae.printStackTrace();
   return "ERROR_
ILLEGALARGUMENTSEXCEPTION";
      }
      catch (FileNotFoundException fnfe) {

        fnfe.printStackTrace();
    return "ERROR_FILENOTFOUND";
      }
      catch (IOException ioe)
      {
      ioe.printStackTrace();
      return "ERROR_IOEXCEPTION";
      }


  return "OK";
  
  }
}

URL's in PDF Output

When DominoPDF tries to convert content to URL's it looks for the "http", "www" and "mailto" identifiers in the actual text content and converts these to URL's.

Using An Agent To Create Content

DominoPDF can convert any HTML content to PDF, no matter where it originates, however if client-side usage is needed and HTTP / URLs are not available an agent can be used to generate the appropriate output.

LotusScript can be used to write document values, layout, formatting etc. to a local / temporary HTML file which is then passed to DominoPDF.

For example;

Sub Initialize
Dim fileNum As Integer
Dim fileName As String
Dim oDoc as NotesDocument

fileNum% = Freefile()
fileName$ = "c:\data.html"

Open fileName$ For Output As fileNum%
Print #fileNum%, |<html>|
Print #fileNum%, |<body>|
Print #fileNum%, |<p>|
Print #fileNum%, oDoc.Subject(0)
Print #fileNum%, |</p>|
Print #fileNum%, |</body>|
Print #fileNum%, |</html>|

Close fileNum%

Call DoPDF(|c:\data.html|, |c:\data.pdf|, ||)
End Sub

A number of our customers have taken this strategy further by building reports, invoices and custom layouts for generating PDF output.

By using a LotusScript agent to generate custom HTML you have full control over your PDF.

Page 6 of 7

JoomShaper