[reportlab-users] Reportlab text not searchable in Apple OSX Preview.App? but searchable in Acrobat and google-pdf viewer ?
hari jayaram
harijay at gmail.com
Wed Aug 5 11:38:39 EDT 2009
Hmm..so It seems that Preview.App can only find things that are
partially-rotated or entirely un-rotated.
The only reason I am rotating the canvas to render the text is because I
want to generate the PDF in a landscape sense (see
http://github.com/harijay/protein-crystallization-gridmaker/blob/1ca03fd8aa85cd18b93ac63ff6447199d9799dcb/example1.pdf
)
Is there a simpler way to achieve "landscape" rendering than rotating the
canvas. Maybe that way may be Preview.App friendly.
I have written to one of the apple support discussion lists asking them why
Preview treats the PDF differently from every other PDF-reader out there
where search works..Lets see if I hear back from the Preview team.
Thanks everyone for your emails..
Hari
On Wed, Aug 5, 2009 at 11:28 AM, Peter <peter at maubp.freeserve.co.uk> wrote:
> On Wed, Aug 5, 2009 at 4:13 PM, Robin Becker<robin at reportlab.com> wrote:
> > ... I would guess the problem lies in the preview app.
> >
> > If you just substitutute 0 for 90 & -90 in the above then essentially the
> > same code as for the failing case is issued. Does the preview still fail?
> >
> > If the preview is actually rendering the pdf and then searching, the 0
> > degrees case should be searchable. If that's the way the search is
> happening
> > then it's no surprise that the search should fail if the rendered letters
> > are at 90deg.
>
> I just tied this:
>
> import reportlab.pdfgen.canvas as canvas
> c = canvas.Canvas("searchtext.pdf")
> c.rotate(0)
> textobj = c.beginText(10,10)
> textstring = "hello world with rotation of zero!"
> textobj.textLines(textstring)
> c.drawText(textobj)
> c.rotate(0)
> c.showPage()
> c.save()
>
> And Preview can search this (rotation of 0). I've also got a few other
> variations to work like 0.1 degrees. But not 60, 89 or 90 degrees.
>
> Interestingly at 45 degrees, Preview isn't getting all the words right,
> some have extra spaces. This means in the following example it
> can find "hello" and "45" but none of the other words:
>
> import reportlab.pdfgen.canvas as canvas
> c = canvas.Canvas("searchtext.pdf")
> c.rotate(45)
> textobj = c.beginText(10,-10)
> textstring = "hello world with rotation of 45!"
> textobj.textLines(textstring)
> c.drawText(textobj)
> c.rotate(-45)
> c.showPage()
> c.save()
>
>
> Peter
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20090805/cdc489c6/attachment.html>
More information about the reportlab-users
mailing list