Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.pdfbox.examples.pdmodel
Class ReplaceString

    java.lang.Object
      org.pdfbox.examples.pdmodel.ReplaceString

public class ReplaceString
extends Object

This is an example that will replace a string in a PDF with a new one. The example is taken from the pdf file format specification.

Version:
  $Revision: 1.3 $
Author:
  Ben Litchfield

Constructor Summary
`ReplaceString()` Constructor.

Method Summary
`void` | `doIt(String inputFile, String outputFile, String strToFind, String message)` Locate a string in a PDF and replace it with a new string.
`static void` | `main(String[] args)` This will open a PDF and replace a string if it finds it.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ReplaceString

    public ReplaceString()

  Constructor.

Method Detail

### doIt

    public void doIt(String inputFile,
                     String outputFile,
                     String strToFind,
                     String message)
              throws IOException,
                     COSVisitorException

  Locate a string in a PDF and replace it with a new string.

  Parameters:
    `inputFile` - The PDF to open.
    `outputFile` - The PDF to write to.
    `strToFind` - The string to find in the PDF document.
    `message` - The message to write in the file.
  Throws:
    `IOException` - If there is an error writing the data.
    `COSVisitorException` - If there is an error writing the PDF.

### main

    public static void main(String[] args)

  This will open a PDF and replace a string if it finds it.
  see usage() for commandline

  Parameters:
    `args` - Command line arguments.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD