Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Print figures with a patch object into a searchable pdf file
Date: Fri, 28 Mar 2008 00:02:01 +0000 (UTC)
Organization: The MathWorks Inc
Lines: 79
Message-ID: <fshchp$nfq$1@fred.mathworks.com>
References: <d25ee624-f5e5-4564-9560-d3fa5e925835@e6g2000prf.googlegroups.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1206662521 24058 172.30.248.37 (28 Mar 2008 00:02:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 28 Mar 2008 00:02:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1034498
Xref: news.mathworks.com comp.soft-sys.matlab:459574



OKO <yuanjiabei@gmail.com> wrote in message
<d25ee624-f5e5-4564-9560-d3fa5e925835@e6g2000prf.googlegroups.com>...
> I used patch in Matlab to generate transparent object for
a figure.
> Then the figure need to be exported into a pdf file. The last
> requirement is that, in the generated pdf file, the values
(axis and
> characters) need to be searchable, that means you can use
text-cursor
> to select those single value or characters.
> 
> I tried two methods, but each of them only reach partially my
> requirement. So I was wondering if anyone can find a
complete solution
> to this.
> 
> Thanks in advance.
> 
> OKO
> 
> 
> Matlab Codes:
> 
> %_____figure with a transparent object:______
> 
> x = [0.8, 1.6, 1.6, 1.2, 0.8];
> y = [0.6, 1.2, 1.2, 0.9, 0.6];
> z = [1, 1, 2, 1.7, 2];
> patch(x, y, z, 'g','EdgeColor','none','FaceAlpha',0.3)
> axis equal
> box on
> view([35, 30])
> 
> %______Solution 1:_____________________
> print('-painters','-dpdf','-r100','c:\test.pdf')
> %this is similar as using 'copy figure' in menu, paste
into word, and
> print as adobe pdf file
> %the drawback of this method is that, the transparent
object in the
> figure becomes non-transparent!
> 
> %______Solution 2:_____________________
> print('-dtiff','-noui','-r100','c:\1')
> %create a tif file and then convert it into pdf using adobe
> professional 8.0
> %the figure in pdf is non-searchable
> 
> The
> advantage                           and
> disadvantage
> Solution 1                          value in pdf is
> searchable                                      lose
transparent
> object
> Solution 2                       transparent object kept in
> pdf                          vaues in pdf is not
> searchable
> 

As you've seen, each of the renderers have different
capabilities - painters, which allows you to make a
searchable pdf doesn't support transparency; opengl supports
transparency, but doesn't generate vector output (required
to be searchable). 

You **MIGHT** be able to use exportfig from the file
exchange to output the text and graphics into 2 separate
files and then combine them (there's an epscombine also on
the file exchange)... Finally, you could call out to
ghostscript to convert the eps file into a pdf...

It's not pretty, but it might work.

-

Richard Quist
Software Developer
The MathWorks, Inc.