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

Peter peter at maubp.freeserve.co.uk
Wed Aug 5 09:23:09 EDT 2009


On Wed, Aug 5, 2009 at 2:05 PM, hari jayaram<harijay at gmail.com> wrote:

> I also tried the test code :

> import reportlab.pdfgen.canvas as canvas

> c = canvas.Canvas("searchtext.pdf")

> c.rotate(90)

> textobj = c.beginText(10,-10)

> textstring = "Dispense File Prefix: %s" % "hello world"

> textobj.textLines(textstring)

> c.drawText(textobj)

> c.rotate(-90)

> c.showPage()

> c.save()

> And that gave the attached pdf which fails search for any of the contained

> text in Preview.App ( Picture 21 .png)

> I dont know what I am doing wrong

> Thanks for your help troubleshooting this. Hope the problem does not lie in

> Preview.App because the same pdfs are searchable in google pdf ( gmail)

> reader and in Acrobat .

> Hari


Confirmed using Mac OS X 10.5.7, and the example script above:

Preview Version 4.2 (469.5), does NOT find "hello"
Adobe Acrobat Professional 8.1.6 does find "hello"

Note that if I remove the rotation, then Apple's Preview search
works. This looks like a bug in Apple's Preview tool to me.

In case it matters, I'm using this version of report lab:


>>> import reportlab

>>> reportlab.Version

'2.1'

>>> reportlab.__version__

' $Id: __init__.py 3093 2007-05-24 10:08:18Z rgbecker $ '

Peter


More information about the reportlab-users mailing list