1.  You will need a Long character field to hold the HTML string. You can use the delivered field HTMLAREA if there is no need to create a custom field.

2.  Create a new page.

3.  Place an HTML Area on the page.

4.  Assign a record and field to the HTML Area Properties page. (Note: The field used for the HTML Area needs to be of type LONG character.)

5.  Verify the HTML Area is at Level0.

6.  Add the push button to the page that will kick off the Print request. Make the Destination dropdown box be “External Link”. The External Link frame should have the “Dynamic” radio button selected.

Note: Make sure that the push button field that you use is long enough to contain the code that will be added in a future step (min of 25 characters).

7.  On the General tab of the Push Button/Hyperlink Properties page, make sure to fill in a Page Field Name. For this example, you see PRINT_BTN which will be placed in the print HTML below as #PRINT_BTN. This page field name is used so that the print function knows which button(s) to hide when the page is printed.

8.  Add the following PeopleCode to the Component Record PeopleCode RowInit event.

MY_TEST_WRK.HTMLAREA.Value = "<style type=""text/css"">@media print {body { zoom:80%;} #PAGEBAR,.PSHEADERTOOLBARFRAME, #PRINT_BTN { display: none }}</style>";

Explanation of the HTML above:

Zoom: The percentage listed after zoom will be how to shrink the web page on the printout (or expand if greater than 100). In this example, the HTML is printing the page at 80% of its normal size.

#PAGEBAR and .PSHEADERTOOLBARFRAME get a handle on the delivered PeopleSoft headers and navigation bar on the page.  By also listing #PRINT_BTN the HTML is instructed to hide these areas on the printed page.

Additional buttons that you have on your page can be placed into this HTML text. The Page Name field just needs to be prefaced with the pound symbol (#).

All buttons that you desire to hide must be at Level0.

Alternatively, the code can be placed as a constant value on the HTML Area Properties page if the zoom percentage will never change (page size remains constant).

To dynamically control the percentage to shrink or expand the output, use code similar to this and place in a function that would be called whenever the page dimensions are changed by user activity:

/* I Want to dynamically control Page Percentage so all will fit */&Percnt = 80 - &somenumber_or_equation;MY_TEST_WRK.HTMLAREA.Value = "<style type=""text/css"">@media print {body { zoom:" | &Percnt |"%;} #PAGEBAR, .PSHEADERTOOLBARFRAME, #PRINT_BTN { display: none }}</style>";

9.  On the Component Record Field PeopleCode FieldDefault event for the push button, place the following code:

MY_TEST_WRK.MY_TEST.Value = "javascript:window.print()";

10.  Run the page in the browser. The HTML area is not visible since there is no text, only a script.

11.  Pressing the Test Print button will bring up the printer dialog box where you can switch to another printer, along with setting the printing preferences (landscape vs. portrait orientation, etc):

12.  When the page prints, notice that the Test Print push button that was specified to not display is not shown on the printed page. Also, the PeopleSoft navigation bars and headers are not shown either.

最新文章

  1. SQL 常识
  2. 20169212《Linux内核原理与分析》第四周作业
  3. Javascript构造函数与prototype
  4. sql server 2008 操作数据表
  5. page cache 与 page buffer 转
  6. 管道和FIFO
  7. PHP初学留神(五)&#183;小结
  8. 编译u-boot命令和u-boot常用命令
  9. HDU_2035——求A^B的最后三位数
  10. USACO Chapter 1 解题总结
  11. VMWare12安装CentOS7以及redis安装和常用命令
  12. Swift Runtime ?
  13. Windows系统安装pip方法
  14. Django学习笔记(3)——表单,测试和模板语法的学习
  15. mysql 下载地址
  16. [转] linux学习第四十四篇:Nginx安装,Nginx默认虚拟主机,Nginx域名重定向
  17. Python startswith() 函数 判断字符串开头
  18. Java并发程序设计(九)设计模式与并发之不变模式
  19. windows 10下oracle相关异常及处理方法
  20. Pandas基本功能之选取索引和过滤

热门文章

  1. ThinkPHP CURD返回结果参考
  2. [经验总结]利用xlstproc处理XSLT的makefile
  3. SQL Server 2005中的分区表(四):删除(合并)一个分区(转)
  4. golang.org/x/mobile/exp/gl/glutil/glimage.go 源码分析
  5. ecmall程序结构图与常用数据库表
  6. (转)C#使用Mysql记录
  7. Linux平台块设备到字符设备(裸设备)的三种映射方式(转载)
  8. Grunt - Karma 单元测试
  9. 关于scrollview监听的一些方法
  10. Tile-Based Deferred Rendering