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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 iexPdfiumCore FPDF_RenderPageBitmap error
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

aleatprog

132 Posts

Posted - Feb 13 2022 :  07:19:23  Show Profile  Reply
Hi,

I got a secondary VCL (frmPdfViewer) with TImageEnMView + attached TImageEnView with enabled PdfViewer which automatically loads a specific PDF file on show when launched in modal mode by the main VCL (frmMain).

Now, if frmPdfViewer.ShowModal is automatically launched at application start, the PDF file is loaded correctly. But when it is launched manually using an action, TImageEnMView misses one thumbnail. With my test files, in a 4 page PDF document it's always page 2, in a 12 page PDF document it's always page 5.

Clicking on the empty area of the missing thumbnail, the error message "Invalid floating point operation" appears while the thumbnail is loaded automatically.

Debugging, the error is raised by iexPdfiumCore, line 2005:

// DrawFlags: See "Page Rendering Flags"
procedure TPdfPage.DrawToPdfBitmap(APdfBitmap: TPdfBitmap; X, Y, Width, Height: Integer;
Rotate: TPdfPageRotation; const DrawFlags: Integer);
begin
Open();
FPDF_RenderPageBitmap( APdfBitmap.fBitmap, fPdfiumPage, X, Y, Width, Height, Ord(Rotate), DrawFlags );
end;

Does anybody got an idea?

Ale

xequte

38608 Posts

Posted - Feb 13 2022 :  17:42:56  Show Profile  Reply
Hi

Are you able to send me a simple demo that shows the issue?

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

aleatprog

132 Posts

Posted - Feb 14 2022 :  03:55:44  Show Profile  Reply
Good morning, Nigel,

things become even more frustrating. The demo I prepared for you using the TImageEnView and TImageEnMView component's default parameters works.

Seems that I have to face the problem by checking parameters and variables one by one. Uhhh ...

Ale
Go to Top of Page

aleatprog

132 Posts

Posted - Feb 14 2022 :  07:07:02  Show Profile  Reply
Hi Nigel,

unfortunately, I'm not able to reproduce the error with a demo, although I now solved the issue in the original application.

Both, the original + demo application, load files from a folder using an iteration on a StringGrid which contains the file paths:

ImageEnMView1.AppendImage(StringGrid1.Cells[0, i] + IEM_Path_Index_Delimiter);

Meanwhile this line works in the demo, it generates the error in the original app. The error disappears in the original app if I run the line without IEM_Path_Index_Delimiter:

ImageEnMView1.AppendImage(StringGrid1.Cells[0, i]);

I got no idea why in the original app the loading parameter of an ImageEnMView in VCL1 infuences a thumbnail of an ImageEnMView in VCL2 opened in modal mode. The thumbnail error happens also if the file path of the file loaded in modal is hardcoded in VCL2, thus without interacting with the StringGrid or opening the PDF file initially loaded in ImageEnMView in VCL1.

Thus the parameter IEM_Path_Index_Delimiter works in the demo, the malfunction isn't caused by the parameter itself.

Ale
Go to Top of Page

xequte

38608 Posts

Posted - Feb 15 2022 :  03:56:33  Show Profile  Reply
Hi Ale

It sounds like there is something else going on here.

Also, please note that IEM_Path_Index_Delimiter should always have an integer value after it.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

aleatprog

132 Posts

Posted - Feb 15 2022 :  06:55:27  Show Profile  Reply
Hi Nigel,

how is the correct usage of IEM_Path_Index_Delimiter?

1.) ImageEnMView1.AppendImage(Path + IEM_Path_Index_Delimiter); //stores wrong Path adding '::' to the file name
2.) ImageEnMView1.AppendImage(Path + IEM_Path_Index_Delimiter + 0); //doesn't compile as 0 is integer
3.) ImageEnMView1.AppendImage(Path + IEM_Path_Index_Delimiter + '0'); //stores wrong Path adding '::0' to the file name

I need to use IEM_Path_Index_Delimiter in order to load only the first page/frame of the file obtaining the correct ImageEnMView1.SelectedFilename.

Ale
Go to Top of Page

aleatprog

132 Posts

Posted - Feb 15 2022 :  13:44:49  Show Profile  Reply
Hi Nigel,

for the moment, I let the following function check and delete the Filename's '::' ending in order to proceed with development.

if RightStr(FileName, 2) = '::' then
  Delete(FileName, Length(FileName) - 1, 2);
Result := FileName;


Please, don't forget to let me know about the correct usage of IEM_Path_Index_Delimiter.

Ale
Go to Top of Page

xequte

38608 Posts

Posted - Feb 15 2022 :  14:25:19  Show Profile  Reply
Hi Ale

This is the correct method:

ImageEnMView1.AppendImage(Path + IEM_Path_Index_Delimiter + '0');

Can you tell me what problems is gives you?



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

aleatprog

132 Posts

Posted - Feb 16 2022 :  02:55:51  Show Profile  Reply
Hi Nigel,

with
Path := 'C:\Users\Nigel\Desktop\Test.jpg'


1.)
ImageEnMView1.AppendImage(Path + IEM_Path_Index_Delimiter);
causes
ImageEnMView1.SelectedFilename = 'C:\Users\Nigel\Desktop\Test.jpg::'


2.)
ImageEnMView1.AppendImage(Path + IEM_Path_Index_Delimiter + '0');
causes
ImageEnMView1.SelectedFilename = 'C:\Users\Nigel\Desktop\Test.jpg::0'


Ale
Go to Top of Page

aleatprog

132 Posts

Posted - Feb 21 2022 :  12:05:26  Show Profile  Reply
Hi Nigel,

had you been able to reproduce on your system the behaviour of IEM_Path_Index_Delimiter?

Al
Go to Top of Page

xequte

38608 Posts

Posted - Feb 21 2022 :  19:19:27  Show Profile  Reply
Hi Al

It is by design that filenames include the delimiter, e.g. Filename of C:\Users\Nigel\Desktop\Test.tiff::5 tells us that its image 5 of test.tiff.

But I will remove it from SelectedImage if the index is 0

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

aleatprog

132 Posts

Posted - Feb 23 2022 :  05:12:10  Show Profile  Reply
Hi Nigel,

rather than removing "::0" from SelectedImage/SelectedFilename, I suggest to add the delimiter information to the manual. : )

Who needs to modify the SelectedFilename can use a function.

Al
Go to Top of Page

xequte

38608 Posts

Posted - Feb 23 2022 :  15:11:15  Show Profile  Reply
Hi Al

I will improve the documentation.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: