Hi Andreas, I read on session 8.4.2 of the pdf 1.7 spec (page 124) that: ----------------------------- The stack is a LIFO (last in, first out) data structure in which the contents of the graphics state may be saved and later restored using the following operators: •The q operator shall push a copy of the entire graphics state onto the stack. •The Q operator shall restore the entire graphics state to its former value by popping it from the stack.
NOTE: These operators can be used to encapsulate a graphical element so that it can modify parameters of the graphics state and later restore them to their previous values. **Occurrences of the q and Q operators shall be balanced within a given content stream** (or within the sequence of streams specified in a page dictionary’s Contents array). ----------------------------- I thought that ctm and others gs would be restored as stated in the second item above. But if it's not the case how can I restore The transformation matrix? If the **Occurrences of the q and Q operators shall be balanced within a given content stream** shouldn’t I extract them within the extracted image? Thanks, José -----Mensagem original----- De: Andreas Lehmkuehler [mailto:[email protected]] Enviada em: terça-feira, 26 de outubro de 2010 15:23 Para: [email protected] Assunto: Re: copy entire stream of a page ignoring images Hi, Am 26.10.2010 18:59, schrieb José Rodolfo Carrijo de Freitas: > Hi Andreas, > > > > I guess that I couldn’t express me very well. when I said: > > “I was wondering if the remaining operators which identifies image graphical > states would > > affect fonts and texts operators.” I want to mean that if that set of > graphical state could affect another operators outside the q-Q stack. > > > > I understand that ‘q’ saves the graphics state and ‘Q’ restore the gs saved > by q. Correct. > So if a set of operators are between q and Q, it would not affect anything > outside this block. Correct. > The thing is that I’m not removing any q/Q operators, and it seems to affect > other parts of the stream. > > > > One thing I noticed is that when I redraw the image, it creates another > stream, a new one just to the new image. > > At this case, I have 2 streams and my content stream is actually an array of > substreams as show in the figure: Still correct. > http://b.imagehost.org/view/0482/comparing-pdfs-in-pdfdebugger > > > > Is it possible that a gs of stream 1 affects an operator of stream 0 ? The streams will be concatenated. So there is no difference between 2 single streams and 1 stream combining two single streams. But you are probably missing one detail. Saving a gs doesn't mean that everything will be set to their initial value, especially the ctm will be still the same after a "q" command. In your example the ctm may have another value at the end of stream 0/the beginning of stream 1 than the value somewhere in between the stream from where you copied the command sequence. BR Andreas Lehmkühler

