Recent

Author Topic: How to print with IpHtmlPanel?  (Read 14403 times)

Silvio Clécio

  • Guest
How to print with IpHtmlPanel?
« on: April 02, 2010, 04:22:55 am »
Hi all,

I try this:

Code: [Select]
uses
  PrintersDlgs;

procedure TForm1.FormCreate(Sender: TObject);
begin
  IpHtmlPanel1.OpenURL(ExtractFilePath(ParamStr(0)) + 'test.html');
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  IpHtmlPanel1.PrintPreview;
end;

But not work. Gives error SIGSEGV and selects the line 316 (PaintBox1.Width := round(OwnerPanel.PrintWidth * Scale);) of the IpHtmlPv Unit.

Sample in attached.

I used FPC-2.2.4-3/Lazarus-0.9.29 rv23335/Ubuntu-9.10

jesusr

  • Sr. Member
  • ****
  • Posts: 499
Re: How to print with IpHtmlPanel?
« Reply #1 on: April 02, 2010, 06:24:54 am »
what lazarus revision do you have? an AV in ipro preview was fixed in r23681, at least in windows your program works ok. will check linux later.

davesimplewear

  • Sr. Member
  • ****
  • Posts: 321
    • Davids Freeware
Re: How to print with IpHtmlPanel?
« Reply #2 on: April 02, 2010, 12:38:21 pm »
I ran it and had an access violation in Linux Mint 8 using version 0.9.29 FPC 2.5.1

Regards
Dave
All things considered insanity seems the best option

Silvio Clécio

  • Guest
Re: How to print with IpHtmlPanel?
« Reply #3 on: April 02, 2010, 08:15:35 pm »
Hello Jesus,

I downloaded a copy of the IPro from SVN, I made some changes and managed to run without AV. But when I using PrintPreview he returns  10403 pages (was to return only 1), and has nothing on the pages.

Silvio Clécio

  • Guest
Re: How to print with IpHtmlPanel?
« Reply #4 on: April 02, 2010, 08:23:02 pm »
Dave, please try this:

On iphtmlpv.pas Unit add:

Code: [Select]
(...)
uses
  {$IFDEF IP_LAZARUS}
  LCLType,
  GraphType,
  LCLIntf,
  Buttons,
  LResources, <<-- This
(...)

.
.
.

(...)
implementation

uses
  Printers;

{$IFNDEF IP_LAZARUS} -|
{$R *.DFM}           -|-- This
{$ENDIF}             -|
(...)

.
.
.

(...)
procedure TIpHTMLPreview.FormResize(Sender: TObject);
begin
  if OwnerPanel<>nil then
    SetZoom(Zoom); {force recalc of preview sizes}
end;

initialization
  {$I iphtmlpv.lrs} <<-- This

end.
(...)

And build Lazarus again :)

davesimplewear

  • Sr. Member
  • ****
  • Posts: 321
    • Davids Freeware
Re: How to print with IpHtmlPanel?
« Reply #5 on: April 02, 2010, 11:08:08 pm »
Hi Silvio, my iphtml.pas already has LResource unit declared see code extract
Code: [Select]
unit IpHtmlPv;



interface



uses

  {$IFDEF IP_LAZARUS}

  LCLType,

  GraphType,

  LCLIntf,

  Buttons,

  LResources,

  {$ELSE}

  Windows,

  {$ENDIF}
and it gave an AV with this.

Regards
Dave
All things considered insanity seems the best option

Silvio Clécio

  • Guest
Re: How to print with IpHtmlPanel?
« Reply #6 on: April 03, 2010, 08:07:33 am »
Hellow Dave, uninstall your copy, rename the old folder of the IPro to  turbopower_ipro_, and try this copy:

http://www.4shared.com/file/255859288/7cf63d96/turbopower_ipro.html

If not work can contact again :)

