here is some code for just printing a table public function generatePDF2():void { var myCoreFont1:IFont = new CoreFont ( FontFamily.ARIAL ); myPDF = new PDF(Orientation.PORTRAIT, Unit.MM, Size.TABLOID); myPDF.setDisplayMode( Display.FULL_PAGE, Layout.SINGLE_PAGE ); myPDF.addPage(); myPDF.setFont(myCoreFont1, 12); myPDF.addText('List of Development Services Projects - Status', 11, 10); myPDF.setFont(myCoreFont1, 8); myPDF.addText('Printed:' + dateFormatter.format(now.toLocaleDateString()), 180, 10); var gridColumnOwner1:GridColumn = new GridColumn("Project Name", "Name", 90, Align.LEFT, Align.LEFT); var gridColumnOwner2:GridColumn = new GridColumn("Condition", "Color", 18, Align.LEFT, Align.LEFT); var gridColumnAddress:GridColumn = new GridColumn("Status", "Status", 20, Align.LEFT, Align.LEFT); var gridColumnMailCity:GridColumn = new GridColumn("Next Step", "Cur_Status", 20, Align.LEFT, Align.LEFT); var gridColumnMailStat:GridColumn = new GridColumn("Department", "DS_Department", 35, Align.LEFT, Align.LEFT); var gridColumnManager:GridColumn = new GridColumn("Project Manager", "Manager", 35, Align.LEFT, Align.LEFT); var gridColumnCost:GridColumn = new GridColumn("Project Assistant", "Assistant", 35, Align.LEFT, Align.LEFT); myPDF.setFont(myCoreFont1, 8); myPDF.textStyle ( new RGBColor ( 0x000000 ), 1 ); //resultsGrid is the name of the datagrid var grid:Grid = new Grid (resultsGrid.dataProvider.toArray(), 0, 0, new RGBColor (0xC0C0C0), new RGBColor (0xCCCCCC), true , new RGBColor(0x000000), 1, Joint.ROUND); var columns:Array = new Array (gridColumnOwner1,gridColumnOwner2, gridColumnAddress, gridColumnMailCity, gridColumnMailStat, gridColumnManager, gridColumnCost); grid.columns = columns; myPDF.addGrid(grid, 1, 6); //export to pdf web service myPDF.save(Method.REMOTE, "name of server",Download.INLINE,"myPDF.pdf"); }
public function generatePDF2():void { var myCoreFont1:IFont = new CoreFont ( FontFamily.ARIAL ); myPDF = new PDF(Orientation.PORTRAIT, Unit.MM, Size.TABLOID); myPDF.setDisplayMode( Display.FULL_PAGE, Layout.SINGLE_PAGE ); myPDF.addPage(); myPDF.setFont(myCoreFont1, 12); myPDF.addText('List of Development Services Projects - Status', 11, 10); myPDF.setFont(myCoreFont1, 8); myPDF.addText('Printed:' + dateFormatter.format(now.toLocaleDateString()), 180, 10); var gridColumnOwner1:GridColumn = new GridColumn("Project Name", "Name", 90, Align.LEFT, Align.LEFT); var gridColumnOwner2:GridColumn = new GridColumn("Condition", "Color", 18, Align.LEFT, Align.LEFT); var gridColumnAddress:GridColumn = new GridColumn("Status", "Status", 20, Align.LEFT, Align.LEFT); var gridColumnMailCity:GridColumn = new GridColumn("Next Step", "Cur_Status", 20, Align.LEFT, Align.LEFT); var gridColumnMailStat:GridColumn = new GridColumn("Department", "DS_Department", 35, Align.LEFT, Align.LEFT); var gridColumnManager:GridColumn = new GridColumn("Project Manager", "Manager", 35, Align.LEFT, Align.LEFT); var gridColumnCost:GridColumn = new GridColumn("Project Assistant", "Assistant", 35, Align.LEFT, Align.LEFT); myPDF.setFont(myCoreFont1, 8); myPDF.textStyle ( new RGBColor ( 0x000000 ), 1 ); //resultsGrid is the name of the datagrid var grid:Grid = new Grid (resultsGrid.dataProvider.toArray(), 0, 0, new RGBColor (0xC0C0C0), new RGBColor (0xCCCCCC), true , new RGBColor(0x000000), 1, Joint.ROUND); var columns:Array = new Array (gridColumnOwner1,gridColumnOwner2, gridColumnAddress, gridColumnMailCity, gridColumnMailStat, gridColumnManager, gridColumnCost); grid.columns = columns; myPDF.addGrid(grid, 1, 6); //export to pdf web service myPDF.save(Method.REMOTE, "name of server",Download.INLINE,"myPDF.pdf"); }
attached is the code I used in my application. Any questions let me know
our suite of apps parses the layers in each map service the apps will use via rest calls (an admin app that sets which users/groups can use which map services/tools, etc). that includes the legends. that's all stored in a sql server table & this reporting tool simply pulls that data out of the table & adds it to the PDF.the map template is from arcMap. i get a PDF of that blank template & measure out the available space for the legend, etc. using a PDF tool (foxit for example)--mainly because the designers either don't know or won't say the space available for each piece of the template. those become constants. the legend,etc. tables are built in server memory & measured against the available space.if they fit, they go in, if not they get added to a supplemental page (next iteration will measure rows & fit as many as possible instead of this binary approach).if you can read coldfusion, i'll try to get a generic example together.
oops didn't see this until just now. sorry no, its the clients. but if you have specific questions i can probably whip up generic cf code.
I ran a quick test and it is possible using alivePDF, just add your legend as a component to the map and you can use the addimage property in alivePDf to add the legend as an image to the report.
Hi ,Has anyone tried to include the Legend using this code?I need to include the Legend on the map, but no luck .Please help.
Hello Paul. Would you mid sharing the source code in CF? Thanks.
we use coldfusion + iText for this server side. we build the attribute tables dynamically, measure their sizes once the tables are filled w/data, then merge them w/the PDF map document produced by the AGS print task, sticking what fits in the map's white space & dumping what doesn't onto supplemental pages. iText gives you an insane amount of control, coldfusion lets us glue this altogether more easily. i suppose anything server side that can talk to java or c# an be used w/iText (it has java & c# versions).we've tried purePDF (partial AS3 port of iText) & alivePDf client side but we found these too slow & lacking some functionality.
I was able to accomplish this using AlivePDF, it is an open source PDF printing API. You can take any of the columns of a datagrid and publish that into a PDF report. You can also take display features (like a map) and print them as images in the report. I attached two sample reports, one is a list out of a datagrid, the other is an inspection report and shows a map. When pulling data from a datagrid it honors the sort.
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.