Migrating from XRefRebuilder to SDF.Doc.FixBrokenDoc().

Q:

I have an urgent need to fix some PDF documents with broken xref
tables, however my old code that relies on XRefRebuilder does not
compile with the latest SDK. How do I migrate the code?
-----

A:
In the latest version of PDFNet SDK pdftron.SDF.XRefRebuilder class
was deprecated and replaced with pdftron.SDF.Doc.FixBrokenDoc() static
method. The new function is slightly easier to use than
XRefRebuilder.

The updated code would look as follows:

// Assuming C# pseudocode
PDFDoc doc;
try { // try to open the document...
  doc = new PDFDoc(input_file);
  doc.InitSecurityHandler();
  ....
}
catch (Exception e) {
  try { // try to fix the document
    StdFile file = new StdFile(input_file,
StdFile.OpenMode.e_read_mode));
    doc = new PDFDoc(pdftron.SDF.Doc.FixBrokenDoc(file));
  }
  catch (Exception e) {
    // Error: Document rebuild failed.
    return false;
  }
  ... use doc ...