Thread Subject: Print figures with a patch object into a searchable pdf file

Subject: Print figures with a patch object into a searchable pdf file

From: OKO

Date: 14 Mar, 2008 21:36:00

Message: 1 of 2

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

Subject: Print figures with a patch object into a searchable pdf file

From: Richard Quist

Date: 28 Mar, 2008 00:02:01

Message: 2 of 2

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.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
epscombine Richard Quist 27 Mar, 2008 20:05:09
exportfig Richard Quist 27 Mar, 2008 20:05:09
transparency Richard Quist 27 Mar, 2008 19:43:25
print Richard Quist 27 Mar, 2008 19:43:25
pdf Richard Quist 27 Mar, 2008 19:43:25
painters Richard Quist 27 Mar, 2008 19:43:25
opengl Richard Quist 27 Mar, 2008 19:43:25
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com