xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <...@jeremias-maerki.ch>
Subject Re: Looking for PDF selectable text from PDFTranscoder
Date Wed, 21 Dec 2005 21:38:40 GMT
The first problem you'll have to fix is to set KEY_STROKE_TEXT to false.
Otherwise, all text is painted as shapes and is therefore not selectable.
However, not all text is per se selectable. Some more complex text
operations cannot (yet) be rendered using text operations. Furthermore,
we have some problems getting text painted as text at all. It depends on
the version in use. I expect this situation to get better with the next
Batik release.

There's another problem. You mention that you're using chinese
characters. Even if the text is painted as text you will currently not
be able to select the text because of a missing feature in FOP's PDF
library. Furthermore, it would only work if you properly register and
provide the necessary TrueType fonts as described in [1]. But again, due
to the missing feature that doesn't bring you closer to your goal.

[1] http://wiki.apache.org/xmlgraphics-fop/SvgNotes/PdfTranscoderTrueTypeEmbedding

So, I'm afraid you're currently out of luck and won't be able to achieve
selectable text. There's work planned to fix the problem with TrueType
fonts but I currently can't give an exact timeframe.

On 21.12.2005 21:56:17 Michael Lindeboom wrote:
> I am testing the PDFTranscoder. I see through he following example 
> (http://xmlgraphics.apache.org/fop/dev/svg/text.pdf) that the text is 
> selectable in some cases. Is there a transcoder setting that is required 
> to generate selectable text in the resulting PDF document?
> So far the SVG content that I have tried to transform to PDF does not 
> have selectable text. Note: My examples also have some unicode for 
> chinese characters.
> My code is below.
>         InputStream ins = new 
> ByteArrayInputStream(svglabel.renderLabelContent().getBytes());
>         PDFTranscoder t = new PDFTranscoder();
>         t.addTranscodingHint(PDFTranscoder.KEY_EXECUTE_ONLOAD, new 
> Boolean(true));
>         t.addTranscodingHint(PDFTranscoder.KEY_STROKE_TEXT, new 
> Boolean(true));
>         TranscoderInput input = new TranscoderInput(ins);
>         OutputStream ostream = new FileOutputStream(svgFile.getFile());
>         TranscoderOutput output = new TranscoderOutput(ostream);
>         t.transcode(input, output);
>         ostream.flush();
>         ostream.close();
> Michael

Jeremias Maerki

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

View raw message