You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Blake McBride <bl...@gmail.com> on 2016/03/10 22:14:01 UTC

How to turn text mode back on?

Hi,

Using 2.x here.  I understand that I need to exit text mode via
contentStream.endText() before printing things like lines.  Fine.  But, if
I contentStream.endText(), and print some lines, how can I re-enable text
mode?  I tried contentStream.beginText() but it didn't work.  Sure
appreciate any help!

Blake McBride

Re: How to turn text mode back on?

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 10.03.2016 um 22:32 schrieb Blake McBride:
> Thanks.  I suppose my question is, how can I switch back and forth between
> text and graphics mode on the same page?  There would be no nesting, just
> sequential switching back and forth.  Can I do that, or am I restricted to
> only a single text mode per page?

You can do it as often as you want.

You wrote "I tried contentStream.beginText() but it didn't work" - what 
happened? Nothing? Could it be that the text is outside of the screen?

A good idea is to save and restory the graphics state, to avoid messing 
things up.

Tilman

>
> Thanks.
>
> Blake
>
>
> On Thu, Mar 10, 2016 at 3:25 PM, John Hewson <jo...@jahewson.com> wrote:
>
>>> On 10 Mar 2016, at 13:14, Blake McBride <bl...@gmail.com> wrote:
>>>
>>> Hi,
>>>
>>> Using 2.x here.  I understand that I need to exit text mode via
>>> contentStream.endText() before printing things like lines.  Fine.  But,
>> if
>>> I contentStream.endText(), and print some lines, how can I re-enable text
>>> mode?  I tried contentStream.beginText() but it didn't work.  Sure
>>> appreciate any help!
>> These methods just emit PDF’s begin text (BT) and end text (ET) operators.
>> Basically, you only need to use them when you switch between text and
>> graphics. You can put as many lines and paragraphs of text as you like
>> inside
>> a single BT, ET pair:
>>
>> BT
>>    text….
>>    text....
>>    text...
>> ET
>>
>> The text operators between BT and ET can draw text, update the text matrix,
>> make new lines, etc. Note that BT, ET are *never* nested.
>>
>>> Blake McBride
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: How to turn text mode back on?

Posted by Blake McBride <bl...@gmail.com>.
Thanks.  With everyone's feedback, I was able to find the bug in my own
code.

Blake

On Thu, Mar 10, 2016 at 3:45 PM, John Hewson <jo...@jahewson.com> wrote:

>
> > On 10 Mar 2016, at 13:32, Blake McBride <bl...@gmail.com> wrote:
> >
> > Thanks.  I suppose my question is, how can I switch back and forth
> between
> > text and graphics mode on the same page?  There would be no nesting, just
> > sequential switching back and forth.  Can I do that, or am I restricted
> to
> > only a single text mode per page?
>
> You can switch between them as many times as you like.
>
> > Thanks.
> >
> > Blake
> >
> >
> > On Thu, Mar 10, 2016 at 3:25 PM, John Hewson <jo...@jahewson.com> wrote:
> >
> >>
> >>> On 10 Mar 2016, at 13:14, Blake McBride <bl...@gmail.com> wrote:
> >>>
> >>> Hi,
> >>>
> >>> Using 2.x here.  I understand that I need to exit text mode via
> >>> contentStream.endText() before printing things like lines.  Fine.  But,
> >> if
> >>> I contentStream.endText(), and print some lines, how can I re-enable
> text
> >>> mode?  I tried contentStream.beginText() but it didn't work.  Sure
> >>> appreciate any help!
> >>
> >> These methods just emit PDF’s begin text (BT) and end text (ET)
> operators.
> >> Basically, you only need to use them when you switch between text and
> >> graphics. You can put as many lines and paragraphs of text as you like
> >> inside
> >> a single BT, ET pair:
> >>
> >> BT
> >>  text….
> >>  text....
> >>  text...
> >> ET
> >>
> >> The text operators between BT and ET can draw text, update the text
> matrix,
> >> make new lines, etc. Note that BT, ET are *never* nested.
> >>
> >>> Blake McBride
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> >> For additional commands, e-mail: users-help@pdfbox.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: How to turn text mode back on?

Posted by John Hewson <jo...@jahewson.com>.
> On 10 Mar 2016, at 13:32, Blake McBride <bl...@gmail.com> wrote:
> 
> Thanks.  I suppose my question is, how can I switch back and forth between
> text and graphics mode on the same page?  There would be no nesting, just
> sequential switching back and forth.  Can I do that, or am I restricted to
> only a single text mode per page?

You can switch between them as many times as you like.

> Thanks.
> 
> Blake
> 
> 
> On Thu, Mar 10, 2016 at 3:25 PM, John Hewson <jo...@jahewson.com> wrote:
> 
>> 
>>> On 10 Mar 2016, at 13:14, Blake McBride <bl...@gmail.com> wrote:
>>> 
>>> Hi,
>>> 
>>> Using 2.x here.  I understand that I need to exit text mode via
>>> contentStream.endText() before printing things like lines.  Fine.  But,
>> if
>>> I contentStream.endText(), and print some lines, how can I re-enable text
>>> mode?  I tried contentStream.beginText() but it didn't work.  Sure
>>> appreciate any help!
>> 
>> These methods just emit PDF’s begin text (BT) and end text (ET) operators.
>> Basically, you only need to use them when you switch between text and
>> graphics. You can put as many lines and paragraphs of text as you like
>> inside
>> a single BT, ET pair:
>> 
>> BT
>>  text….
>>  text....
>>  text...
>> ET
>> 
>> The text operators between BT and ET can draw text, update the text matrix,
>> make new lines, etc. Note that BT, ET are *never* nested.
>> 
>>> Blake McBride
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: How to turn text mode back on?

Posted by Blake McBride <bl...@gmail.com>.
Thanks.  I suppose my question is, how can I switch back and forth between
text and graphics mode on the same page?  There would be no nesting, just
sequential switching back and forth.  Can I do that, or am I restricted to
only a single text mode per page?

Thanks.

Blake


On Thu, Mar 10, 2016 at 3:25 PM, John Hewson <jo...@jahewson.com> wrote:

>
> > On 10 Mar 2016, at 13:14, Blake McBride <bl...@gmail.com> wrote:
> >
> > Hi,
> >
> > Using 2.x here.  I understand that I need to exit text mode via
> > contentStream.endText() before printing things like lines.  Fine.  But,
> if
> > I contentStream.endText(), and print some lines, how can I re-enable text
> > mode?  I tried contentStream.beginText() but it didn't work.  Sure
> > appreciate any help!
>
> These methods just emit PDF’s begin text (BT) and end text (ET) operators.
> Basically, you only need to use them when you switch between text and
> graphics. You can put as many lines and paragraphs of text as you like
> inside
> a single BT, ET pair:
>
> BT
>   text….
>   text....
>   text...
> ET
>
> The text operators between BT and ET can draw text, update the text matrix,
> make new lines, etc. Note that BT, ET are *never* nested.
>
> > Blake McBride
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: How to turn text mode back on?

Posted by John Hewson <jo...@jahewson.com>.
> On 10 Mar 2016, at 13:14, Blake McBride <bl...@gmail.com> wrote:
> 
> Hi,
> 
> Using 2.x here.  I understand that I need to exit text mode via
> contentStream.endText() before printing things like lines.  Fine.  But, if
> I contentStream.endText(), and print some lines, how can I re-enable text
> mode?  I tried contentStream.beginText() but it didn't work.  Sure
> appreciate any help!

These methods just emit PDF’s begin text (BT) and end text (ET) operators.
Basically, you only need to use them when you switch between text and
graphics. You can put as many lines and paragraphs of text as you like inside
a single BT, ET pair:

BT
  text….
  text....
  text...
ET

The text operators between BT and ET can draw text, update the text matrix,
make new lines, etc. Note that BT, ET are *never* nested.

> Blake McBride


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org