Return-Path: X-Original-To: apmail-xmlgraphics-general-archive@www.apache.org Delivered-To: apmail-xmlgraphics-general-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 331949D48 for ; Tue, 6 Mar 2012 21:44:53 +0000 (UTC) Received: (qmail 68148 invoked by uid 500); 6 Mar 2012 21:44:52 -0000 Mailing-List: contact general-help@xmlgraphics.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: general@xmlgraphics.apache.org Delivered-To: mailing list general@xmlgraphics.apache.org Delivered-To: moderator for general@xmlgraphics.apache.org Received: (qmail 85591 invoked by uid 99); 6 Mar 2012 19:07:36 -0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of thomathom@gmail.com designates 74.125.82.182 as permitted sender) Received-SPF: pass (google.com: domain of thomathom@gmail.com designates 10.216.138.38 as permitted sender) client-ip=10.216.138.38; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thomathom@gmail.com designates 10.216.138.38 as permitted sender) smtp.mail=thomathom@gmail.com; dkim=pass header.i=thomathom@gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=OUwGHoPsVoXLPiF4zCSZChnGCK0W56poRmIkkW4WQpo=; b=KorYxBRUc2wo9nbjPon+99Gp84qwmhfKdrKh8A8dWuWFNIQU7Qpr8GNIULUIsKqRTf ph0ylk7wVcTSHG0PKgFZnxqfGaYm48zlChkxgeJgxYg62uo0PrjxTEJO7FQt8owb0/Mt IxrkRco96+S+81jSLkGqxsMtOkE8XkqvUsIczE3llX98vpW5vPCgi2l+GxcKm7TjX99d Zn+zKLfI70KqoNi5/47AJQRLO9Dao8VUYTRvc4d3XEstu3vAZBRyvCv2weYlxxUMloA+ WTe38BQtnslK0b9KZC5Rrd148HxGy6b7aNkEkj6HaQg1GZDF+ybAvcReKJyS0O8QZL0E 3T1w== MIME-Version: 1.0 Date: Tue, 6 Mar 2012 14:07:08 -0500 Message-ID: Subject: How to use native text with EPSDocumentGraphics2D? From: Thomas Smith To: general@xmlgraphics.apache.org Content-Type: multipart/mixed; boundary=0016e6dd8e4be4696304ba97bfc8 X-Virus-Checked: Checked by ClamAV on apache.org --0016e6dd8e4be4696304ba97bfc8 Content-Type: multipart/alternative; boundary=0016e6dd8e4be4695c04ba97bfc6 --0016e6dd8e4be4695c04ba97bfc6 Content-Type: text/plain; charset=ISO-8859-1 Hi, I'd like to use XML Graphics Commons's EPSDocumentGraphics2D to generate output that includes the text as text, not as rendered shapes. Is there a straightforward way to do that? I've tried including both xmlgraphics-commons-1.4.jar and fop-1.0.jar in my project, and using the NativeTextHandler class from org.apache.fop.render.ps, like this... OutputStream out = new FileOutputStream("mini-test.eps"); EPSDocumentGraphics2D g2d = new EPSDocumentGraphics2D(false); g2d.setGraphicContext(new GraphicContext()); g2d.setCustomTextHandler(new NativeTextHandler(g2d, null)); g2d.setupDocument(out, 200, 100); g2d.setFont(new Font("Helvetica", Font.PLAIN, 12)); g2d.drawString("Hi there", 50, 50); g2d.finish(); out.close(); But it generates invalid EPS files, like the one attached. Here's the output from Adobe Acrobat Pro... %%[ Error: typecheck; OffendingCommand: findfont ]%% Stack: /Font -null- %%[ Flushing: rest of job (to end-of-file) will be ignored ]%% %%[ Warning: PostScript error. No PDF file produced. ] %% If I leave out the NativeTextHandler line, it generates valid EPS files, but you can't e.g. copy and paste the text from the file. Any help appreciated! I'm not on the mailing list, so please CC me... -Thomas --0016e6dd8e4be4695c04ba97bfc6 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,

I'd like to use XML Graphics Commons's=A0EPS= DocumentGraphics2D to generate output that includes the text as text, not a= s rendered shapes. =A0Is there a straightforward way to do that?
=
I've tried including both xmlgraphics-commons-1.4.jar and fo= p-1.0.jar in my project, and using the NativeTextHandler class from org.apache.fop.render.ps, like thi= s...

OutputStream out =3D new FileOutputStream("mini-test.eps");<= /div>
EPSDocume= ntGraphics2D g2d =3D new EPSDocumentGraphics2D(false);
g2d.setGraphicConte= xt(new GraphicContext());
g2d.= setCustomTextHandler(new NativeTextHandler(g2d, null));
g2d.setupDocument(= out, 200, 100);
g2d.= setFont(new Font("Helvetica", Font.PLAIN, 12));
g2d.drawString(&= quot;Hi there", 50, 50);
g2d.= finish();
out.close();

But it generates inv= alid EPS files, like the one attached. =A0Here's the output from Adobe = Acrobat Pro...

%%[ Error: typecheck; OffendingCommand: findfont ]= %%

Stack:
/Font
-null-


%%[ Flushing: rest of job (to end-of-file)= will be ignored ]%%
%%[ Warning: PostScript error. No PDF file produced. ] %%
<= div>

If I leave out the NativeTextHandler line= , it generates valid EPS files, but you can't e.g. copy and paste the t= ext from the file.

Any help appreciated!
I'm not on the mail= ing list, so please CC me...
-Thomas
--0016e6dd8e4be4695c04ba97bfc6-- --0016e6dd8e4be4696304ba97bfc8 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org For additional commands, e-mail: general-help@xmlgraphics.apache.org --0016e6dd8e4be4696304ba97bfc8--