caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: John Whitington <john@coherentgraphics.co.uk>
To: "Armaël Guéneau" <armael.gueneau@ens-lyon.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] ANN: CamlPDF 1.7
Date: Fri, 16 Aug 2013 12:06:21 +0100	[thread overview]
Message-ID: <520E07AD.9010509@coherentgraphics.co.uk> (raw)
In-Reply-To: <520E049C.5020502@ens-lyon.fr>

Hi,

Armaël Guéneau wrote:
> Hi,
>
> Le 15/08/2013 13:21, John Whitington a écrit :
>> The first new release of the CamlPDF library for a while is here:
>>
>> http://www.github.com/johnwhitington/camlpdf
>>
>> (Or, shortly, via OPAM.)
> Thanks!
>
> I have been playing with CamlPDF a bit, trying to do text extraction.
> I'm a total novice about the PDF format, so i might be doing it wrong,
> but I was wondering if there were facilities, in CamlPDF, to handle
> diacritics and ligatures.
>
> For example, when reading the PDF operators for "Université", I get
>
> Pdfops_TJ (Pdf.Array [Pdf.String "Universit"; Pdf.String "\019";
> Pdf.Real 486.; Pdf.String "e"])

So 0o019 looks like a floating acute in that encoding, followed by a 
kern of 486/1000 of a point to shift leftward, followed by an 'e'. So, 
this is an accented character built by composition of glyphs.

> For "efficient", with "ffi" being ligated, I get
>
> Pdfops_TJ (Pdf.Array [Pdf.String "e\014cient"])

In the font in use here, character 0o014 appears to be a single glyph 
for the ffi ligature.

> How can I convert these back, especially the ligature? I tried to use the
> conversion functions of Pdftext, like codepoints_of_text followed by
> utf8_of_codepoints, but that didn't seem to work. It's highly possible
> that I'm also doing it wrong here.

Drop me a note off-list with the example file and I'll take a look.

Text extraction is almost always possible with modern PDFs. With older 
PDFs, text extraction sometimes isn't possible. You can test this by 
trying to copy & paste the text in Adobe Reader -- if it comes out 
correct, CamlPDF will be able to extract the text too -- if not, it won't.

With Thanks,

-- 
John Whitington
Director, Coherent Graphics Ltd
http://www.coherentpdf.com/


  reply	other threads:[~2013-08-16 11:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-15 11:21 John Whitington
2013-08-15 14:21 ` oliver
2013-08-15 14:28   ` John Whitington
2013-08-15 16:17     ` Gerd Stolpmann
2013-08-15 18:39       ` oliver
2013-08-18 12:04         ` Adrien Nader
2013-08-18 14:04           ` Florent Monnier
2013-08-18 18:23             ` oliver
2013-08-15 18:40 ` oliver
2013-08-15 18:42   ` oliver
2013-08-16 10:53 ` Armaël Guéneau
2013-08-16 11:06   ` John Whitington [this message]
2013-08-16 11:45     ` Armaël Guéneau
2013-08-16 14:26       ` John Whitington
2013-08-21 12:01 ` oliver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=520E07AD.9010509@coherentgraphics.co.uk \
    --to=john@coherentgraphics.co.uk \
    --cc=armael.gueneau@ens-lyon.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).