- 浏览: 681231 次
- 性别:
- 来自: 中山
文章分类
最新评论
-
wuhuizhong:
jFinal支持Rest风格吗?可以想spring mvc那样 ...
在JFinal的Controller中接收json数据 -
wuhuizhong:
在jfinal中应如何获取前端ajax提交的Json数据?ht ...
在JFinal的Controller中接收json数据 -
wuhuizhong:
jfinal如何处理json请求的数据:问题: 在某些api接 ...
在JFinal的Controller中接收json数据 -
wuhuizhong:
Ubuntu14.04 安装 Oracle 11g R2 Ex ...
Oracle 11g release 2 XE on Ubuntu 14.04 -
alanljj:
这个很实用,已成功更新,谢过了!
odoo薪酬管理模块l10n_cn_hr_payroll
I'm sure you've heard about PL/PDF, the PL/SQL-based solution that allows you to create PDF documents directly from your database. PL/PDF is a good product, but it is not free (the current license price is USD 600 per database server).
However, I just came across a free alternative called PL_FPDF, which is a PL/SQL port of the PHP-based FPDF. The latest version of PL_PDF seems to have been released about a year ago, and I can't believe I haven't seen or heard about it before now... !
UPDATE, MARCH 2011: Also check out this alternative PDF generation package by Anton Scheffer. It seems simpler and more robust than the PL_FPDF package, but may lack certain features. Be sure to evaluate both!
PL_FPDF is just a single package, so installation is a snap. Note that it uses the ORDImage data type to place images in PDF documents, so if you are running Oracle XE (which doesn't include the ORDImage data type), you need to comment out the few procedures that deal with this data type (and obviously you will not be able to include images in your PDF documents...).
After a few hours of experimentation, I was able to produce a semi-complex PDF document that tests a number of features in PL_FPDF. My test script is included below for your convenience. Note that the default assumption is that output goes to the web browser via the HTP package, but it should be trivial to add a procedure that saves the resulting BLOB to a database table instead.
Note: Since PL_FPDF is based on FPDF, I found the online documentation for FPDF (see link above) very useful in order to find out how the API for PL_FPDF works.
create or replace procedure test_pl_fpdf as l_text varchar2(32000) := 'First, reduce actual complexity by eliminating unnecessary features and then hiding what you can''t eliminate. Secondly, reduce perceived complexity by minimizing visual noise and reusing elements. And finally, use the blank state to help orient users. Minimizing complexity in the user interface will help people learn your application more quickly, use it more effectively and be happier all the while. As jazz musician Charles Mingus said, "Making the simple complicated is commonplace; making the complicated simple, awesomely simple, that''s creativity."'; begin -- create document in portrait mode, use measurements in millimeters (mm), and use the A4 page format pl_fpdf.FPDF('P','mm','A4'); pl_fpdf.openpdf; -- display full page, two facing pages pl_fpdf.setdisplaymode ('fullpage', 'two'); -- a procedure that will be called at the end of each page -- pl_fpdf.setfooterproc('demo.test_pdf_footer'); pl_fpdf.AddPage(); -- set up some headers pl_fpdf.SetFillColor(255,128,128); pl_fpdf.SetFont('Arial','B',14); --this header will be filled with the background color pl_fpdf.cell(40,7,'TABLESPACE', 1, 0, 'L', pfill => 1); pl_fpdf.cell(40,7,'CONTENTS', 1); pl_fpdf.cell(40,7,'INITIAL EXTENT', 1, 1); pl_fpdf.SetFont('Arial','',14); for l_rec in (select tablespace_name, contents, initial_extent from dba_tablespaces order by 1) loop pl_fpdf.settextcolor(0,0,0); pl_fpdf.cell(40,7,l_rec.tablespace_name,'B'); pl_fpdf.cell(40,7,l_rec.contents,'B'); -- some conditional formatting if l_rec.initial_extent > 66000 then pl_fpdf.settextcolor(255,0,0); else pl_fpdf.settextcolor(0,0,0); end if; pl_fpdf.cell(40,7,l_rec.initial_extent,'B', 1, 'R'); end loop; -- a page that shows how to position chunks of text (with automatic line breaks) on the page pl_fpdf.AddPage(); pl_fpdf.SetFont('Arial','B',16); pl_fpdf.setxy (100, 20); pl_fpdf.Cell(10,10,'Cool Quote 1:'); pl_fpdf.setxy (100, 50); pl_fpdf.SetFont('Times','',12); pl_fpdf.multicell(100,0,l_text); pl_fpdf.SetFont('Arial','B',16); pl_fpdf.setxy (10, 130); pl_fpdf.Cell(10,10,'Cool Quote 2:'); pl_fpdf.setxy (10, 150); pl_fpdf.SetFont('Times','',12); pl_fpdf.multicell(100,0,l_text); -- a page that demonstrates some simple drawing with lines and rectangles pl_fpdf.AddPage(); pl_fpdf.SetFont('Arial','B',14); pl_fpdf.Cell(0,0,'And now, some beautiful line art...',0,1,'C'); pl_fpdf.line (10,10, 50, 50); pl_fpdf.rect (50,50, 50, 50); pl_fpdf.setdrawcolor(0,255,0); pl_fpdf.line (150,150, 50, 50); pl_fpdf.setdrawcolor(0,0,0); -- a simple table of employees, without headings pl_fpdf.AddPage(); for l_rec in (select empno, ename from emp order by ename) loop pl_fpdf.cell(40,7,l_rec.empno, 'B'); pl_fpdf.cell(40,7, l_rec.ename, 'B', 1); end loop; pl_fpdf.SetFont('Arial','B',48); pl_fpdf.settextcolor(0,0,255); pl_fpdf.setxy (100, 250); pl_fpdf.cell(80,10,'THE END', palign => 'C'); pl_fpdf.Output(); end test_pl_fpdf;
Conclusion: While PL/PDF is more advanced in terms of features, PL_FPDF might be for you if you just need some simple PDF reports in your application.
http://ora-00001.blogspot.com/2009/10/free-pdf-package-for-plsql.html
发表评论
-
用函数unistr将Oracle数据库中的Unicode转换为中文
2016-07-19 11:51 7918例子: DECLARE V_EXT_DES V ... -
ORACLE APPLICATION EXPRESS 5.0 升级
2016-05-12 11:43 580Oracle11GR2 XE 缺省是安装了oracle ap ... -
Oracle ACL(Access Control List)
2016-05-12 11:36 889在oralce 11g中假如你想获取server的ip或者h ... -
了解systemstate dump
2016-04-26 14:09 487当数据库出现严重的性能问题或者hang了的时候,我们非常需要 ... -
通过ORACLE的UTL_HTTP工具包发送包含POST参数的请求
2016-03-18 16:25 5152DECLARE req utl_http. ... -
Shell: extract more from listener.log(分析监听日志)
2016-03-16 14:57 1148统计一天内每小时的session请求数 # fgrep ... -
ORA-01031: insufficient privileges 问题解决笔记
2016-02-01 15:53 1186A) File $Oracle_HOME/network/a ... -
listener.log中报Warning: Subscription For Node Down Event Still Pending问题的解决方法
2016-01-07 16:34 1634一套Oracle 10.2.0.1 for aix的数据库环 ... -
Oracle触发器和MySQL触发器之间的区别
2015-11-19 12:55 670Oracle触发器格式: CREATE [OR RE ... -
查询正在执行的存储过程
2015-11-13 09:27 20501、找正在执行的PROCEDURE的 sid ,serial# ... -
undo表空间损坏的处理过程
2015-10-14 13:49 1219磁碟陣列故障,分區/rman上包括undo和archivel ... -
登录oracle资料库时很久无反应的问题处理一例
2015-10-11 10:56 993原因是系统存在僵死的进程,促使session处于激活状态.首 ... -
TNS-12560问题解决
2015-10-01 19:52 613tnsping远程主机实例出现TNS-12560: TNS ... -
查看undo中sql语句的占用情况
2015-08-06 17:18 1764查看undo中sql语句的占用情况 select * ... -
Install Open System Architect And ODBC Instant Client
2015-05-21 14:03 749How to Install Open System Arc ... -
恢复oracle中用pl sql误删除drop掉的表
2015-04-03 16:12 553查看回收站中表 select object_name,or ... -
在Oracle Linux 6.6上安装Oracle 10gR2
2015-01-15 15:36 2681查看硬體配置 # df -h Filesystem ... -
kill
2015-01-03 11:36 457--根据某一对象查询进程 col owner fo ... -
Oracle 数据库Storage存储迁移笔记
2014-12-27 11:08 9861.确认数据文件、控制文件、临时文件、日志文件 位置 / ... -
異地備份資料庫的開啟步驟
2014-11-19 14:03 487使用EMC設備執行異地備份, 資料庫的複製是開啟的狀態下, ...
相关推荐
3. **PL/SQL程序加密**:Oracle提供了WRAP工具,用于对PL/SQL代码进行加密,以保护源代码不被查看。 4. **FUNCTION、PROCEDURE与PACKAGE的区别**: - FUNCTION:是无返回值或返回一个值的PL/SQL代码块。 - ...
知识点:FUNCTION、PROCEDURE 和 PACKAGE 是 PL/SQL 中的三个基本概念,function 和 procedure 是代码的集合,而 PACKAGE 是一组 function 和 procedure 的集合。 5. 解释 TABLE Function 的用途 答案:TABLE ...
6. **处理过大的匿名PL/SQL代码块**:找出长度超过500个字符的匿名PL/SQL代码块,并考虑将其转换为存储过程或保留在共享池中。 ```sql SELECT sql_text FROM v$sqlarea WHERE command_type = 47 AND length(sql_...
6. **PL/SQL调用** PHP还可以执行Oracle的PL/SQL块,这需要用到oci_parse并传递包含PL/SQL的字符串。例如: ```php $stmt = oci_parse($conn, 'BEGIN package_name.procedure_name(:param1, :param2); END;'); ...
- 将大型匿名PL/SQL代码块转换为小型匿名PL/SQL代码块,并调用存储过程以减少内存碎片。 - 对于特别大的匿名PL/SQL代码块,可以考虑使用`dbms_shared_pool.keep()`函数将其保留在Shared Pool中。 **2. Execution ...
当需要立即刷新物化视图时,可以使用以下PL/SQL命令。 #### PL/SQL命令分析: ```sql EXEC DBMS_MVIEW.REFRESH('TD_M_DEPART', 'FAST'); ``` - **功能**:手动刷新名为 `TD_M_DEPART` 的物化视图。 - **参数**: ...
查看PL/SQL Package中的错误信息 - **知识点**:使用`SHOW ERRORS`命令可以查看PL/SQL包中的编译错误或其他问题。这对于调试非常有用。 #### 27. 分析表和索引的状态 - **知识点**:`ANALYZE`命令用于收集表和...
- ash_sql <sql_id> Show all ash rows group by sampli_time and event for the specified sql_id - [-u <user/passwd>] degree degree of objects for a given user - [-u <user/passwd>] colstats stats for ...
如果在编译PL/SQL Package时遇到错误,可以通过以下命令查看错误信息:`SHOW ERRORS PACKAGE pkg_name;` 或者使用Oracle Enterprise Manager等工具来查看更详细的错误报告。 ### 10. 如何搜集表的各种状态数据 ...
显示PL/SQL Package编译错误 - 使用`DBMS_OUTPUT`包显示错误信息。 - 使用`DBMS_SERVEROUTPUT.ENABLE`启用输出。 #### 47. 搜集表的各种状态数据 - 使用`DBMS_STATS.GATHER_TABLE_STATS`命令。 #### 48. 启动...
4. 开发和管理中常用的工具包括Toad、PL/SQL Developer、SQL Developer、Oracle Enterprise Manager等。 5. 获取Oracle信息的途径有官方文档、技术论坛(如Oracle Technet、ITPUB)、博客、邮件列表等。 6. 解决一...
PL/SQL procedure successfully completed 从红色字体可以看出,恢复72622条,刚好是truncate前业务表中记录数,恢复临时表为:SYS.TRUNTAB1$$2 第七步:查看输出内容和构造表名: insert into truntab1 ...