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


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?

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

The updated code would look as follows:

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