'xref' keyword not found.

  • dwhytock

    dwhytock - 2009-10-19

    Hi…Trying to open a PDF with the following code…

        File file = null;
        Document doc = null;

          { file = new File(filename); }
        catch (Exception ex)
          System.out.println("Problem opening the file:\n" + ex + "\n" + ex.getMessage());

    and getting a FileFormatException that says, "'xref' keyword not found."

    Is this something in the file that the reader doesn't like?  Adobe Reader has no problem with the file.


  • Stefano Chizzolini

    Hi Don,

    this behavior currently happens when you try to open a PDF file whose *cross-reference information is stored in a **cross-reference stream***  *instead of in a cross-reference table*, because it hasn't been implemented yet.

    As I've already received other requests on this topic, I scheduled it possibly for the next release.


  • Nobody/Anonymous


         Just ran sample "AcroFormCreationSample" copied created file to samples folders and opened with PDF-XChangeViewer, modified and saved it. Then ran "AcroFormParsingSample" and got the same error; suppose PDF viewers modify document cross-refference info, which in this case a good PDF form become "unusable" to PDF Clown.

         Re-run  "AcroFormCreationSample" , copied to samples folders and immediatly "AcroFormParsingSample" and got this error:

    Data: << Type Annot Subtype Widget P 6 0 R Border  Rect [ 250 706 2
    86 742 ] F 4 FT Btn T myCheck3 V Off AS Off DA /ZaDb 0 Tf 0 0 0 rg MK << BG [ 0.
    941200017929077 0.941200017929077 0.941200017929077 ] BC  CA 4 >> BS <<
    W 0.800000011920929 S S >> H P AP 34 0 R >>
    * Field 'myRadio' (41 0 R)
        Type: RadioButton
        Page: undefined
    An exception happened while running the sample:
    System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.
       en it.stefanochizzolini.clown.objects.Rectangle.Normalize(PdfArray rectangle)
       en it.stefanochizzolini.clown.objects.Rectangle..ctor(PdfDirectObject baseObject)
       en it.stefanochizzolini.clown.documents.interaction.annotations.Annotation.get_Box()
       en it.stefanochizzolini.clown.samples.AcroFormParsingSample.Run()
       en it.stefanochizzolini.clown.samples.SampleLoader.Run(String inputPath, String outputPath)

       Hope this help developers to improve PDF functionality, samples or find bugs.

       Regards, Oscar.

  • Oscar Hernandez

    Oscar Hernandez - 2010-08-26


         Just tried opening and saving with Adobe Reader and got the same error -which forgot to paste in my last comment-:

    Please select a PDF file: 1
    An exception happened while running the sample:
    it.stefanochizzolini.clown.tokens.FileFormatException: xref keyword not found.
       en it.stefanochizzolini.clown.tokens.Reader.ReadTrailer()
       en it.stefanochizzolini.clown.files.File..ctor(IInputStream stream)
       en it.stefanochizzolini.clown.files.File..ctor(String path)
       en it.stefanochizzolini.clown.samples.ActionSample.Run()
       en it.stefanochizzolini.clown.samples.SampleLoader.Run(String inputPath, String outputPath)

        Latest version is focused in text extraction, do you have a time frame to implement "cross-reference table" ? At this time cannot stick to PDF Clown if forms created and modified cannot be parsed later.


  • Stefano Chizzolini

    Hi Oscar,

    1) NullReferenceException on AcroFormParsingSample: thank you for your bug report - I'll publish a corrective patch in the next days;
    2) xref keyword not found: as you can see on the Roadmap , cross-reference streams  are going to be part of the next release (I considered to include them in 0.0.8, but I had not enough time for implementation and testing).



  • Dan

    Dan - 2010-12-07

    Hi Stefano,

    Your project looks excellent and we have successfully implemented it into a product of ours. We have come across the ‘xref’ problem discussed above and was wondering when you think a release will be available with this fixed? Would a donation to your project help speed this up?

    Many thanks for your work with this.


  • Stefano Chizzolini

    Hi Dan,

    We have come across the ‘xref’ problem discussed above and was wondering when you think a release will be available with this fixed?

    I'm currently on the final testing stage of the Java implementation; consequently, I'll do the porting to .NET. I can estimate it's going to be released on January 2011.

    Would a donation to your project help speed this up?

    Donations are really appreciated as a way to remark your willing to support the project, but I feel it would be unethical to induce users to donate in order to alter the release timeline of planned features. Nonetheless, I accept targeted financial support in case of requests for prioritizing unplanned features.

    Thank you!

  • Dan

    Dan - 2010-12-21

    Hi Stefano,

    Thanks for the update on this. We look forward to the next release. Keep up the good work!


  • Anonymous - 2011-02-28

    Hi Stefano,

    Has this been fixed as yet ?


  • Stefano Chizzolini

    Hi Aishwarya,

    yes, cross-reference streams are now supported; as you can see in the project events log, yesterday I imported the project's source code into the public SVN repo. I'll package the 0.1.0 official distribution as soon as possible; in the meantime, you can check out from the repo - I extensively tested it (beta phase), so you should feel quite comfy.



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks