STEPS: How to enable Export PDF option in APEX 4.0
Required
Software’s: OC4J, JDK 5.0 and Apache FOP war file
(Note – All above
software’s are free to use and doesn’t require any license)
Download Links:
FOP.war – It can be found in APEX software directory (apex_install_directory/utlities/fop)
STEPS:
1.
Install and configure JDK as per wizard
instructions.
2.
Installation & configuration of OC4J
a.
Unzip oc4j_extended_101350.zip to desired
location, it will be the ORACLE_HOME
b.
Open Command Prompt
c.
SET JAVA_HOME environment variable with JDK
installation path
d.
SET ORACLE_HOME with unzipped OC4J software
directory
e.
Change directory to “OC4J-unzipped-location\j2ee\home\config”
f.
Edit server.xml and replace 1024 to 256
name="javac" in-process="false"
options="-J-Xmx1024m
-encoding UTF8"
g.
Change directory to “j2ee\home”, or simply
execute cd ..
h.
Run "C:\Program Files
(x86)\Java\jdk1.5.0\bin\java" -jar oc4j.jar
It will ask for password of OC4JADMIN and will start OC4J instance
It will ask for password of OC4JADMIN and will start OC4J instance
i.
Check if OC4J is running or not by logging into
EM Console, using your OC4JADMIN account with the password you set while
configuring the OC4J server.
3. Deploy
FOP.war file on OC4J application server. Follow below link
“5. Installing and
Configuring Apache FOP” -> “Step 1: Installing the WAR file”
4. Go
to APEX Administration Control-> Instance Settings-> Report Printing and
follow below screenshot to set hostname of the OC4J Server and configured port.
Default port is 8888
Reference Link: Follow Step 5.
Installing and Configuring Apache FOP
http://www.oracle.com/technetwork/developer-tools/apex/application-express/configure-printing-093060.html#2.1
http://www.oracle.com/technetwork/developer-tools/apex/application-express/configure-printing-093060.html#2.1
Reference
Screenshot:
5. Grant
necessary privileges to database user by executing below script according to
your APEX version. Strictly follow the naming convention of database users as
per your APEX version before running the script as you may need to replace
highlighted text.
FLOWS_XXXXXX for
versions 3.0.1 through 3.1.2
APEX_XXXXXX for
3.2 and above
Reference Metalink Note ID - 745695.1 (Visit http://metalink.oracle.com)
DECLARE
ACL_PATH VARCHAR2(4000);
ACL_ID RAW(16);
BEGIN
-- Look for the ACL currently assigned to '*' and give FLOWS_030100
-- the "connect" privilege if FLOWS_030100 does not have the privilege yet.
SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
WHERE HOST = '*' AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL;
-- Before checking the privilege, make sure that the ACL is valid
-- (for example, does not contain stale references to dropped users).
-- If it does, the following exception will be raised:
--
-- ORA-44416: Invalid ACL: Unresolved principal 'FLOWS_030100'
-- ORA-06512: at "XDB.DBMS_XDBZ", line ...
--
SELECT SYS_OP_R2O(extractValue(P.RES, '/Resource/XMLRef')) INTO ACL_ID FROM XDB.XDB$ACL A, PATH_VIEW P WHERE extractValue(P.RES, '/Resource/XMLRef') = REF(A) AND
EQUALS_PATH(P.RES, ACL_PATH) = 1;
DBMS_XDBZ.ValidateACL(ACL_ID);
IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'FLOWS_030100',
'connect') IS NULL THEN DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
'FLOWS_030100', TRUE, 'connect');
END IF;
EXCEPTION
-- When no ACL has been assigned to '*'.
WHEN NO_DATA_FOUND THEN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml',
'ACL that lets power users to connect to everywhere',
'FLOWS_030100', TRUE, 'connect');
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*');
END;
/
COMMIT;
ACL_PATH VARCHAR2(4000);
ACL_ID RAW(16);
BEGIN
-- Look for the ACL currently assigned to '*' and give FLOWS_030100
-- the "connect" privilege if FLOWS_030100 does not have the privilege yet.
SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
WHERE HOST = '*' AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL;
-- Before checking the privilege, make sure that the ACL is valid
-- (for example, does not contain stale references to dropped users).
-- If it does, the following exception will be raised:
--
-- ORA-44416: Invalid ACL: Unresolved principal 'FLOWS_030100'
-- ORA-06512: at "XDB.DBMS_XDBZ", line ...
--
SELECT SYS_OP_R2O(extractValue(P.RES, '/Resource/XMLRef')) INTO ACL_ID FROM XDB.XDB$ACL A, PATH_VIEW P WHERE extractValue(P.RES, '/Resource/XMLRef') = REF(A) AND
EQUALS_PATH(P.RES, ACL_PATH) = 1;
DBMS_XDBZ.ValidateACL(ACL_ID);
IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'FLOWS_030100',
'connect') IS NULL THEN DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
'FLOWS_030100', TRUE, 'connect');
END IF;
EXCEPTION
-- When no ACL has been assigned to '*'.
WHEN NO_DATA_FOUND THEN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml',
'ACL that lets power users to connect to everywhere',
'FLOWS_030100', TRUE, 'connect');
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*');
END;
/
COMMIT;
6.
To test, create a Classic report and use “Print
Server” option