URGENT : Display file PDF in a FORM
Hi,
I have this scenario. I must display a file PDF in an type item-form.
How Can I do it??
Someone have a some examples.
Kind regard.
Giordano
The problem is that Adobe don't supply a suitable control that we could use.
They used to supply a JavaBean that could be integrated into Forms (and indeed I did do it) but that is very old and they don't support it - I'm not sure you can even download it any more.
A simple method would be to create your webpage with two frames - run the Form in one and show the PDF with show_document in the other.
Similar Messages
-
Displaying a PDF for a form on web browser in Web Dynpro Abap
Hey
I have a form (a set of input elements) on a view
Now i want that as soon as i press execute , a pdf form is displayed with the values entered on the view.
Thanks
Shivi GoelHi ,
you can refer below links for interactive forms.
[http://www.sdn.sap.com/irj/scn/logon?redirect=https%3a%2f%2fwww.sdn.sap.com%2firj%2fscn%2finteractiveforms-elearning]
[http://help.sap.com/saphelp_nw70ehp1/helpdata/en/d1/af8841349e1909e10000000a155106/frameset.htm]
[http://wwwimages.adobe.com/www.adobe.com/enterprise/partners/pdfs/solution_in_detail_interactive_forms.pdf]
[http://help.sap.com/saphelp_nw2004s/helpdata/en/b7/64348655fb46149098d95bdca103d0/frameset.htm]
Reagrds,
Priya -
Store and Display doc/pdf files in the database using Forms
Hi all,
How can i store and display doc/pdf files in the database using Forms 10g?.
ArifHow to get up and running with WebUtil 1.06 included with Oracle Developer Suite 10.1.2.0.2 on a win32 platform
Solution
Assuming a fresh "Complete" install of Oracle Developer Suite 10.1.2.0.2,
here are steps to get a small test form running, using WebUtil 1.06.
Note: [OraHome] is used as an alias for your real oDS ORACLE_HOME.
Feel free to copy this note to a text editor, and do a global find/replace on
[OraHome] with your actual value (no trailing slash). Then it is easy to
copy/paste actual commands to be executed from the note copy.
1) Download http://prdownloads.sourceforge.net/jacob-project/jacob_18.zip
and extract to a temporary staging area. Do not attempt to use 1.7 or 1.9.
2) Copy or move jacob.jar and jacob.dll
[JacobStage] is the folder where you extracted Jacob, and will end in ...\jacob_18
cd [JacobStage]
copy jacob.jar [OraHome]\forms\java\.
copy jacob.dll [OraHome]\forms\webutil\.
The Jacob staging area is no longer needed, and may be deleted.
3) Sign frmwebutil.jar and jacob.jar
Open a DOS command prompt.
Add [OraHome]\jdk\bin to the PATH:
set PATH=[OraHome]\jdk\bin;%PATH%
Sign the files, and check the output for success:
[OraHome]\forms\webutil\sign_webutil [OraHome]\forms\java\frmwebutil.jar
[OraHome]\forms\webutil\sign_webutil [OraHome]\forms\java\jacob.jar
4) If you already have a schema in your RDBMS which contains the WebUtil stored code,
you may skip this step. Otherwise,
Create a schema to hold the WebUtil stored code, and privileges needed to
connect and create a stored package. Schema name "WEBUTIL" is recommended
for no reason other than consistency over the user base.
Open [OraHome]\forms\create_webutil_db.sql in a text editor, and delete or comment
out the EXIT statement, to be able to see whether the objects were created witout
errors.
Start SQL*Plus as SYSTEM, and issue:
CREATE USER webutil IDENTIFIED BY [password]
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp;
GRANT CONNECT, CREATE PROCEDURE, CREATE PUBLIC SYNONYM TO webutil;
CONNECT webutil/[password]@[connectstring]
@[OraHome]\forms\create_webutil_db.sql
-- Inspect SQL*Plus output for errors, and then
CREATE PUBLIC SYNONYM webutil_db FOR webutil.webutil_db;
Reconnect as SYSTEM, and issue:
grant execute on webutil_db to public;
5) Modify [OraHome]\forms\server\default.env, and append [OraHome]\jdk\jre\lib\rt.jar
to the CLASSPATH entry.
6) Start the OC4J instance
7) Start Forms Builder and connect to a schema in the RDBMS used in step (4).
Open webutil.pll, do a "Compile ALL" (shift-Control-K), and generate to PLX (Control-T).
It is important to generate the PLX, to avoid the FRM-40039 discussed in
Note 303682.1
If the PLX is not generated, the Webutil.pll library would have to be attached with
full path information to all forms wishing to use WebUtil. This is NOT recommended.
8) Create a new FMB.
Open webutil.olb, and Subclass (not Copy) the Webutil object to the form.
There is no need to Subclass the WebutilConfig object.
Attach the Webutil.pll Library, and remove the path.
Add an ON-LOGON trigger with the code
NULL;
to avoid having to connect to an RDBMS (optional).
Create a new button on a new canvas, with the code
show_webutil_information (TRUE);
in a WHEN-BUTTON-PRESSED trigger.
Compile the FMB to FMX, after doing a Compile-All (Shift-Control-K).
9) Under Edit->Preferences->Runtime in Forms Builder, click on "Reset to Default" if
the "Application Server URL" is empty.
Then append "?config=webutil" at the end, so you end up with a URL of the form
http://server:port/forms/frmservlet?config=webutil
10) Run your form.sarah -
Display BLOB File (pdf format) from database inside Oracle Form (6i)
hi all.
Apologies for a primitive question owing to the fact that i m new to development. I have a requirement to display a pdf document with in an oracle form. i want to know is there any such control for that? or any hint how to go about it?
thanks in advanceHere I have found my jsp script...
How I get the PDF?
I call my script from pl/sql with
web.show_document('http://my_server/getblob.jsp?id=' || id_from_my_blob_table || '&baza=myhost:1521:sid','_blank');
<%@ page contentType="text/html;charset=windows-1250"%>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.text.*" %>
<%@ page import="oracle.jdbc.driver.OracleDriver" %>
<%@ page import="oracle.jdbc.driver.OracleResultSet" %>
<%
Connection con = null;
Statement stmt = null;
ResultSet rs= null;
oracle.sql.CLOB clob = null;
oracle.sql.BLOB blob = null;
String datoteka = "";
String host = "http://" + request.getHeader("host") + "/";
%>
<!--Peter Valencic 2003 -->
<html>
<head>
<title></title>
</head>
<%
String tip ="";
String id ="";
String baza ="";
String shema ="";
try
id = request.getParameter("id");
baza = request.getParameter("baza");
shema = request.getParameter("shema");
if (request.getParameter("id")== null)
throw new Exception("id= null");
else if(request.getParameter("id").equals(""))
throw new Exception("id= null");
if (request.getParameter("baza")== null)
throw new Exception("baza= null");
else if(request.getParameter("baza").equals(""))
throw new Exception("baza= null");
if (request.getParameter("shema") == null)
shema ="";
else if (request.getParameter("shema").equalsIgnoreCase(""))
shema="";
else
shema =shema + ".";
catch(Exception e)
out.println("Priąlo je do napake: " + e.toString());
return;
try
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc:oracle:thin:@"+baza,"your_user","your_password");
stmt =con.createStatement();
rs = stmt.executeQuery ("Select * from "+shema+"DOK_VSEBINA_DOKUMENTA_BLOB where ID="+id);
boolean podatkib = rs.next();
if (!podatkib)
out.print("<li>Ni podatkov za ID="+id);
return;
blob = ((oracle.jdbc.OracleResultSet)rs).getBLOB("VSEBINA");
datoteka = rs.getString("NAZIV_DATOTEKE").toUpperCase();
File blobFile = new File(application.getRealPath("/uploads/blob")+"/"+datoteka);
blobFile.createNewFile();
InputStream podatki = blob.getBinaryStream();
FileOutputStream strBlob= new FileOutputStream(blobFile);
int size = blob.getBufferSize();
byte[] buffer = new byte[size];
int length = -1;
while ((length = podatki.read(buffer)) != -1)
strBlob.write(buffer,0,length);
podatki.close();
strBlob.close();
con.close();
out.print("<li>"+host+"in2/uploads/blob/"+datoteka);
response.sendRedirect(host+"in2/uploads/blob/"+datoteka);
//odpremo z jsp-stranjo datoteko..
//response.sendRedirect("");
catch(Exception blobException)
out.print("<li>(BLOB)Napaka pri prebiranju podatkov:</li>"+blobException.toString());
return;
out.println("konec..");
%>
<body>
<form method="post">
Vnesi ID
<input type=text name="id">
<li> <input type=submit name="potrdi" >
</form>
</body>
</html>If you look my "old" script..
first it get 2 parameters baza= database (ip:port:sid), id= id from my table (PK)
at the end of my script I have:
response.sendRedirect(host+"in2/uploads/blob/"+datoteka);
this redirect will redirect you to your file stored on server side..
Because IE knows what file it must open it will open it with PDF reader...
hope this help you..
Edited by: peterv6i.blogspot.com on May 14, 2012 11:14 AM -
How can I display a PDF file in an html file?
When a user opens a specific page I want to be able to show them the PDF of the form they need to print out.
If this was an image 9such as JPEG) then there would be no problem, but a PDF is causing me to wrack my brain.
I know how to pen the PDF in a new window, but I want the menu I created to be at the top.
You can see the site here: <http://www.peterforkes.com/NevadaWomensCare/index.html>
If you click on the Doctors menu and select, say Dr. Robert A. Gatlin you will see that I have an area where I can display information, on the left side of the page.
But, I want this page <http://www.peterforkes.com/NevadaWomensCare/UsefulForms/NewPatientRegistrationForm.pdf> to show in the contents area, with the menus along the top.
How do I achieve this?There is no advantage in embedding printer-friendly PDF pages into HTML. One is a print document. The other is a web page. Best to keep them separate.
And for reasons you may not have considered, site visitors might not have the appropriate plug-ins necessary to view PDF in browsers. If you link directly to the file, your site visitors can download it and open it in Acrobat or some other PDF Reader.
If you want to treat PDF like an image you can convert it to jpg.
Nancy O.
Alt-Web Design & Publishing
Web | Graphics | Print | Media Specialists
http://alt-web.com/
http://twitter.com/altweb -
Using IFRAME in JSF to display a PDF file
2 all,
How do i display a PDF file inside a JSF page in a IFRAME tag?
I store the PDF file location (like d:\images\pdf1.pdf) in my database. I cant give this location directly into the src attribute cos then the file will be rendered to only users who have access to that folder (the application is a internet application). IFRAME would be ideal as the display is very very neat (esp for pdf files).
To get this working i tried the examples given in balusc blogs (on image servlet) but the problem is that my servlet is not getting called. Find below the web.xml and imageDisplay.jsp pages that i tried
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>WorkFlowTool</display-name>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<filter>
<filter-name>MyFacesExtensionsFilter</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
<init-param>
<param-name>maxFileSize</param-name>
<param-value>20m</param-value>
</init-param>
</filter>
<filter>
<display-name>SecurityCheckFilter</display-name>
<filter-name>SecurityCheckFilter</filter-name>
<filter-class>filters.SecurityCheckFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>/faces/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>*.faces</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>*.jsf</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>SecurityCheckFilter</filter-name>
<url-pattern>/faces/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>Image Servlet</servlet-name>
<servlet-class>servlets.ImageServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Image Servlet</servlet-name>
<url-pattern>/imageServlet/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>/jsp/index.jsp</welcome-file>
</welcome-file-list>
<error-page>
<error-code>500</error-code>
<location>/jsp/error.jsp</location>
</error-page>
<resource-ref>
<res-ref-name>jdbc/JDDS</res-ref-name>
<res-type>java.lang.Object</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>
imageDisplay.jsp
<HTML>
<HEAD>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
<f:loadBundle basename="messages" var="msg" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK rel="stylesheet" type="text/css" href="../theme/Styles.css"
title="Style">
</HEAD>
<body topmargin="0" leftmargin="0">
<f:view>
<h:form id="CaseLookUp">
<h:dataTable value="#{pc_ImageDisplay.dataModel}" var="var">
<h:column id="one">
<f:facet name="header">
<h:outputText value="H1" id="HOne"/>
</f:facet>
<h:outputText value="#{var.caseID}" id="IDONE"/>
</h:column>
<h:column id="two">
<f:facet name="header">
<h:outputText value="H2" id="HTwo"/>
</f:facet>
<h:graphicImage value="imageServlet?file=#{var.PODocPath}" id="image"/>
</h:column>
</h:dataTable>
</h:form>
</f:view>
</body>
</HTML>The image servlet is what i got from balusc's site (http://balusc.blogspot.com/2007/04/imageservlet.html).
I dont know why my servlet is not getting called. Can someone help me with this pls?
okay let me post the modified code for my image servlet here
public class ImageServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) {
// Define base path somehow. You can define it as init-param of the servlet.
// String imageFilePath = "/images";
// In a Windows environment with the Applicationserver running on the
// c: volume, the above path is exactly the same as "c:\images".
// In UNIX, it is just straightforward "/images".
// If you have stored images in the WebContent of a WAR, for example in the
// "/WEB-INF/images" folder, then you can retrieve the absolute path by:
// String imageFilePath = getServletContext().getRealPath("/WEB-INF/images");
// Get file name from request.
String imageFileName = request.getParameter("file");
System.out.println("Inside the image servlet ---->>>> " + imageFileName);
// Check if file name is supplied to the request.
// if (imageFileName != null) {
// // Strip "../" and "..\" (avoid directory sniffing by hackers!).
// imageFileName = imageFileName.replaceAll("\\.+(\\\\|/)", "");
// } else {
// // Do your thing if the file name is not supplied to the request.
// // Throw an exception, or show default/warning image, or just ignore it.
// return;
// Prepare file object.
File imageFile = new File(imageFileName);
// Check if file actually exists in filesystem.
if (!imageFile.exists()) {
// Do your thing if the file appears to be non-existing.
// Throw an exception, or show default/warning image, or just ignore it.
return;
// Get content type by filename.
String contentType = URLConnection.guessContentTypeFromName(imageFileName);
// Check if file is actually an image (avoid download of other files by hackers!).
// For all content types, see: http://www.w3schools.com/media/media_mimeref.asp
if (contentType == null || !contentType.startsWith("image")) {
// Do your thing if the file appears not being a real image.
// Throw an exception, or show default/warning image, or just ignore it.
return;
// Prepare streams.
BufferedInputStream input = null;
BufferedOutputStream output = null;
try {
// Open image file.
input = new BufferedInputStream(new FileInputStream(imageFile));
int contentLength = input.available();
// Init servlet response.
response.reset();
response.setContentLength(contentLength);
response.setContentType(contentType);
response.setHeader(
"Content-disposition", "inline; filename=\"" + imageFileName + "\"");
output = new BufferedOutputStream(response.getOutputStream());
// Write file contents to response.
while (contentLength-- > 0) {
output.write(input.read());
// Finalize task.
output.flush();
} catch (IOException e) {
// Something went wrong?
e.printStackTrace();
} finally {
// Gently close streams.
if (input != null) {
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
// This is a serious error. Do more than just printing a trace.
if (output != null) {
try {
output.close();
} catch (IOException e) {
e.printStackTrace();
// This is a serious error. Do more than just printing a trace.
}Thanks Balusc!!
I have made use of your code to display PDF files in an IFRAME tag too!!! I just dint believe that this would be possible. Please just take a look at my JSP page.
<h:form id="CaseLookUp">
<%
String path = request.getContextPath()+"";
out.print(path);
%>
<iframe scrolling="auto" src="<%=path%>/imageServlet?file=D:\70-229 V5.pdf" width="80%" height="600" ></iframe>
</h:form> -
We have some PDF files in a AIX directory and we will like to open and display the PDF view in our own SAP application. I used the function module CALL_BROWSER, but this module can´t display the PDF file in the AIX directory.
I hope anybody can help me ?HI larsen..
First you need to set up FTP connection to your OS (Windows)server..
you can use FM
*Scramble the password before connecting to the FTP server
CALL 'AB_RFC_X_SCRAMBLE_STRING'
ID 'SOURCE' FIELD l_v_pwd ID 'KEY' FIELD l_v_key
ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD l_v_pwd
ID 'DSTLEN' FIELD l_v_pwd_len.
*Connect to the FTP server
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = 'your username'
password = l_v_pwd
host = 'pmipmftpaisdev.eu.pm.com'
host = 'pmipmftpaisdev.app.pmi'
rfc_destination = 'SAPFTPA'
IMPORTING
handle = v_handle
EXCEPTIONS
not_connected = 1
OTHERS = 2.
Then
FORM f_get_directory USING fp_p_file TYPE char200 " this is your file name
CHANGING fp_it_direct TYPE ty_t_direct. "this is directory
*Local variables
DATA : l_v_cmd TYPE char512,
l_v_fdpos TYPE syfdpos.
*Changing directory
CONCATENATE 'cd' fp_p_file INTO l_v_cmd SEPARATED BY space.
*Change the directory
PERFORM f_ftp_command USING l_v_cmd
CHANGING it_result.
IF sy-subrc = 0.
REFRESH it_result.
CLEAR l_v_cmd.
*Ascii mode
l_v_cmd = 'ascii'.
PERFORM f_ftp_command USING l_v_cmd
CHANGING it_result.
IF sy-subrc = 0.
REFRESH it_result.
CLEAR l_v_cmd.
*Get the folders inside the directory
l_v_cmd = 'dir'.
PERFORM f_ftp_command USING l_v_cmd
CHANGING it_result.
IF sy-subrc = 0.
LOOP AT it_result INTO wa_result.
SEARCH wa_result FOR '<DIR>'.
IF sy-subrc = 0.
l_v_fdpos = sy-fdpos.
l_v_fdpos = l_v_fdpos + 5.
DO.
l_v_fdpos = l_v_fdpos + 1.
IF wa_result+l_v_fdpos(1) <> ' '.
wa_direct-direct = wa_result+l_v_fdpos(20).
APPEND wa_direct TO fp_it_direct.
EXIT.
ENDIF.
ENDDO.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
REFRESH it_result.
ENDFORM. " f_get_directory
*& Form f_ftp_command
Execute the unix command
-->FP_L_CMD text
<--FP_IT_RESULT text
FORM f_ftp_command USING fp_l_cmd TYPE char512
CHANGING fp_it_result TYPE ty_t_result.
*Execute the FTP Command
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = v_handle
command = fp_l_cmd
TABLES
data = fp_it_result
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
ENDIF.
ENDFORM.
Now loop at the directort and get the files
LOOP AT it_direct INTO wa_direct.
*Get the files inside the directory
PERFORM f_get_files USING p_file
wa_direct
CHANGING it_files.
endloop.
*& Form f_get_files
Get the files from the directory
-->FP_P_FILE File path
-->FP_WA_DIRECT Directory name
<--FP_IT_FILES Files
FORM f_get_files USING fp_p_file TYPE char200
fp_wa_direct TYPE ty_direct
CHANGING fp_it_files TYPE ty_t_files.
*Local variable
DATA : l_v_cmd TYPE char512,
l_v_fdpos TYPE syfdpos.
CONCATENATE 'cd' fp_wa_direct INTO l_v_cmd SEPARATED BY space.
*Change the directory
PERFORM f_ftp_command USING l_v_cmd
CHANGING it_result.
IF sy-subrc = 0.
REFRESH it_result.
CLEAR v_cmd.
CONCATENATE 'dir' '*.<b>pdf</b>' v_cmd INTO v_cmd SEPARATED BY space.
*Get the files from the directory
PERFORM f_ftp_command USING v_cmd
CHANGING it_result.
IF sy-subrc = 0.
LOOP AT it_result INTO wa_result.
IF sy-tabix = 1.
CONTINUE.
ENDIF.
SEARCH wa_result FOR '<b>.pdf'</b>.
IF sy-subrc = 0.
wa_files-file = wa_result+39(200).
APPEND wa_files TO fp_it_files.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM.
see the above program..
If any doubt feel free to ask..
rewards is useful
regards,
nazeer -
Hi - I'm having issues with my code and I'm not an ActionScript coder by any means. I'm using Flash Builder 4. I've been able to figure out how to export to PNG and to XLS but PDF is really killing me.
Below is my code and it's not causing errors when I do the release build but the my button doesn't work to export to PDF. I'm trying to create a PNG using the PNGEncoder and then push that out to PDF (when the PDF button is selected). I used some sample code and I've commented out parts that I didn't want to use or didn't seem to apply to my application. Unfortunately, I have a deadline of May 3rd on this and there is no one else in the office here to help me... hope someone out there can.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" height="650" width="850">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import flash.events.Event;
import mx.events.DropdownEvent;
import mx.events.*;
import mx.graphics.codec.PNGEncoder;
import org.alivepdf.display.*;
import org.alivepdf.images.ColorSpace;
import org.alivepdf.fonts.*;
import org.alivepdf.layout.*;
import org.alivepdf.pdf.*;
import org.alivepdf.saving.*;
import mx.controls.Alert;
//PDF Export information
protected var pdf:PDF;
protected function savePDF(event:MouseEvent): void {
pdf = new PDF(Orientation.LANDSCAPE, Unit.MM, Size.LETTER);
pdf.setDisplayMode(Display.FULL_WIDTH);
pdf.addPage();
var bd:BitmapData = new BitmapData(cChart.width,cChart.height);
bd.draw(cChart);
var png:PNGEncoder = new PNGEncoder();
var ba:ByteArray = png.encode(bd);
//try {
pdf.addImageStream(ba, ColorSpace.DEVICE_RGB, new Resize ( Mode.FIT_TO_PAGE, Position.CENTERED ), 10, 10, 800, 800, 0, 1, "Normal", null);
//} catch (e:Error) {
// trace("Error occurred!");
// Alert.show(e,"");
//myPDF.addImageStream(new jpgBytes() as ByteArray, ColorSpace.DEVICE_RGB, null, 0, 0, 500, 500, 0, 1, "Normal", null);
//imageBytes:ByteArray, colorSpace:String, resizeMode:Resize=null, x:Number=0, y:Number=0, width:Number=0, height:Number=0, rotation:Number=0, alpha:Number=1, blendMode:String="Normal", link:ILink=null):
//pdf.setFont(FontFamily.ARIAL, Style.NORMAL, 12);
//pdf.addText("Grafico de Rata de Fallas", 100, 40); // title
//pdf.addImage(imprimirRata, 50, 50, 200, 150); // captured canvas with charts
// pdf.addImage(leyendaImprimir, 50, 120, 20,20); // captured leyend of charts
//pdf.addText("RTP Software. Modulo de Score Card.", 10, 200); // header of the document
//pdf.addText("Creado: " + new Date(), 180, 200); // Add the created date as a leyend or footer on document
var fr:FileReference = new FileReference();
fr.save(pdf.save(Method.LOCAL), "nep_piefy11.pdf");
/*var fs:FileStream = new FileStream();
var file: File = File.desktopDirectory.resolvePath("nep_piefy11.pdf"); // Name of the file
fs.open(file, FileMode.WRITE);
fs.writeBytes(pdf.save(Method.LOCAL));
fs.close();*/
//Alert.show("El reporte ha sido generado", "Informacion"); // Confirmation message as a pop-up
//Pie Chart Creation information
[Bindable]
public var ds:ArrayCollection = sel;
private function changeEvt(event:Event):void {
if(filterCombo.selectedItem == 'Select NEP') {ds = sel;}
if(filterCombo.selectedItem == 'Albemarle-Pamlico Estuary Program') {ds = nep1;}
if(filterCombo.selectedItem == 'Barataria-Terrebonne Estuary Program') {ds = nep2;}
if(filterCombo.selectedItem == 'Barnegat Bay Estuary Program') {ds = nep3;}
if(filterCombo.selectedItem == 'Buzzards Bay National Estuary Program') {ds = nep4;}
if(filterCombo.selectedItem == 'Casco Bay Estuary Partnership') {ds = nep5;}
if(filterCombo.selectedItem == 'Charlotte Harbor Estuary Program') {ds = nep6;}
if(filterCombo.selectedItem == 'Coastal Bend Bays and Estuaries Program') {ds = nep7;}
if(filterCombo.selectedItem == 'Delaware Estuary Program') {ds = nep8;}
if(filterCombo.selectedItem == 'Delaware Inland Bays Estuary Program') {ds = nep9;}
if(filterCombo.selectedItem == 'Galveston Bay Estuary Program') {ds = nep10;}
if(filterCombo.selectedItem == 'Indian River Lagoon NEP') {ds = nep11;}
if(filterCombo.selectedItem == 'Long Island Sound Study') {ds = nep12;}
if(filterCombo.selectedItem == 'Lower Columbia River Estuary') {ds = nep13;}
if(filterCombo.selectedItem == 'Maryland Coastal Bays Program') {ds = nep14;}
if(filterCombo.selectedItem == 'Massachusetts Bays NEP') {ds = nep15;}
if(filterCombo.selectedItem == 'Mobile Bay Estuary Program') {ds = nep16;}
if(filterCombo.selectedItem == 'Morro Bay Estuary Program') {ds = nep17;}
if(filterCombo.selectedItem == 'Narragansett Bay Estuary Program') {ds = nep18;}
if(filterCombo.selectedItem == 'New York-New Jersey Harbor Estuary Program') {ds = nep19;}
if(filterCombo.selectedItem == 'Peconic Estuary Program') {ds = nep20;}
if(filterCombo.selectedItem == 'Piscataqua Region Estuaries Partnership') {ds = nep21;}
if(filterCombo.selectedItem == 'Puget Sound Partnership') {ds = nep22;}
if(filterCombo.selectedItem == 'San Francisco Estuary Project') {ds = nep23;}
if(filterCombo.selectedItem == 'San Juan Bay NEP') {ds = nep24;}
if(filterCombo.selectedItem == 'Santa Monica Bay Restoration Project') {ds = nep25;}
if(filterCombo.selectedItem == 'Sarasota Bay Estuary Program') {ds = nep26;}
if(filterCombo.selectedItem == 'Tampa Bay Estuary Program') {ds = nep27;}
if(filterCombo.selectedItem == 'Tillamook Estuaries Partnership') {ds = nep28;}
[Bindable]
private var sel:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0.5},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 0} ]);
[Bindable]
private var nep1:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 778.44},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0.45},
{ habtype: "Estuarine Shoreline", Acres: 1276.30},
{ habtype: "Instream", Acres: 1.0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0.75},
{ habtype: "Upland", Acres: 779.74},
{ habtype: "Wetland", Acres: 3268.31} ]);
[Bindable]
private var nep2:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 7.25},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 1185} ]);
[Bindable]
private var nep3:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 35.21},
{ habtype: "Upland", Acres: 852.57},
{ habtype: "Wetland", Acres: 197.82} ]);
[Bindable]
private var nep4:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 751.82},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 321.82},
{ habtype: "Wetland", Acres: 157.35} ]);
[Bindable]
private var nep5:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 217},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 324.5},
{ habtype: "Wetland", Acres: 0} ]);
[Bindable]
private var nep6:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 1268},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 50},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 61},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 809},
{ habtype: "Wetland", Acres: 1690} ]);
[Bindable]
private var nep7:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 726} ]);
[Bindable]
private var nep8:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0.28},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 82},
{ habtype: "Estuarine Shoreline", Acres: 0.14},
{ habtype: "Instream", Acres: 2.3},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 643},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 501.9},
{ habtype: "Upland", Acres: 148.71},
{ habtype: "Wetland", Acres: 2586.02} ]);
[Bindable]
private var nep9:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 26.21},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 37},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 27},
{ habtype: "Wetland", Acres: 646} ]);
[Bindable]
private var nep10:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 2868},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 407.06} ]);
[Bindable]
private var nep11:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 5},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 3},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 43},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 12910.5},
{ habtype: "Wetland", Acres: 5026} ]);
[Bindable]
private var nep12:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 67},
{ habtype: "Beach/Dune", Acres: 21.95},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 120.72},
{ habtype: "Wetland", Acres: 151.08} ]);
[Bindable]
private var nep13:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 12},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 194},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 200} ]);
[Bindable]
private var nep14:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 58},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 153},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 494.3},
{ habtype: "Wetland", Acres: 0} ]);
[Bindable]
private var nep15:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 1313},
{ habtype: "Estuarine Shoreline", Acres: 8},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 543.8} ]);
[Bindable]
private var nep16:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 40},
{ habtype: "Estuarine Shoreline", Acres: 6.5},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 195},
{ habtype: "Wetland", Acres: 85} ]);
[Bindable]
private var nep17:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 1109.9},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 1.14},
{ habtype: "Estuarine Shoreline", Acres: 0.28},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 0.71},
{ habtype: "Wetland", Acres: 0} ]);
[Bindable]
private var nep18:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 1099},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 0} ]);
[Bindable]
private var nep19:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 101.3} ]);
[Bindable]
private var nep20:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 98.72},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 17.99},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 106.13},
{ habtype: "Wetland", Acres: 12.97} ]);
[Bindable]
private var nep21:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 9},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 3},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 2},
{ habtype: "Upland", Acres: 1451},
{ habtype: "Wetland", Acres: 27} ]);
[Bindable]
private var nep22:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 26},
{ habtype: "Beach/Dune", Acres: 1.65},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 240.39},
{ habtype: "Estuarine Shoreline", Acres: 314.97},
{ habtype: "Instream", Acres: 505.87},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 1450.47},
{ habtype: "Upland", Acres: 1176.7},
{ habtype: "Wetland", Acres: 850.58} ]);
[Bindable]
private var nep23:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 43.05},
{ habtype: "Upland", Acres: 4519},
{ habtype: "Wetland", Acres: 3271} ]);
[Bindable]
private var nep24:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 1},
{ habtype: "Coral Reef", Acres: 0.13},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 1},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 10} ]);
[Bindable]
private var nep25:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 1.6},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 7},
{ habtype: "Riparian", Acres: 100},
{ habtype: "Upland", Acres: 6.2},
{ habtype: "Wetland", Acres: 0} ]);
[Bindable]
private var nep26:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 5.5},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 4.5},
{ habtype: "Estuarine Shoreline", Acres: 15},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 82},
{ habtype: "Wetland", Acres: 40} ]);
[Bindable]
private var nep27:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 5.1},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 23},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 4.8},
{ habtype: "Mangrove", Acres: 3.5},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 1221},
{ habtype: "Wetland", Acres: 17.4}]);
[Bindable]
private var nep28:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 67},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 2},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 31.33},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 74.24}]);
private function displayAcres(data:Object, field:String, index:Number, percentValue:Number):String {
var temp:String= (" " + percentValue).substr(0,6);
return data.habtype + ": " + '\n ' + data.Acres + " Acres" + '\n ' + temp + "%";
//Export to PNG information
private function saveImageAs(event:MouseEvent):void
var bd:BitmapData = new BitmapData(cChart.width,cChart.height);
bd.draw(cChart);
var png:PNGEncoder = new PNGEncoder();
var ba:ByteArray = png.encode(bd);
var fr:FileReference = new FileReference();
fr.save(ba, "nepfy11-piechart.png");
]]>
</mx:Script>
<!--mx:SeriesInterpolate id="chartChange" duration="2000" /-->
<mx:Panel id="cChart" title="2011 Habitat Efforts" width="825" height="600" chromeColor="#527EAC" layout="vertical" color="#FFFFFF" verticalGap="10" x="15" y="15">
<mx:HBox width="400" height="20">
<mx:ComboBox id="filterCombo" x="140" y="140" change="changeEvt(event)" color="#000000" >
<mx:String>Select NEP</mx:String>
<mx:String>Albemarle-Pamlico Estuary Program</mx:String>
<mx:String>Barataria-Terrebonne Estuary Program</mx:String>
<mx:String>Barnegat Bay Estuary Program</mx:String>
<mx:String>Buzzards Bay National Estuary Program</mx:String>
<mx:String>Casco Bay Estuary Partnership</mx:String>
<mx:String>Charlotte Harbor Estuary Program</mx:String>
<mx:String>Coastal Bend Bays and Estuaries Program</mx:String>
<mx:String>Delaware Estuary Program</mx:String>
<mx:String>Delaware Inland Bays Estuary Program</mx:String>
<mx:String>Galveston Bay Estuary Program</mx:String>
<mx:String>Indian River Lagoon NEP</mx:String>
<mx:String>Long Island Sound Study</mx:String>
<mx:String>Lower Columbia River Estuary</mx:String>
<mx:String>Maryland Coastal Bays Program</mx:String>
<mx:String>Massachusetts Bays NEP</mx:String>
<mx:String>Mobile Bay Estuary Program</mx:String>
<mx:String>Morro Bay Estuary Program</mx:String>
<mx:String>Narragansett Bay Estuary Program</mx:String>
<mx:String>New York-New Jersey Harbor Estuary Program</mx:String>
<mx:String>Peconic Estuary Program</mx:String>
<mx:String>Piscataqua Region Estuaries Partnership</mx:String>
<mx:String>Puget Sound Partnership</mx:String>
<mx:String>San Francisco Estuary Project</mx:String>
<mx:String>San Juan Bay NEP</mx:String>
<mx:String>Santa Monica Bay Restoration Project</mx:String>
<mx:String>Sarasota Bay Estuary Program</mx:String>
<mx:String>Tampa Bay Estuary Program</mx:String>
<mx:String>Tillamook Estuaries Partnership</mx:String>
</mx:ComboBox>
</mx:HBox>
<mx:HBox horizontalGap="20" width="822" height="535">
<mx:PieChart id="chart" showDataTips="true" dataProvider="{ds}" width="634" height="534" paddingTop="10" fontSize="9" fontFamily="Arial" color="#000000" textAlign="left">
<mx:series>
<mx:PieSeries id="seriesId" explodeRadius="0.06" nameField="habtype" labelPosition="callout" color="#000000" insideLabelSizeLimit="8" field="Acres" labelFunction="displayAcres">
</mx:PieSeries>
</mx:series>
</mx:PieChart>
<mx:Legend dataProvider="{chart}" dropShadowVisible="true" width="150" color="#000000" height="350" chromeColor="#527EAC" borderColor="#527EAC" direction="vertical"/>
</mx:HBox>
</mx:Panel>
<mx:Button x="734" y="623" label="Export Pie Chart" id="btnSnap" click="saveImageAs(event)"/>
<mx:Button x="444" y="623" label="PDF" click="savePDF(event)" />
</mx:Application>
Thank you in advance,
AlisonI figured it out!!!!! In case anyone else needs to know - here is the working code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" height="650" width="850">
<mx:Script>
<![CDATA[
import flash.events.Event;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.*;
import mx.events.DropdownEvent;
import mx.graphics.codec.PNGEncoder;
import org.alivepdf.display.*;
import org.alivepdf.fonts.*;
import org.alivepdf.images.ColorSpace;
import org.alivepdf.images.PDFImage;
import org.alivepdf.layout.*;
import org.alivepdf.pdf.*;
import org.alivepdf.saving.*;
//PDF Export information
private var pdf:PDF;
private function savePDF(event:MouseEvent): void {
pdf = new PDF(Orientation.LANDSCAPE, Unit.MM, Size.LETTER);
pdf.setDisplayMode(Display.FULL_WIDTH);
pdf.addPage();
var bd:BitmapData = new BitmapData(cChart.width,cChart.height);
bd.draw(cChart);
var bm:Bitmap=new Bitmap(bd);
//bm.x=825;
//bm.y=600;
//bm.width=825;
pdf.setMargins(0, 2, 0, 0);
pdf.addImage(bm, new Resize (Mode.RESIZE_PAGE, Position.CENTERED));
//pdf.setXY(10,95);
var bytes:ByteArray=pdf.save(Method.LOCAL);
var fr:FileReference=new FileReference();
fr.save(bytes,"nep_piefy11.pdf");
//Pie Chart Creation information
[Bindable]
public var ds:ArrayCollection = sel;
private function changeEvt(event:Event):void {
if(filterCombo.selectedItem == 'Select NEP') {ds = sel;}
if(filterCombo.selectedItem == 'Albemarle-Pamlico Estuary Program') {ds = nep1;}
if(filterCombo.selectedItem == 'Barataria-Terrebonne Estuary Program') {ds = nep2;}
if(filterCombo.selectedItem == 'Barnegat Bay Estuary Program') {ds = nep3;}
if(filterCombo.selectedItem == 'Buzzards Bay National Estuary Program') {ds = nep4;}
if(filterCombo.selectedItem == 'Casco Bay Estuary Partnership') {ds = nep5;}
if(filterCombo.selectedItem == 'Charlotte Harbor Estuary Program') {ds = nep6;}
if(filterCombo.selectedItem == 'Coastal Bend Bays and Estuaries Program') {ds = nep7;}
if(filterCombo.selectedItem == 'Delaware Estuary Program') {ds = nep8;}
if(filterCombo.selectedItem == 'Delaware Inland Bays Estuary Program') {ds = nep9;}
if(filterCombo.selectedItem == 'Galveston Bay Estuary Program') {ds = nep10;}
if(filterCombo.selectedItem == 'Indian River Lagoon NEP') {ds = nep11;}
if(filterCombo.selectedItem == 'Long Island Sound Study') {ds = nep12;}
if(filterCombo.selectedItem == 'Lower Columbia River Estuary') {ds = nep13;}
if(filterCombo.selectedItem == 'Maryland Coastal Bays Program') {ds = nep14;}
if(filterCombo.selectedItem == 'Massachusetts Bays NEP') {ds = nep15;}
if(filterCombo.selectedItem == 'Mobile Bay Estuary Program') {ds = nep16;}
if(filterCombo.selectedItem == 'Morro Bay Estuary Program') {ds = nep17;}
if(filterCombo.selectedItem == 'Narragansett Bay Estuary Program') {ds = nep18;}
if(filterCombo.selectedItem == 'New York-New Jersey Harbor Estuary Program') {ds = nep19;}
if(filterCombo.selectedItem == 'Peconic Estuary Program') {ds = nep20;}
if(filterCombo.selectedItem == 'Piscataqua Region Estuaries Partnership') {ds = nep21;}
if(filterCombo.selectedItem == 'Puget Sound Partnership') {ds = nep22;}
if(filterCombo.selectedItem == 'San Francisco Estuary Project') {ds = nep23;}
if(filterCombo.selectedItem == 'San Juan Bay NEP') {ds = nep24;}
if(filterCombo.selectedItem == 'Santa Monica Bay Restoration Project') {ds = nep25;}
if(filterCombo.selectedItem == 'Sarasota Bay Estuary Program') {ds = nep26;}
if(filterCombo.selectedItem == 'Tampa Bay Estuary Program') {ds = nep27;}
if(filterCombo.selectedItem == 'Tillamook Estuaries Partnership') {ds = nep28;}
[Bindable]
private var sel:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0.5},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 0} ]);
[Bindable]
private var nep1:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 778.44},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0.45},
{ habtype: "Estuarine Shoreline", Acres: 1276.30},
{ habtype: "Instream", Acres: 1.0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0.75},
{ habtype: "Upland", Acres: 779.74},
{ habtype: "Wetland", Acres: 3268.31} ]);
[Bindable]
private var nep2:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 7.25},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 1185} ]);
[Bindable]
private var nep3:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 35.21},
{ habtype: "Upland", Acres: 852.57},
{ habtype: "Wetland", Acres: 197.82} ]);
[Bindable]
private var nep4:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 751.82},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 321.82},
{ habtype: "Wetland", Acres: 157.35} ]);
[Bindable]
private var nep5:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 217},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 324.5},
{ habtype: "Wetland", Acres: 0} ]);
[Bindable]
private var nep6:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 1268},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 50},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 61},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 809},
{ habtype: "Wetland", Acres: 1690} ]);
[Bindable]
private var nep7:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 726} ]);
[Bindable]
private var nep8:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0.28},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 82},
{ habtype: "Estuarine Shoreline", Acres: 0.14},
{ habtype: "Instream", Acres: 2.3},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 643},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 501.9},
{ habtype: "Upland", Acres: 148.71},
{ habtype: "Wetland", Acres: 2586.02} ]);
[Bindable]
private var nep9:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 26.21},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 37},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 27},
{ habtype: "Wetland", Acres: 646} ]);
[Bindable]
private var nep10:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 2868},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 407.06} ]);
[Bindable]
private var nep11:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 5},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 3},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 43},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 12910.5},
{ habtype: "Wetland", Acres: 5026} ]);
[Bindable]
private var nep12:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 67},
{ habtype: "Beach/Dune", Acres: 21.95},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 120.72},
{ habtype: "Wetland", Acres: 151.08} ]);
[Bindable]
private var nep13:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 12},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 194},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 200} ]);
[Bindable]
private var nep14:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 58},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 153},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 494.3},
{ habtype: "Wetland", Acres: 0} ]);
[Bindable]
private var nep15:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 1313},
{ habtype: "Estuarine Shoreline", Acres: 8},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 543.8} ]);
[Bindable]
private var nep16:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 40},
{ habtype: "Estuarine Shoreline", Acres: 6.5},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 195},
{ habtype: "Wetland", Acres: 85} ]);
[Bindable]
private var nep17:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 1109.9},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 1.14},
{ habtype: "Estuarine Shoreline", Acres: 0.28},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 0.71},
{ habtype: "Wetland", Acres: 0} ]);
[Bindable]
private var nep18:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 1099},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 0} ]);
[Bindable]
private var nep19:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 101.3} ]);
[Bindable]
private var nep20:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 98.72},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 17.99},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 106.13},
{ habtype: "Wetland", Acres: 12.97} ]);
[Bindable]
private var nep21:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 9},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 3},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 2},
{ habtype: "Upland", Acres: 1451},
{ habtype: "Wetland", Acres: 27} ]);
[Bindable]
private var nep22:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 26},
{ habtype: "Beach/Dune", Acres: 1.65},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 240.39},
{ habtype: "Estuarine Shoreline", Acres: 314.97},
{ habtype: "Instream", Acres: 505.87},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 1450.47},
{ habtype: "Upland", Acres: 1176.7},
{ habtype: "Wetland", Acres: 850.58} ]);
[Bindable]
private var nep23:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 43.05},
{ habtype: "Upland", Acres: 4519},
{ habtype: "Wetland", Acres: 3271} ]);
[Bindable]
private var nep24:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 1},
{ habtype: "Coral Reef", Acres: 0.13},
{ habtype: "Estuarine", Acres: 0},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 1},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 10} ]);
[Bindable]
private var nep25:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 1.6},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 7},
{ habtype: "Riparian", Acres: 100},
{ habtype: "Upland", Acres: 6.2},
{ habtype: "Wetland", Acres: 0} ]);
[Bindable]
private var nep26:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 5.5},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 4.5},
{ habtype: "Estuarine Shoreline", Acres: 15},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 82},
{ habtype: "Wetland", Acres: 40} ]);
[Bindable]
private var nep27:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 0},
{ habtype: "Beach/Dune", Acres: 5.1},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 23},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 4.8},
{ habtype: "Mangrove", Acres: 3.5},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 0},
{ habtype: "Upland", Acres: 1221},
{ habtype: "Wetland", Acres: 17.4}]);
[Bindable]
private var nep28:ArrayCollection = new ArrayCollection( [
{ habtype: "Agriculture/Ranch Land", Acres: 67},
{ habtype: "Beach/Dune", Acres: 0},
{ habtype: "Coral Reef", Acres: 0},
{ habtype: "Estuarine", Acres: 2},
{ habtype: "Estuarine Shoreline", Acres: 0},
{ habtype: "Instream", Acres: 0},
{ habtype: "Island", Acres: 0},
{ habtype: "Lake/Pond", Acres: 0},
{ habtype: "Mangrove", Acres: 0},
{ habtype: "Other", Acres: 0},
{ habtype: "Riparian", Acres: 31.33},
{ habtype: "Upland", Acres: 0},
{ habtype: "Wetland", Acres: 74.24}]);
private function displayAcres(data:Object, field:String, index:Number, percentValue:Number):String {
var temp:String= (" " + percentValue).substr(0,6);
return data.habtype + ": " + '\n ' + data.Acres + " Acres" + '\n ' + temp + "%";
//Export to PNG information
private function saveImageAs(event:MouseEvent):void
var bd:BitmapData = new BitmapData(cChart.width,cChart.height);
bd.draw(cChart);
var png:PNGEncoder = new PNGEncoder();
var ba:ByteArray = png.encode(bd);
var fr:FileReference = new FileReference();
fr.save(ba, "nepfy11-piechart.png");
]]>
</mx:Script>
<!--mx:SeriesInterpolate id="chartChange" duration="2000" /-->
<mx:Panel id="cChart" title="2011 Habitat Efforts" width="825" height="600" chromeColor="#527EAC" layout="vertical" color="#FFFFFF" verticalGap="10" x="15" y="15">
<mx:HBox width="400" height="20">
<mx:ComboBox id="filterCombo" x="140" y="140" change="changeEvt(event)" color="#000000" >
<mx:String>Select NEP</mx:String>
<mx:String>Albemarle-Pamlico Estuary Program</mx:String>
<mx:String>Barataria-Terrebonne Estuary Program</mx:String>
<mx:String>Barnegat Bay Estuary Program</mx:String>
<mx:String>Buzzards Bay National Estuary Program</mx:String>
<mx:String>Casco Bay Estuary Partnership</mx:String>
<mx:String>Charlotte Harbor Estuary Program</mx:String>
<mx:String>Coastal Bend Bays and Estuaries Program</mx:String>
<mx:String>Delaware Estuary Program</mx:String>
<mx:String>Delaware Inland Bays Estuary Program</mx:String>
<mx:String>Galveston Bay Estuary Program</mx:String>
<mx:String>Indian River Lagoon NEP</mx:String>
<mx:String>Long Island Sound Study</mx:String>
<mx:String>Lower Columbia River Estuary</mx:String>
<mx:String>Maryland Coastal Bays Program</mx:String>
<mx:String>Massachusetts Bays NEP</mx:String>
<mx:String>Mobile Bay Estuary Program</mx:String>
<mx:String>Morro Bay Estuary Program</mx:String>
<mx:String>Narragansett Bay Estuary Program</mx:String>
<mx:String>New York-New Jersey Harbor Estuary Program</mx:String>
<mx:String>Peconic Estuary Program</mx:String>
<mx:String>Piscataqua Region Estuaries Partnership</mx:String>
<mx:String>Puget Sound Partnership</mx:String>
<mx:String>San Francisco Estuary Project</mx:String>
<mx:String>San Juan Bay NEP</mx:String>
<mx:String>Santa Monica Bay Restoration Project</mx:String>
<mx:String>Sarasota Bay Estuary Program</mx:String>
<mx:String>Tampa Bay Estuary Program</mx:String>
<mx:String>Tillamook Estuaries Partnership</mx:String>
</mx:ComboBox>
</mx:HBox>
<mx:HBox horizontalGap="20" width="822" height="535">
<mx:PieChart id="chart" showDataTips="true" dataProvider="{ds}" width="634" height="534" paddingTop="10" fontSize="9" fontFamily="Arial" color="#000000" textAlign="left">
<mx:series>
<mx:PieSeries id="seriesId" explodeRadius="0.06" nameField="habtype" labelPosition="callout" color="#000000" insideLabelSizeLimit="8" field="Acres" labelFunction="displayAcres">
</mx:PieSeries>
</mx:series>
</mx:PieChart>
<mx:Legend dataProvider="{chart}" dropShadowVisible="true" width="150" color="#000000" height="350" chromeColor="#527EAC" borderColor="#527EAC" direction="vertical"/>
</mx:HBox>
</mx:Panel>
<mx:Button x="746" y="623" label="Export to PNG" id="btnSnap" click="saveImageAs(event)"/>
<mx:Button x="651" y="623" label="Export to PDF" click="savePDF(event)" />
</mx:Application>
Thanks, Alison -
Get PDF file from a Portal Form or Report
Hello All and thanks for your help in advance.
I am developing a portal application with a requirement to retrieve from our Oracle iFS document repository PDF a PDF file based on entered forms criteria or as a result from a return from a QBE report.
Will someone please provide guidance on this. It would be most appreciated.Hi,
There are a few options:
You could have a button in the form with the following Javascript
in the Click event have app.openDoc("/c/temp/myDoc.pdf"); // check Acrobat Javascript reference for full options
I think that there is a security issue with this method and therefore the PDF would need to be certified and the script run in a privileged context.
OR
You could include the static form on the last page(s) of your dynamic form. Set the presence of these page(s) to hidden in the Object / Field tab. Then within your dynamic form pages have a button "Show Static Form" with the following Javascript:
in the mouseDown event have form1.pSTATIC.presence = "visible"; //This will make the static page visible
in the Click event have xfa.host.currentPage = pSTATIC.thisPage.rawValue - 1; //This will jump the user to the static page
Lastly you could have a print button on the static form page, which will only print that page. Place an invisible numericField (called thisPage) on the static page with the following Javascript:in the Layout: Ready event have this.rawValue = xfa.layout.page(this); //This flags the page number of the static form, which may vary because of the dynamic nature of the form
Then the print button would reference that page number, in the click event have:
xfa.host.print(1,(thisPage.rawValue -1).toString(), (thisPage.rawValue -1).toString(), 0, 1, 0, 0, 0); //Prints static page only
form1.pSTATIC.presence = "hidden"; //Automatically hides the static page after printing
xfa.host.currentPage = "0"; //Jumps the user back to page 1
I know the second option may appear more involved. But it does keep both the static and dynamic versions together in one PDF. Also if there are some fields that can be predetermined, then they can be filled in to the static form before printing (or they can be assigned to the corresponding fields in the dynamic form using the global binding).
Good luck,
Niall -
Error when displaying a pdf file in an iFrame
Hi,
I would like to display a pdf file in my Java Web Dynpro application. I am using an iFrame element.
The code I used is:
// test if the file exists
if( path != null)
path = "D:\\Echanges\\Facture\\" + path + ".pdf";
if (isFile(path)) // test if the file exist
wdContext.currentContextElement().setPath(path); // we set the path of the file for the iFrame url
else
wdContext.currentContextElement().setPath("D:\\Echanges\\errorDocAccess.htm"); // here we set the path of an error file to display in the iFrame
In the context, path is declared as a String variable and mapped to an iFrame. What happen when I lauch the program is the followig error:
com.sap.tc.webdynpro.services.exceptions.InvalidUrlRuntimeException: Invalid URL=D:/Echanges/errorDocAccess.htm
I have checked the path of the error file and it is valid. How do I get to display my file ? The path is on the same server as the portal.
Thanks a lot for your help.
Thibault SchalckNot solved
-
Display a PDF file from local drive
Hi,
I would like to display a pdf file that is actually stored on the portal server hard drive.
What I have tried to do is link an iFrame element to the url of the file: "D:
MyFolder
myFile.pdf"
But it doesn't work. I have the following error when trying to do that:
com.sap.tc.webdynpro.services.exceptions.InvalidUrlRuntimeException: Invalid URL=D:/MyFolder/myFile.pdf
Does this means that iFrame can only display http URLs ? What are the other ways to easily display pdf files ?? I'am stuck with that problem and can't find any other solution.
I also tried with "servletResponse.getOutputStream().write(fileByteContent);" but the problem is that I am not in a PAR application, and I don't have the servletResponse element and don't know how to get it.
Thanks for your help.
Thibault SchalckHi,
You can not access the .pdf file using the nornal path (c:
), use the following code to open the pdf in ur iframe, this will work i used it in my application.
String sFileName =
strCampCodeVal"_"nReqIdVal+".pdf";
String sFile =
"C:
SBLI
BCP
barcode_files
"+sFileName;
File fFile = new File(sFile);
if ( fFile == null )
System.out.println("System can not download the
file at this time. Please try again later.");
return;
//Checking the file for existence
if ( !fFile.exists() || !fFile.canRead() )
System.out.println("You have specified an
invalid file to download. Please check and try
again.");
return;
//set the content type its important , try with applicatio/pdf also
res.setContentType("application/force-download");
//seting the header
res.setHeader("Content-disposition",
"attachment;filename=" + sFileName);
res.setHeader("Cache-control", "must-revalidate");
ServletOutputStream sosCur = res.getOutputStream();;
//reading the in and writing the stream
BufferedInputStream bisFile = null;
try
byte [] bBuffer = new byte[4096];
bisFile = new BufferedInputStream(new
FileInputStream(fFile));
int nBytes = -1;
while( (nBytes = bisFile.read(bBuffer, 0, 4096))!=-1 )
sosCur.write(bBuffer, 0, nBytes);
catch(Exception ex){
This will resove your issue.All the best..
Regards..
krishna.. -
What adobe product will allow me to edit a pdf file in its orignal form.
What adobe product will allow me to edit a pdf file in its orignal form. I want to scan in a document in its orignal form and edit the document. Is this possible? Please help where and how. Thanks
As George as suggested, the answer is sort of maybe, though you should not expect perfection. The OCR is not perfect (almost no OCR products are, unless you pay a lot of money possibly). You should always edit the original document and not try to do it from a scan if at all possible. The OCR is step to trying to recreate the original document, but there will always be manual steps involved.
-
Preview.app will not display some PDF files
Since upgrading Yosemite I have found that Preview.app will not display some PDF documents, the documents open but all the pages are blank. This is a big issue as my work involves reviewing documents that are all in the PDF format. Strangely some PDFs work properly but I haven't been able to determine any common factors among the documents that work versus those that don't work. The problem documents do open correctly in Adobe Acrobat Reader but Reader takes over viewing of PDF container fields I have in several important FileMaker Pro 13 databases. Acrobat in the FileMaker databases for me is just as much of a problem as not viewing PDFs in Preview.
After searching the forums I followed suggestion in a post to try using version 7.0 of Preview.app (the version that worked under Mavericks) but that is also showing blank pages. I have noticed that the PDFs which open as blank pages also display that way in Finder and Spotlight previews. Could this mean that I have some kind of OS level issue here and not a Preview.app issue? Perhaps Finder and Spotlight use Preview.app to generate the preview.
I have posted this in a bug report to Apple but in the meantime I would welcome any suggestions or workarounds to try.The built-in PDF renderer has trouble with that file. You might get better results with Adobe Reader.
-
Since I got OS10.8.2 Safari won't display online PDF files?
Since I got OS10.8.2 Safari won't display online PDF files?
Can anyone tell me what the problem is?Back up all data.
Triple-click the line of text below to select it, the copy the selected text to the Clipboard (command-C):
/Library/Internet Plug-ins
In the Finder, select
Go ▹ Go to Folder
from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present.
If you still have the issue, repeat with this line:
~/Library/Internet Plug-ins
If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again. -
How to display a pdf file in jsp
hi,
How to display a pdf file in jsp iam having a class which will return fileinputstream of the file object. the pdf file is in server.
regards
ArulA JSP is a combo of HTML and Java, so you can't really "display" a PDF file in a JSP.
You can provider a href link to the PDF file in your JSP.
You can use some utility package to read the contents of the PDF, pull certain things out of it, and display that in your JSP as html
In a servlet you can set the content type to application/pdf and write the binary data of the PDF back to the browser. Once the browser finishes reading in the data it should open the PDF.
Maybe you are looking for
-
Maximum Number of Pages in an Application
What is the maximum number of pages in an application? Numerically what would that range be? From 0 to n?
-
Hi Roberto, I need some more documents. I am listing those...... 1, Doc on Web reporting 2, Modifying custom or standard infocubes 3, Docs on a, Business content data extraction b, Generic data extraction c, LIS & LO cockpit Extractions T
-
Dblink from oracle9i on aix to sqlserver 2005
Hi All Please i need help connecting via dblink to query tables in sqlserver 2005 OS: AIX Version 5.2! , Oracle: 9.2.0.7.0 I have located the following Firstly $ pwd /opt/oracle/9.2.0.7B64/hs/admin $ ls inithsodbc.ora listener.ora.sample tnsnames.ora
-
Text message Via i cloud email address
I now get text messages from a friend via his icloud email address and I can communicate with him via that account, but when I send him a text via his phone number he dose not recive them. How can that be resolve?
-
Comment débloquer mon iPad bloqué sur l'écran d'accueil , sans mes application seulement la date et l'icone de recharge ? iPad Air , IOS.8.1.3