Hi!

I have succesfully compiled PoDoFo on Android.
However when I'm trying to open a PDF file it always fails complaining
that the file has no EOF marker.

It turns out that the Seek() call that is supposed to move the device
to the end just before checking for the marker is failing.

The problem is that it PdfInputDevice::Seek() accepts a std::ios_base::seekdir
as parameter, which is then passed to the standard C library fseek().
This is wrong since the values of seekdir are implementation defined
( see http://en.cppreference.com/w/cpp/io/ios_base/seekdir ) and on
Android they don't match with the SEEK_CUR/SEEK_END/SEEK_SET macros
defined in stdio.h.

A solution is to remap the parameter inside PdfInputDevice::Seek() as follows:

        int seek = SEEK_SET;
        switch(dir)
        {
                case std::ios_base::end:
                        seek = SEEK_END;
                break;
                case std::ios_base::cur:
                        seek = SEEK_CUR;
                break;
                default:
                break;
        }
        fseeko( m_pFile, off, seek );

Thank you for the support.

--

Szymon Tomasz Stefanek

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to