GSoC Proposal: Implementing the FreeText annotation (Draft)

Tobias Deiminger haxtibal at posteo.de
Wed Mar 21 22:43:16 UTC 2018


Hi Dileep,

your proposal looks nice. There's just one important thing missing: Okular already let's you create FreeText annotations. The confusing thing is that they're called "inline notes" in Okulars manual, and they're represented as class TextAnnotation (with m_textType == TextAnnotation::InPlace) in Okular and Popplers QT5 frontend. Under the hood poppler generates a real FreeText annotation:

# qt5/src/poppler-annotation.cc
Annot* TextAnnotationPrivate::createNativeAnnot(::Page *destPage, DocumentData *doc)
{
    // ...
    PDFRectangle rect = boundaryToPdfRectangle(boundary, flags);
    if (textType == TextAnnotation::Linked)
    {
        pdfAnnot = new AnnotText(destPage->getDoc(), &rect);
    }
    else
    {
        GooString * da = toAppearanceString(textFont);
        pdfAnnot = new AnnotFreeText(destPage->getDoc(), &rect, da); // Here it is :-)
        delete da;
    }
    // ...
}

I don't know the original bug you're working on. I assume that what really is missing is the FreeTextTypeWriter behavior? You can check the ISO 32000 PDF standard for FreeTextTypeWriter (IT entry of the FreeText object).
@Oliver: Do you know?

You can also fire up okular in gdb and convince yourself

$ gdb okular
(gdb) b AnnotFreeText::AnnotFreeText
(gdb) r

# load document, create inline note => we hit popplers AnnotFreeText::AnnotFreeText constructor

Thread 1 "okular" hit Breakpoint 1, 0x00007fffce304220 in AnnotFreeText::AnnotFreeText(PDFDoc*, PDFRectangle*, GooString*)@plt () from /tmp/usr/lib/libpoppler-qt5.so.1
(gdb) bt
#0  0x00007fffce304220 in AnnotFreeText::AnnotFreeText(PDFDoc*, PDFRectangle*, GooString*)@plt () from /tmp/usr/lib/libpoppler-qt5.so.1
#1  0x00007fffce30d689 in Poppler::TextAnnotationPrivate::createNativeAnnot (
    this=0x7fffdc00ccb0, destPage=<optimized out>, doc=<optimized out>)
    at /home/tobias/workspace/OSScontrib/poppler/qt5/src/poppler-annotation.cc:1880
... backtrace shortened ...

Cheers
Tobias

Am Mittwoch, 21. März 2018, 21:29:44 CET schrieb Dileep Sankhla:
> Hello,
> 
> I am interested to participate with Okular in GSoC this year. I have
> written a draft proposal for the project.
> 
> Here is the link to my proposal:
> 
> https://docs.google.com/document/d/1STBOz7Qcw1Wj6qB7XBg9er-wbsVx3g7Sw945WcHJfWU/edit?usp=sharing
> 
> Any feedback or suggestion will be highly appreciated.
> 
> Thanks and Regards,
> Dileep Sankhla
> 
> 
> 
>



More information about the Okular-devel mailing list