Author |
Topic  |
|
spetric
  
Croatia
308 Posts |
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 |
|
xequte
    
39053 Posts |
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
|
 |
|
yogiyang
   
India
727 Posts |
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 |
 |
|
spetric
  
Croatia
308 Posts |
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 |
 |
|
spetric
  
Croatia
308 Posts |
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
|
 |
|
xequte
    
39053 Posts |
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
|
 |
|
shxwinner
4 Posts |
Posted - Jan 12 2018 : 01:45:47
|
@spetric:
I want to know how to display text and select text . |
 |
|
spetric
  
Croatia
308 Posts |
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. |
 |
|
xequte
    
39053 Posts |
Posted - Mar 12 2021 : 17:28:14
|
PDFium will be supported in the next release of ImageEn.
Nigel Xequte Software www.imageen.com
|
 |
|
yogiyang
   
India
727 Posts |
Posted - Mar 22 2021 : 08:20:42
|
Hello Nigel,
That is really great.
Thanks for your efforts.
Yogi Yang |
 |
|
|
Topic  |
|