#!/usr/bin/perl -w use perlchartdir; use CGI qw(:standard); use strict; no warnings; use RTF::Writer; use constant mm => 25.4/72; use constant in => 1/72; use constant pt => 1; #------------------------------------------------------------------------------------------# #-------------------------- Main Variables (email,fonts,graphics, ect.) -------------------# #------------------------------------------------------------------------------------------# my $q = new CGI; print $q->header( "application/rtf" ); my %valueHash; my $fh; my $RTF_obj; #--> File variables #-----------------------> my $ID = "12345"; my $currencySymbol = $valueHash{"CurrencySymbol"}; my $rtfReport = "rtf_PCWS$ID".'.rtf'; my $rtfReportDel = "rtf_PCWS$ID".'.rtf'; my $CompanyName = "Company Name"; #-------------------------------------------------------------------------------------------------------------------------------------------------# #------------------------------------------------------------- START RTF -------------------------------------------------------------------------# #-------------------------------------------------------------------------------------------------------------------------------------------------# #--> Declare new rtf object either save to disk or save to string #$fh = RTF::Writer->new_to_file($rtfReport); $fh = RTF::Writer->new_to_string(\$RTF_obj); #--> MUST write a prolog - font and color table (RGB) #--> Font: when calling font use \f0 (or number of the array, to change font size double the size #--> example: for 12 point font do - \fs24 $fh->prolog( fonts => ['Arial'], colors => [ undef, # color 0 == black [255,0,0], # color 1 == red [0,128,0], # color 2 == green [0,0,255], # color 3 == blue [255,255,0], # color 4 == yellow [255,255,255],# color 5 == white [200,200,200],# color 6 == light gray [187,204,224],# color 7 == table blue [144,172,202],# color 8 == table header blue [102,102,102],# color 9 == gray ], ); #--> Setting up margins (these MUST be here) #----------------------------------------------> my $iMarginLeftInches = my $iMarginRightInches = 500; my $iMarginTop = 500; #--> Need bigger bottom margin for footer to fit: #-------------------------------------------------> my $iMarginBottom = 500; my $iMarginLeft = $iMarginLeftInches; my $iMarginRight = $iMarginRightInches; eval "\$fh->Margt$iMarginTop"; eval "\$fh->Margl$iMarginLeft"; eval "\$fh->Margr$iMarginRight"; eval "\$fh->Margb$iMarginBottom";