[poppler] using ObjectStream and XRef->getObjStr

Albert Astals Cid aacid at kde.org
Wed May 6 15:38:10 PDT 2009


A Dimarts, 5 de maig de 2009, Norbert Preining va escriure:
> Dear all,
>
> we are trying to compile the TeX Live Suite with poppler instead of
> xpdf. Unfortunately one of the programs uses getObjStr which is not
> exhibited by poppler through the XRef.h.

Neither by xpdf XRef.h, moveover the "hidden" ObjectStream doesn't have
 int *offsets;
nor
 Guint firstOffset;

>
> The pdftosrc.cc uses:
>                 ObjectStream *objStr = xref->getObjStr();
>                 assert(objStr != NULL);
>                 int *localOffsets = objStr->getOffsets();
>                 assert(localOffsets != NULL);
>                 fprintf(outfile, "%.10lu 00000 n\n",
>                         (long unsigned) (objStr->getFirstOffset() +
>                                          localOffsets[e->gen]));

Are you aware that only pdf with xrefEntryCompressed have a objStr?

I'm not really sure what you are trying to acomplish here? Get the position of 
a XRefEntry?

>
> currently I have to include instead of XRef.h a fixed version with the
> following patch included:
> --- poppler-0.6.2/poppler-0.6.2/poppler/XRef.h.objstream
> 2007-11-05 00:11:05.000000000 +0100
> +++ poppler-0.6.2/poppler-0.6.2/poppler/XRef.h	2007-11-28
> 12:23:02.000000000 +0100
> @@ -19,7 +19,36 @@
>  class Dict;
>  class Stream;
>  class Parser;
> -class ObjectStream;
> +
> +class ObjectStream {
> +public:
> +
> +  // Create an object stream, using object number <objStrNum>,
> +  // generation 0.
> +  ObjectStream(XRef *xref, int objStrNumA);
> +
> +  ~ObjectStream();
> +
> +  // Return the object number of this object stream.
> +  int getObjStrNum() { return objStrNum; }
> +
> +  // Get the <objIdx>th object from this stream, which should be
> +  // object number <objNum>, generation 0.
> +  Object *getObject(int objIdx, int objNum, Object *obj);
> +
> +  int *getOffsets() { return offsets; }
> +  Guint getFirstOffset() { return firstOffset; }
> +
> +private:
> +
> +  int objStrNum;		// object number of the object stream
> +  int nObjects;			// number of objects in the
> stream
> +  Object *objs;			// the objects (length =
> nObjects)
> +  int *objNums;			// the object numbers (length =
> nObjects)
> +  int *offsets;			// the object offsets (length =
> nObjects)
> +  Guint firstOffset;
> +};
> +
>
>  //------------------------------------------------------------------------
>  // XRef
> @@ -106,6 +135,7 @@ public:
>    int getSize() { return size; }
>    XRefEntry *getEntry(int i) { return &entries[i]; }
>    Object *getTrailerDict() { return &trailerDict; }
> +  ObjectStream *getObjStr() { return objStr; }
>
>    // Write access
>    void setModifiedObject(Object* o, Ref r);
>
>
>
> Is there any chance that something similar is included, or do you have
> any suggestion how to achieve the same as above using only the supplied
> headers of libpoppler.

This is a useless reminder: You should not be using libpoppler headers, we 
don't guarantee any kind of stability of them even in between minor releases.

Of course i also see you *need* more power than the one given by the -qt and -
glib frontends.

Albert

>
> Thanks and all the best
>
> Norbert
>
> ---------------------------------------------------------------------------
>---- Dr. Norbert Preining <preining at logic.at>        Vienna University of
> Technology Debian Developer <preining at debian.org>                        
> Debian TeX Group gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76 
> A9C0 D2BF 4AA3 09C5 B094
> ---------------------------------------------------------------------------
>---- LIFF (n.)
> A book, the contents of which are totally belied by its cover. For
> instance, any book the dust jacket of which bears the words. 'This
> book will change your life'.
> 			--- Douglas Adams, The Meaning of Liff
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler




More information about the poppler mailing list