In my FPC-2.2.4-3/Lazarus-0.9.29 rv23335/Ubuntu-9.10 works, only not works PrintPreview right. :(

davesimplewear

  • Sr. Member
  • ****
  • Posts: 321
    • Davids Freeware
Re: How to print with IpHtmlPanel?
« Reply #7 on: April 03, 2010, 11:50:57 pm »
Hi Silvio, the print preview showed, but empty!

Regards
Dave
All things considered insanity seems the best option

davesimplewear

  • Sr. Member
  • ****
  • Posts: 321
    • Davids Freeware
Re: How to print with IpHtmlPanel?
« Reply #8 on: April 03, 2010, 11:55:30 pm »
Also taking a long time to load and shows up to 20992 pages available
All things considered insanity seems the best option

jesusr

  • Sr. Member
  • ****
  • Posts: 499
Re: How to print with IpHtmlPanel?
« Reply #9 on: April 05, 2010, 01:37:19 am »
in r24419 I commited a fix for this problem. Please check.

davesimplewear

  • Sr. Member
  • ****
  • Posts: 321
    • Davids Freeware
Re: How to print with IpHtmlPanel?
« Reply #10 on: April 05, 2010, 02:33:16 am »
Hi Jesusr is that lazarus release 24419 or turbopower release 24419 ?, (sorry if it seems a silly question).

Regards
Dave

PS I Use the CodeTyphon Version and it has no SVN number: their release date 2010-6-3
All things considered insanity seems the best option

Silvio Clécio

  • Guest
Re: How to print with IpHtmlPanel?
« Reply #11 on: April 05, 2010, 02:33:50 am »
I tried to compile and gave error by the absence of TLCLTextMetric type. I commented the lines that gave error, e.g:

Code: [Select]
  procedure ApplyProps;
(...)
  var
    Changed : Boolean;
(*    {$IFDEF IP_LAZARUS}
    TextMetrics : TLCLTextMetric;
    {$ELSE}*)
    TextMetrics : TTextMetric;
//    {$ENDIF}(...)
Code: [Select]
(...)
          PropA.SetKnownSizeOfSpace(SizeOfSpace);
          PropA.KnownSizeOfHyphen := SizeOfHyphen;
        end;
        if Changed then begin
          if PropA.tmHeight = 0 then begin
(*            {$IFDEF IP_LAZARUS}
            aCanvas.GetTextMetrics(TextMetrics);
            PropA.tmAscent := TextMetrics.Ascender;
            PropA.tmDescent := TextMetrics.Descender;
            PropA.tmHeight := TextMetrics.Height;
            {$ELSE}*)
            GetTextMetrics(aCanvas.Handle, TextMetrics);
            PropA.tmAscent := TextMetrics.tmAscent;
            PropA.tmDescent := TextMetrics.tmDescent;
            PropA.tmHeight := TextMetrics.tmHeight;
//            {$ENDIF}
          end;
(...)

And just so I could build, but the error persists:

http://imagebin.org/91676

1144 empty pages (my page is only 1). :(

jesusr

  • Sr. Member
  • ****
  • Posts: 499
Re: How to print with IpHtmlPanel?
« Reply #12 on: April 05, 2010, 06:49:14 am »
Hi Jesusr is that lazarus release 24419 or turbopower release 24419 ?, (sorry if it seems a silly question).

Regards
Dave

PS I Use the CodeTyphon Version and it has no SVN number: their release date 2010-6-3

That should be Lazarus revision 24419, which is also turbopower ipro last revision because it's included with Lazarus. I don't follow CodeTyphon releases so I don't know when the change will be available in their release.

jesusr

  • Sr. Member
  • ****
  • Posts: 499
Re: How to print with IpHtmlPanel?
« Reply #13 on: April 05, 2010, 06:54:45 am »
I tried to compile and gave error by the absence of TLCLTextMetric type. I commented the lines that gave error, e.g:

...

And just so I could build, but the error persists:

http://imagebin.org/91676

1144 empty pages (my page is only 1). :(

You shouldn't comment any code, It looks as if you didn't recompile the LCL, you can check the commit at http://svn.freepascal.org/cgi-bin/viewvc.cgi?view=rev&root=lazarus&sortby=rev&sortdir=down&revision=24419 there are changes in graphics.pp, canvas.inc and postscriptcanvas.pas files which belong to LCL.

Silvio Clécio

  • Guest
Re: How to print with IpHtmlPanel?
« Reply #14 on: April 05, 2010, 07:57:55 am »
Hellow Jesus,

I think these errors are happening because I do not follow the Lazarus SVN. I will  follow from April (at the launch of the new Ubuntu).

This time these errors occurred:

Code: [Select]
/usr/lib/lazarus/lcl/graphics.pp(1035,14) Error: There is no method in an ancestor class to be overridden: "TCanvas.GetClipping:Boolean;"
/usr/lib/lazarus/lcl/graphics.pp(1036,15) Error: There is no method in an ancestor class to be overridden: "TCanvas.SetClipping(const Boolean);"
/usr/lib/lazarus/lcl/graphics.pp(1612,85) Error: Identifier not found "TFPResourceHandle"
/usr/lib/lazarus/lcl/graphics.pp(1882,1) Fatal: There were 3 errors compiling module, stopping
I replaced the old files by new files of SVN.

I think this will only be solved if I use Lazarus SVN, I'll do that soon.  ;)

My friend, thank you for your help, it was very important for me to understand other good properties of the IPro. :)

 

TinyPortal © 2005-2018