You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Jay Berkenbilt <ej...@ql.org> on 2009/03/02 16:03:47 UTC

Re: Transparent Text

Duncan McGregor <du...@oneeyedmen.com> wrote:

> Hi
>
> I'm trying to work out how to write transparent text to overlay OCR
> data on top of its source image.
>
> I've seen it done in PDFs, but cannot find how to represent
> transparency in xsl:fo
>
> Thanks in anticipation
>
> Duncan McGregor

To fill in a bit of missing information here, transparent text in PDFs
is not done by tweaking aspects of how the text is displayed, like
transparent text or white on white.  It is a specific feature
supported by the PDF specification.  Specifically, there is an
argument to the Tr (text rendering) operator.  If you place

3 Tr

after your BT to begin a text stream, the resulting text will be
invisible.  This is the correct way of putting "hidden text" in a PDF
for overlaying OCR data on top of an image.

I suppose the PDF output system in fop would have to specifically
support this.

Hope that helps...

-- 
Jay Berkenbilt <ej...@ql.org>


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


Re: Transparent Text

Posted by Duncan McGregor <du...@oneeyedmen.com>.
You're a gent. I think I'm being saved by only really caring about  
Preview on Mac rather than Reader.

On 2 Mar 2009, at 15:20, Jay Berkenbilt wrote:

> Duncan McGregor <du...@oneeyedmen.com> wrote:
>
>> Thank you
>>
>> At present the text-behind-image trick is doing it for me, but when I
>> find its limitations I'll look into potentially patching fop.
>>
>> Cheers
>>
>> Duncan
>
> If you use white on white behind the image, you may be fine, but when
> I went down the path years ago (when writing an application to do what
> you're doing), I found that there were all sorts of refresh anomalies
> and cases where the text was momentarily visible.  Eventually, I got
> my hands on a hidden text PDF generated by one of Adobe's products and
> decoded the content streams to find the Tr operator, which is
> described in the PDF specification.  Surely xsl-fo isn't going to
> support that though.  Anyway, good luck, and I'm glad you have a
> solution that's working for you.  I just wanted to make sure the
> thread contained the fact that this text rendering operator was there
> since I went down this path myself in the past. :-)
>
> --Jay
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>


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


Re: Transparent Text

Posted by Jay Berkenbilt <ej...@ql.org>.
Duncan McGregor <du...@oneeyedmen.com> wrote:

> Thank you
>
> At present the text-behind-image trick is doing it for me, but when I
> find its limitations I'll look into potentially patching fop.
>
> Cheers
>
> Duncan

If you use white on white behind the image, you may be fine, but when
I went down the path years ago (when writing an application to do what
you're doing), I found that there were all sorts of refresh anomalies
and cases where the text was momentarily visible.  Eventually, I got
my hands on a hidden text PDF generated by one of Adobe's products and
decoded the content streams to find the Tr operator, which is
described in the PDF specification.  Surely xsl-fo isn't going to
support that though.  Anyway, good luck, and I'm glad you have a
solution that's working for you.  I just wanted to make sure the
thread contained the fact that this text rendering operator was there
since I went down this path myself in the past. :-)

--Jay

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


Re: Transparent Text

Posted by Duncan McGregor <du...@oneeyedmen.com>.
Thank you

At present the text-behind-image trick is doing it for me, but when I  
find its limitations I'll look into potentially patching fop.

Cheers

Duncan

On 2 Mar 2009, at 15:03, Jay Berkenbilt wrote:

> Duncan McGregor <du...@oneeyedmen.com> wrote:
>
>> Hi
>>
>> I'm trying to work out how to write transparent text to overlay OCR
>> data on top of its source image.
>>
>> I've seen it done in PDFs, but cannot find how to represent
>> transparency in xsl:fo
>>
>> Thanks in anticipation
>>
>> Duncan McGregor
>
> To fill in a bit of missing information here, transparent text in PDFs
> is not done by tweaking aspects of how the text is displayed, like
> transparent text or white on white.  It is a specific feature
> supported by the PDF specification.  Specifically, there is an
> argument to the Tr (text rendering) operator.  If you place
>
> 3 Tr
>
> after your BT to begin a text stream, the resulting text will be
> invisible.  This is the correct way of putting "hidden text" in a PDF
> for overlaying OCR data on top of an image.
>
> I suppose the PDF output system in fop would have to specifically
> support this.
>
> Hope that helps...
>
> -- 
> Jay Berkenbilt <ej...@ql.org>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>


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


Re: Transparent Text

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Good point. I missed that.

On 02.03.2009 16:03:47 Jay Berkenbilt wrote:
> Duncan McGregor <du...@oneeyedmen.com> wrote:
> 
> > Hi
> >
> > I'm trying to work out how to write transparent text to overlay OCR
> > data on top of its source image.
> >
> > I've seen it done in PDFs, but cannot find how to represent
> > transparency in xsl:fo
> >
> > Thanks in anticipation
> >
> > Duncan McGregor
> 
> To fill in a bit of missing information here, transparent text in PDFs
> is not done by tweaking aspects of how the text is displayed, like
> transparent text or white on white.  It is a specific feature
> supported by the PDF specification.  Specifically, there is an
> argument to the Tr (text rendering) operator.  If you place
> 
> 3 Tr
> 
> after your BT to begin a text stream, the resulting text will be
> invisible.  This is the correct way of putting "hidden text" in a PDF
> for overlaying OCR data on top of an image.
> 
> I suppose the PDF output system in fop would have to specifically
> support this.
> 
> Hope that helps...
> 
> -- 
> Jay Berkenbilt <ej...@ql.org>
> 



Jeremias Maerki


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