Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: How to use wxHtmlEasyPrinting

by Anonymous Monk
on Mar 17, 2013 at 09:24 UTC ( #1023896=note: print w/ replies, xml ) Need Help??


in reply to Re^2: How to use wxHtmlEasyPrinting
in thread How to use wxHtmlEasyPrinting

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, http://www.wxperl.it/p/wxperl-primer.html

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


Comment on Re^3: How to use wxHtmlEasyPrinting
Select or Download Code
Re^4: How to use wxHtmlEasyPrinting
by halweitz (Novice) on Mar 18, 2013 at 21:29 UTC

    Thanks again. Your code was helpful although I am still not able to solve my issue. I reduced the margins to the minimum allowed by my printer but the rightmost few characters are still being truncated. Here is my code so far:

    sub ShowPrintPreview { my ($self, $event) = @_; # Printout class for HTML documents my $printout = Wx::HtmlEasyPrinting->new("Printing", $htmlwindow); # Get pointer to PageSetupDialogData instance my $psd = $printout->GetPageSetupData(); # Set the margins to fit the page $psd->SetMarginTopLeft([3,3]); $psd->SetMarginBottomRight([3,3]); # Preview the text $printout->PreviewText($htmlcontent); }

    I have tried to use SetFonts to reduce the font sizes on the preview page. The default sizes according to the wxwidgets.org are seven integers in the range -2 to +4. However only the third value, 0 seems to have any effect. When I change this from 0 to -1 the page text becomes too small to be readable. Changes to any of the other values seem to have no effect on the text size. Is there any way to scale the print out to fit a letter size page?

      ... Here is my code so far:

      Sorry but that won't run, you're missing $htmlwindow -- compare to my example

      I have tried to use SetFonts to reduce the font sizes on the preview page. The default sizes according to the wxwidgets.org are seven integers in the range -2 to +4. However only the third value, 0 seems to have any effect. When I change this from 0 to -1 the page text becomes too small to be readable.

      Try positive integers, because the docs say

      sizes This is an array of 7 items of int type. The values represent size of font with HTML size from -2 to +4 ( <FONT SIZE=-2> to <FONT SIZE=+4> ). Default sizes are used if sizes is NULL.

      So wxHTML_FONT_SIZE_3 is size=-1 and wxHTML_FONT_SIZE_5 is size=+1 or some such combination

      So try positive integers, like these (the wxHTML_FONT_SIZE_ constants no longer appear to be public )

      Is there any way to scale the print out to fit a letter size page?

      Sorry, I don't know. I imagine its possible, see
      wxperl_demo --show wxPrintPaperDatabase
      wxperl_demo --show wxPrinting

      If you look inside Wx::DemoModules::wxPrinting you'll see a wxPrintout subclass calling a wxDC::SetUserScale, centers/resizes the image -- but I've never tried it

        Ok, I'll try something along those lines. I don't really understand how defining larger values will result in a smaller printout but I won't know until I try. BTW the constructor for $htmlwindow is in the initialization subroutine.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1023896]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2014-09-15 04:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (145 votes), past polls