[reportlab-users] Reportlab text not searchable in Apple OSX Preview.App? but searchable in Acrobat and google-pdf viewer ?

Bill Janssen janssen at parc.com
Tue Aug 4 22:27:17 EDT 2009


hari jayaram <harijay at gmail.com> wrote:


> I noticed however that the text laden pdfs I am rendering are not searchable

> using Apple Mac (Leopard) OSX Preview.App

>

> When I use the built in search within Preview.App only single characters

> light up ( only single characters show matches like a , b , c , d ) No words

> light up..


Works fine for me, generating PDFs with ReportLab 2.2 and searching with Preview.

I add my text to the PDF a word at a time, with this code:

textobj = mycanvas.beginText(word.left, word.baseline)
textobj.setTextRenderMode(INVISIBLE_MODE)
textstring = word.text.strip().encode('latin-1', 'replace')
textobj.textLines(textstring)
mycanvas.drawText(textobj)

Incidentally, can I switch to UTF-8 these days?

Bill


More information about the reportlab-users mailing list