I don't think there is much that can be done in terms of scaling the image without distortion...sometimes the image will just not fill up the entire pdf. So I modified the placement of the titleblock and map. Now the titleblock is at the top and the map below...that way the map can never overlap the titleblock. If interested copy the code below and replace everything below '//create a landscape map' in the PDFWidget.mxml posted above...else //create a landscape map
{
//create landscape letter-size pdf and set margins
landPDF=new PDF(Orientation.LANDSCAPE,Unit.MM,Size.LETTER);
landPDF.setDisplayMode(Display.FULL_PAGE,Layout.SINGLE_PAGE);
landPDF.setMargins(2,2,2,2);
landPDF.addPage();
//add PDF document metadata--most people never notice but give credit where due
//and create a "well-formed" pdf document
landPDF.setTitle(txtTitle.text);
landPDF.setSubject(pdfSubject);
landPDF.setAuthor(pdfAuthor);
landPDF.setKeywords(pdfKeywords);
landPDF.setCreator(pdfCreator);
//draw neat line
//landPDF.drawRect(new Rectangle(2,2,275,212));
//draw title block rectangle
landPDF.drawRect(new Rectangle(3,3,273,32));
//add logo image
landPDF.addImageStream(new myLogoJPG() as ByteArray,"DeviceRGB",null,3,5,40,0,0,1,Blend.NORMAL,null);
//add title text entered in widget input
landPDF.setFont(timesboldFont,22);
landPDF.addText(txtTitle.text,50,10);
//add subtitle text entered in widget input
landPDF.setFont(timesFont,16);
landPDF.addText(txtSubtitle.text,50,17);
//add some disclaimer text
var landDisclaimerLine1:String="DISCLAIMER: This map is for informational purposes and has not been prepared for, nor is it suitable for legal, surveying, or engineering purposes. Users of this information ";
var landDisclaimerLine2:String="should review or consult the primary data and information sources to ascertain the usability of the information. The XXXXXXXXXXXXXX makes no warranty or ascertain ";
var landDisclaimerLine3:String="the usability of the information. The XXXXXXXXXXXXX makes no warranty or guarantee as to the content, accuracy, timeliness, or completeness of any of the data";
var landDisclaimerLine4:String="provided, and assumes no legal responsibility for the information contained hereon.";
landPDF.setFont(arialFont,8);
landPDF.addText(landDisclaimerLine1,50,21);
landPDF.addText(landDisclaimerLine2,50,24);
landPDF.addText(landDisclaimerLine3,50,27);
landPDF.addText(landDisclaimerLine4,50,30);
//add copyright text
landPDF.setFont(arialFont,9);
landPDF.addText(copyright,50,33);
//add print timestamp
landPDF.setFont(arialFont,8);
var nowLand:String = getCurrentDateTime();
landPDF.addText("Printed: " + nowLand,5,7);
//add the map
var rsLand:Resize=new Resize("FitToPage","left");
landPDF.addImage(map,rsLand,2,35,0,0,0,1,false,ImageFormat.JPG,100,Blend.NORMAL,null);
//save the pdf
const fileReferenceLand:FileReference = new FileReference();
fileReferenceLand.save(landPDF.save(Method.LOCAL,"",Download.INLINE,"landPDF.pdf"),"map.pdf");
}
}
]]>
</fx:Script>
<viewer:WidgetTemplate id="wTemplate" height="190" width="300">
<mx:ViewStack id="viewStack" width="100%" height="100%" creationPolicy="all">
<mx:VBox width="100%" height="100%" verticalGap="10" paddingTop="10">
<mx:Form id="frmPrint" verticalScrollPolicy="off" paddingBottom="0" width="100%" height="100%">
<mx:FormItem label="{titleLabel}" styleName="WidgetText" width="100%">
<mx:TextInput id="txtTitle" text="{title}" />
</mx:FormItem>
<mx:FormItem label="{subtitleLabel}" styleName="WidgetText" width="100%">
<mx:TextInput id="txtSubtitle" text="{subtitle}" />
</mx:FormItem>
<!--mx:FormItem label="Label"-->
<mx:ToggleButtonBar id="pgOrient" selectedIndex="-1" itemClick="setPageOrientation(event);">
<mx:dataProvider>
<fx:Array>
<!--fx:String>Portrait</fx:String-->
<!--fx:String>Landscape</fx:String-->
</fx:Array>
</mx:dataProvider>
</mx:ToggleButtonBar>
<!--/mx:FormItem-->
<mx:HBox horizontalAlign="center" width="100%">
<mx:Button label="{submitLabel}" click="makePDF(event)" />
</mx:HBox>
<mx:Spacer width="100%" height="1" />
<s:Label text=" Be patient while PDF is building..." fontStyle="normal" fontSize="12" />
</mx:Form>
</mx:VBox>
</mx:ViewStack>
</viewer:WidgetTemplate>
</viewer:BaseWidget>