I'm looking into calling PDFium from Pharo via FFI.
Currently I'm stalled a bit since it doesn't have a shared-library target.

If you consider access to such a library would be useful to the community,
please take a few moments to star this issue...
https://bugs.chromium.org/p/pdfium/issues/detail?id=826

cheers -ben


P.S. Can anyone comment on calling into a static library via FFI?



On Wed, Oct 11, 2017 at 2:05 PM, Ben Coman <b...@openinworld.com> wrote:

>
>
> On Wed, Oct 11, 2017 at 2:03 PM, Ben Coman <b...@openinworld.com> wrote:
>
>>
>> > On Tue, Oct 10, 2017 at 8:58 PM, Manuel Leuenberger
>> > <leuenber...@inf.unibe.ch> wrote:
>> > > Hi,
>> > >
>> > > I want to view a PDF within Pharo. I found that Athens has a PDF
>> canvas, but I have no idea how to use it. Is there a way to view a PDF
>> within Pharo, so that I can scroll, zoom, click links etc. in the PDF?
>> > >
>> > > Cheers,
>> > > Manuel
>>
>>
>> On Wed, Oct 11, 2017 at 3:04 AM, Stephane Ducasse <
>> stepharo.s...@gmail.com> wrote:
>> >
>> > Hi manuel
>> >
>> > So far I do not know if we have this is Pharo.
>> > I imagine that we would have to build a renderer once we will have the
>> > PDF reader from Christian library.
>> >
>> > Stef
>>
>>
> [Edit: Update license link]
>
>
>> A renderer will have great synergy with PDFTalk, but I think a proof of
>> concept can be done independently.
>> I've been poking at this topic for a while looking for options.
>> Coincidentally a couple of days I discovered the PDFium library.
>> I haven't had time yet to give it a run, but it seems a good candidate
>> since...
>> * Its a successful commercial product by Foxit built into Chrome
>> converted to open source with Google's backing for use in Chromium
>>        https://www.foxitsoftware.com/company/press.php?id=305
>> * Its license is BSD style
>>        *https://github.com/hfiguiere/pdfium/blob/master/LICENSE
>> <https://github.com/hfiguiere/pdfium/blob/master/LICENSE>*
>> * Although written in C++ it has a C interface
>>       https://github.com/hfiguiere/pdfium/blob/master/public/fpdfview.h
>>       * Search here on  " Function: "  to skim through
>>       * Proof of concept seems to only need these key functions...
>>           * void    FPDF_RenderPageBitmap( FPDF_BITMAP bitmap,FPDF_PAGE
>> page, ... )
>>           * FPDF_BITMAP    FPDFBitmap_Create( int width, int height, int
>> alpha);
>>           * FPDF_PAGE   FPDF_LoadPage   ( FPDF_DOCUMENT document, int
>> page_index )
>>           * FPDF_DOCUMENT   FPDF_LoadMemDocument   ( const void* data_buf
>> ... )
>>           * void    FPDF_InitLibrary ()
>> * Has a concise getting started for POC...
>>       https://github.com/hfiguiere/pdfium/blob/master/docs/getting
>> -started.md
>> * Maybe useful fork with V8 disabled by default
>>       https://github.com/klokantech/pdfium
>> * Master repo here
>>       https://pdfium.googlesource.com/pdfium/
>>
>> So Pharo might load a PDF file into a ByteArray, pass that to
>> FPDF_LoadMemDocument() & FPDF_LoadPage(),
>> then get a bitmap back from FPDFBitmap_Create() & FPDF_RenderPageBitmap()
>> and display the result in a Pharo window.
>>
>> The rest of this week I'm working 12 hour days on a mine site.  I could
>> try it out once I'm home, but in the meantime is anyone else keen to try
>> it?
>>
>> cheers -ben
>>
>
>

Reply via email to