Select to view content in your preferred language

Printing in A1, A2 and A3

5799
9
07-21-2010 02:42 PM
DavidChura
Emerging Contributor
Hello:

I am using Flexviewer, developing in Flex, i want to know how can print in A1, A2 or A3.
Tags (2)
0 Kudos
9 Replies
EjayLai
Deactivated User
When you hit print, the printer window comes up where you can make changes to the Preferences of the chosen printer...such as Orintation, color and size. I am not sure if that's what you are looking for. Or you are hoping to have a drop down list to allow user to pick the paper size to print? That will be nice, isn't it?
0 Kudos
DavidChura
Emerging Contributor
Hello:

Thanks for your answer, but i need to print more that the window show, because when i print only takes the window snapshot, but i want to take when i print in A2 print a 3x3 screen size and in one of these screen i put some aditional information.

Thanks for your help
0 Kudos
TonyCollins
Regular Contributor
Use the export method (rest) on each mapservice, you can pass in whatever extents you want.
0 Kudos
DavidChura
Emerging Contributor
Hello Tony:

Please, can you tell me: how can i use this method?

Best regards

David Chura
0 Kudos
DasaPaddock
Esri Regular Contributor
0 Kudos
MattiasEkström
Frequent Contributor
Has anyone tried this method for printing?
If I would try something like that, would it be possible to include graphicLayers and scalebar and things like that from the FlexViewer??
0 Kudos
Venkata_RaoTammineni
Regular Contributor
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:mx="library://ns.adobe.com/flex/mx"
               xmlns:esri="http://www.esri.com/2008/ags"
               xmlns:s="library://ns.adobe.com/flex/spark"
               pageTitle="Printing with Flex">
    <!--
         This sample shows you how to print a map.
    -->

    <s:layout>
        <s:VerticalLayout horizontalAlign="center"
                          paddingBottom="20"
                          paddingLeft="20"
                          paddingRight="20"
                          paddingTop="20"/>
    </s:layout>

    <fx:Script>
        <![CDATA[
            import mx.printing.FlexPrintJobScaleType;
            import mx.printing.FlexPrintJob;
            import mx.controls.Alert;

            private function doPrint(myFlexPrintJobScaleType:String):void
            {
                // Create an instance of the FlexPrintJob class.
                var myPrintJob:FlexPrintJob = new FlexPrintJob();

                // Start the print job.
                if (myPrintJob.start())
                {
                    try
                    {
                        // hide the zoom slider so it won't be printed
                        myMap.zoomSliderVisible = false;

                        // Add the panel to print.
                        myPrintJob.addObject(myPanel, myFlexPrintJobScaleType);

                        // turn the zoom slider back on
                        myMap.zoomSliderVisible = true;
                    }
                    catch (error:Error)
                    {
                        Alert.show(error.toString());
                    }
                    // Send the job to the printer.
                    myPrintJob.send();
                }
            }
        ]]>
    </fx:Script>

    <s:HGroup horizontalAlign="center">
        <s:Button click="doPrint(FlexPrintJobScaleType.NONE)" label="Print (without scaling)"/>
        <s:Button click="doPrint(FlexPrintJobScaleType.SHOW_ALL)" label="Print (fit on one page)"/>
    </s:HGroup>
    <s:Panel id="myPanel"
             width="100%" height="100%"
             title="Print Map">
        <esri:Map id="myMap">
            <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"/>
        </esri:Map>
    </s:Panel>
    <mx:Text htmlText="Read more about &lt;u&gt;&lt;a href='http://livedocs.adobe.com/flex/3/langref/mx/printing/package-detail.html' target='_blank' &gt;Flex printing&lt;/a&gt;&lt;/u&gt;."/>
</s:Application>


Check above code ...that might help you.
0 Kudos
MattiasEkström
Frequent Contributor
Thanks, but that doesn't help me. I have a working printing functionality, but just like David described above I think it would be nice to be able to print in a larger format that is larger than the screen size (and not just get an small picture that is re-sized which doesn't look good at all).
Tony mentioned using "the export method (rest) on each mapservice, you can pass in whatever extents you want."
And this is what I'm asking about, if anyone has tried that successfully.
0 Kudos
FaridurChoudhury
New Contributor
Try this. In theory it should work but not too sure about the practical feasibility.


  • Create MXD-based ArcGIS layouts for each print size with the map, legends, north arrow, scalebars, copyright statements etc. just like you would in normal print template

  • Create a Web service, one that both browser clients and server-based applications could call

  • Pass parameters such as the map services to include on the layout, the map extent, the path of the MXD template to use, and the GIS server that will perform the export

  •   Connects to the GIS server and use ArcObjects to build the request for the layout export.

  • The service passes the URL of the output file back to the client, which allows the user to download and display it. The output format can of course be any that ArcObjects supports, such as PDF, JPEG, PNG, EPS or SVG.



Excellent tip from GISi Blog: Creating a Print Service for High-quality Web GIS Output

It is always better to give the users a PDF as you are not depending on the browser's print which can be a real pain in the @@@.
0 Kudos