ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 ImageEn and PDFium

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
spetric Posted - Dec 08 2017 : 18:24:59
Hi,

After some searching and testing I've managed to display PDF files in ImageEnView and ImageEnMView.
It's simple and it's free. What you need is PDfium.dll which you can get here:

https://github.com/bblanchon/pdfium-binaries

and here is a decent free Delphi code (more as example) on how to use PDFium:

https://github.com/ahausladen/PdfiumLib

The code can be rewritten to suite your needs. I've translated the code to C++, stripped it to the bone, got rid of explicit DLL function entry points and created separate classes for document(core) and page.

I've tried rendering with ImageEnView->IEBitmap and also with ImageEnMView (to show all PDF pages) and it works like a charm.
Here is a C++ example to show PDF page in ImageEnView (on button click event):


ImageEnView1->IEBitmap->AssignImage(new TIEBitmap(1024, 1280, ie24RGB));
//fill it with white color
ImageEnView1->IEBitmap->Fill(0x00ffffff);
// NOTE: fixed width and height can be replaced with width and height obtained // from PDFium calls. 
TPdfDocument *doc;
doc = new TPdfDocument(this);
doc->LoadFromFile("C:\\PDFS\\some_article.pdf", "", dloNormal);
TPdfPageRenderOptions Options;
HDC dc;
if (doc->Pages->Count)  
   {
   // let's display 6th page in ImageEnView
   doc->SelectPage(6);
   dc = ImageEnView1->IEBitmap->Canvas->Handle;
   doc->Page->Render(dc, 0, 0, ImageEnView1->IEBitmap->Width, ImageEnView1->IEBitmap->Height, 0, Options);
    ImageEnView1->Update();
    }
delete doc;




So, if anyone wants to create Delphi VCLs (I'll write them in C++) for reading and viewing PDFs in ImageEn displays, I think this is good starting point.

HTH,
Siniša
9   L A T E S T    R E P L I E S    (Newest First)
yogiyang Posted - Mar 22 2021 : 08:20:42
Hello Nigel,

That is really great.

Thanks for your efforts.

Yogi Yang
xequte Posted - Mar 12 2021 : 17:28:14
PDFium will be supported in the next release of ImageEn.

Nigel
Xequte Software
www.imageen.com
spetric Posted - Jan 12 2018 : 09:26:46
@shkxwinner

You must dig into PDfium. It contains a bunch of APIs for manipulating PDF content.
What I need for my project is displaying PDF pages, selecting pages, merging pages into new PDF and eventually extracting images from PDF pages.
shxwinner Posted - Jan 12 2018 : 01:45:47
@spetric:

I want to know how to display text and select text .
xequte Posted - Dec 17 2017 : 22:31:25
Thanks Spectric,

I'll take a look into this after the new year break.

Nigel
Xequte Software
www.imageen.com
spetric Posted - Dec 16 2017 : 15:03:17
Hi Nigel,

Here is a source code in C++:

attach/spetric/20171216145533_pdfium_example.zip
10.56 KB

It contains two components, two classes and one header: PdfGlobal.h
which is actually a subset of FPDF structures and function calls.

What's missing is static lib (IMPLIB pdfium.lib pdfium.dll).
Package is without project, but you'll get the picture.
The most significant part is code inside FinaPdfMViewAdapter.cpp which actually
renders PDF pages onto ImageEnMView images.

If you need complete package with source code and resource (with pallet images),
pleas let me know and I'll upload it.

Keep in mind that it's version 0.1.

With best regards,
Siniša






spetric Posted - Dec 11 2017 : 15:11:03
Hi Nigel,

No problem. I need to add some crucial function calls (like closing the loaded page, closing the document, etc..)
The code is little bit messy, but it works. Together with Delphi source code I mentioned in the first post, you'll probably get the picture.

I've tried rendering in ImageEnMView (IEBitmap canvas) and it worked with ie24RGB, ie8g and ie1g.

I'll post C++ code in few days.

With best regards,
Siniša
yogiyang Posted - Dec 11 2017 : 02:38:49
 
So, if anyone wants to create Delphi VCLs (I'll write them in C++) for reading and viewing PDFs in ImageEn displays, I think this is good starting point.

This is a better way to go actually. It would be easier for a developer to VCL that can installed along with IE to get new functionality added to IE!


Yogi Yang
xequte Posted - Dec 10 2017 : 22:08:28
Hi Sinisa

If you are OK with it, I'd like to look at your source code.

Though I understand if you prefer it to be private.


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com