pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Moses Mosese <mosesm.mos...@gmail.com>
Subject Re: rich text editor to pdf
Date Tue, 06 May 2014 06:24:33 GMT
Hi Maruan,

Thanks for the reply. I am new to the user list concept. I just couldnt
figure out how i was gonna update my post (of course i could have tried to
lookup the docs somewhere).
Yesterday i actually added the implementation for the rendering part to old
version of itext (4.2.1).
HTMLWorker htmlWorker = new HTMLWorker(document);
htmlWorker.parse(new StringReader(richTextStringValue));

I am excited about pdfbox, so will keep an eye.

Thanks lots,
Moses



On Tue, May 6, 2014 at 7:37 AM, Maruan Sahyoun <sahyoun@fileaffairs.de>wrote:

> Hi Moses,
>
> using HTML styled content as a fields value is called Rich Text in PDF
> terms. This rich text is applied differently to a field than normal text.
> At this point in time PDFBox doesn’t have a high level API to set rich text
> but you could use the lower level COS model provided by PDFBox to set the
> necessary information for the field.
>
> Here is a short example of how rich text is specified inside a field’s
> properties
>
> /RV (<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xtml"
> xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"
> xfa:contentType="text/html" xfa:APIVersion="Acrobat:8.0.0" xfa:spec="2.4">
> <p style="text-align:left">
>
> <b> <i>
>
> Here is some bold italic text </i>
>
> </b> </p>
>
> <p style= "font-size:16pt">
>
> This text uses default text state parameters but changes the font size to
> 16. </p>
>
> </body> )
>
> As you can see there are some tags supported which are familiar from HTML
> as the Rich Text part is a subset of XHTML. More details of what’s
> permitted can be found in section 12.7.3.4 of the ISO 32000-1 specification.
>
>
>
> If you do use PDFBox for rendering purposes at this point in time PDFBox
> wouldn’t be able to render such Rich Text but use the pure value and some
> other information of the field to render the fields content.
>
>
> BR
> Maruan Sahyoun
>
>
> Am 04.05.2014 um 18:54 schrieb Moses Mosese <mosesm.mosese@gmail.com>:
>
> > Hi,
> > I have a requirement to display values that were entered with rich text
> > editor (they contain html tags), on pdf document.
> > Can pdfbox cater for this?
> >
> > Currently i use, *drawString
> > <
> http://pdfbox.apache.org/docs/1.8.4/javadocs/org/apache/pdfbox/pdmodel/edit/PDPageContentStream.html#drawString(java.lang.String)
> >*
> > (String<
> http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true
> >
> > text), to display and it shows html tags as they are.
> >
> > Thanks lot,
> > Moses
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message