Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

How to use wxHtmlEasyPrinting

by halweitz (Novice)
on Mar 15, 2013 at 20:14 UTC ( #1023768=perlquestion: print w/replies, xml ) Need Help??

halweitz has asked for the wisdom of the Perl Monks concerning the following question:

How do I print a HTML document in wxHtmlWindow so that it fits inside my page borders? The document displays correctly in the HtmlWindow. But, when I invoke HtmlEasyPrinting the print is too large and only the left portion of the document prints. I want to either scale the output to fit the page (preferred)or reduce the default margins so that it fits. I am using the default fonts on both the HtmlWindow and HtmlEasyPrinting and on the page setup dialog. I have found no easy way to change the latter inside my Perl script.

Replies are listed 'Best First'.
Re: How to use wxHtmlEasyPrinting
by Anonymous Monk on Mar 16, 2013 at 03:47 UTC

      Thanks for the reply. I installed Wx and Wx::Html (and a few others) last month so I'm pretty sure everything is up to date. The info on ::SetMarginTopLeft says this:

      wxPageSetupDialogData::SetMarginTopLeft void SetMarginTopLeft(const wxPoint& pt)

      Sets the left (x) and top (y) margins in millimetres.

      So, I think I need to pass an object of type wxPoint. Point has a constructor, two methods, Get, Set, and two properties, x, and y of type int. So, I code the following to set the properties to 5 millimeters.:

      my $point = Wx::Point->new; $point->Set(x=>5); $point->Set(y=>5);

      This gives me the following error: Can't locate object method "Set" via package "Wx::Point"

      So, I give up on that and instead pass an x, y pair as an array just to see what happens:

      my $printhtml = Wx::HtmlEasyPrinting->new(); my $psd = $printhtml->GetPageSetupData; #returns a pointer to PageSetu +pDialogData $psd->SetMarginBottomRight( [ 5, 5 ] );

      This gives me the following error message:

      usage: Wx::PageSetupDialogData::SetMarginBottomRight(THIS, point)

      So, now I see that it takes two parameters and I am still left with the question of how to specify the parameters (THIS, and point). BTW, I am very new to Perl and many of the examples assume far more Perl knowledge than I currently posses. A fleshed out working example would be GREATLY appreciated.

        So, I code the following to set the properties to 5 millimeters.:

        funny, where do you get that from?

         Wx::Point->new( x, y );

        my wxWidgets / wxPerl / wxGlade tutorial,

        A fleshed out working example would be GREATLY appreciated.

        :) I've no interest starting from scratch

        use Wx qw' :allclasses '; my $psdd = Wx::PageSetupDialogData->new; my $p = $psdd ->GetMarginBottomRight; print $p->y, ' ', $p->x, "\n"; $psdd->SetMarginBottomRight([6,6]); $p = $psdd ->GetMarginBottomRight; print $p->y, ' ', $p->x, "\n"; __END__ 0 0 6 6

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1023768]
Approved by ww
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2022-08-14 16:41 GMT
Find Nodes?
    Voting Booth?

    No recent polls found