Pagesize in reports 6i?
Hi,
I am running a report on reports 6i, i have to print this report on legal
size paper.
i have set the main section width 20 and height 20 and as well as
report width 120 report height 80 i set.
but when iam running its fine but when iam printing the report its
printing from half the page skipping in the beginning of the page.
is there any where that i need to set the page size, because we are
upgrading reports from 3.0 to 6i.
any thoughts will be helpful.
thanks.
Because you want legal size output, you need to set the report header/main/trailer sections size to 8.5 in x 14 in. You can do that by bring up the property sheet and change the width and height for each section in the navigator under page layout. When you do print, select page setup from File menu and choose legal size paper.
Similar Messages
-
Changing Pagesize in Reports 10 On Solaris platform
All,
I use the reports builder on a Windows machine, then copy the .rdf file over to a Solaris 10 environment. I use the rwconvert to convert from an rdf to rep file on Unix. One of the reports I'm working on needs legal paper (8.5 X 15). I have a single tray (tray2) setup on my lexmark printer that contains the appropriate paper. Here is the command I'm using to generate the report, then the Unix lpr command to print the report:
rwrun.sh SERVER=rep_dvmvdb01_FRHome2 report=PICKTICKET userid=move/******@DM1 destype=file desname=/opt/optum/move/5.4.1.17//tmp/PL_MSDS_HAZ/PICKTICKET_1049678.out cmdfile=/opt/optum/move/5.4.1.17//tmp/PL_MSDS_HAZ/PICKTICKET_1049678.prm
lpr -Ppl01 -Zlegal PICKTICKET_1049678.out
My issue is no matter how I form my commands, this report will only generate on normal letter paper stock.
I have set up within the report builder paper_layout / Main section, width 8.5 height 15 and character mode width 80 height 122.
I have also tried different variations of using "PAGESIZE=8.5X15" within the rwrun command above and have gotten no luck.
Can anyone assist me with this?Dear Goyal,
Please follow the below guides point by point..
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0820f18-7ed6-2910-1d81-9c5929352514
and
SAP Installation Guide.
Once you done with installation you can move Database Cluser Services to Node B, so Node B will be act as Database + Application Server and Node A will be CI + Application Server.
Cheers
Rayees Palot -
Is there anybody who can solve this
I have seen so many query related to this on this forum, But i have not seen single satisfactory answer for the same.
This is really disappointing. Despite of so many experts are there this is remained unsolved.
Let me try once again, This is Printing problem in D2k Reports, Where I am using 150 column report, It works fine on 98,NT but i try the same from 2000 or XP platform it doesn't comes properly. Almost 80-90 character print in one line and rest goes in next line.
Thanks
ShitalDear Sir,
Of course i responsible to solve my problem, but if i am not able to solve than only i forward on this forum and if nobody able to solve than who is responsible??
Any way, here i am puting some info.
Mode : Client/Server
reports-version : 6.0.8.26.0
Desired output-format : Character mode
Pagesize : In report 8.5-11(W-H), In PRT file width is 150 defined.
The report works fine on Win98 and create problem on 2K and XP.
Thanks
Vishal -
How to change the pagesize of a report?
Hi,
I'm confused by a 100%-standardproblem but didn't figure it out yet :-(
I want to decrease the pagesize of a report (output into pdf), so the "white area" in acrobat reader should be smaller then a4 (standard).
My "solution": I moved and resized the border of the mainsection - now the content is at it's right place, but the whole page (white area) is still to large.
Even if I create new (=empty) report, I don't know where to change the size of the report.
I'm using Report Builder 9.0.4.0.21.
Can somebody please help me with this? Thank's a lot. :-)You should be able to do that by so:
Go into the object navigator. Click on Paper Layout, and click on the Main Section label (not the plus sign). Hit F4 for properties - height and width are there. I think if you just changed those to what A4 is designated as, it should work.
Note if you use a header/footer page, you would need to do the same to those pages as well.
Hope that helps as I have not actually needed to do this yet. Good luck! -
Please, I am trying to modify the PAGESIZE of the report in reports 6. I could do this in report 5 very easily from the report properties. But in reports 6 I can not find these properties. Can anyone help please
Thanks in advancehi,
Set page size to 11 by 8.5 and set orientation property to landscape.. Try to print and see.. sometimes it shows as protrait in page setup..
There is a bug in oracle reports 6.0, that is reports automatically changes page margins ,If you run landscape report after portrait report(that you can find in page setup)..to overcome this problem you need to install patch6a..
Suresh -
Hi my name is vishal
For past 10 days i have been breaking my head on how to make column headers in table appear bold while datas in table appear regular from c# windows forms with sql server2008 using iTextSharp.
Given below is my code in c# on how i export datas from different tables in sql server to PDF report using iTextSharp:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.Diagnostics;
using System.IO;
namespace DRRS_CSharp
public partial class frmPDF : Form
public frmPDF()
InitializeComponent();
private void button1_Click(object sender, EventArgs e)
Document doc = new Document(PageSize.A4.Rotate());
var writer = PdfWriter.GetInstance(doc, new FileStream("AssignedDialyzer.pdf", FileMode.Create));
doc.SetMargins(50, 50, 50, 50);
doc.SetPageSize(new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.LETTER.Width, iTextSharp.text.PageSize.LETTER.Height));
doc.Open();
PdfPTable table = new PdfPTable(6);
table.TotalWidth =530f;
table.LockedWidth = true;
PdfPCell cell = new PdfPCell(new Phrase("Institute/Hospital:AIIMS,NEW DELHI", FontFactory.GetFont("Arial", 14, iTextSharp.text.Font.BOLD, BaseColor.BLACK)));
cell.Colspan = 6;
cell.HorizontalAlignment = 0;
table.AddCell(cell);
Paragraph para=new Paragraph("DCS Clinical Record-Assigned Dialyzer",FontFactory.GetFont("Arial",16,iTextSharp.text.Font.BOLD,BaseColor.BLACK));
para.Alignment = Element.ALIGN_CENTER;
iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance("logo5.png");
png.ScaleToFit(105f, 105f);
png.Alignment = Element.ALIGN_RIGHT;
SqlConnection conn = new SqlConnection("Data Source=NPD-4\\SQLEXPRESS;Initial Catalog=DRRS;Integrated Security=true");
SqlCommand cmd = new SqlCommand("Select d.dialyserID,r.errorCode,r.dialysis_date,pn.patient_first_name,pn.patient_last_name,d.manufacturer,d.dialyzer_size,r.start_date,r.end_date,d.packed_volume,r.bundle_vol,r.disinfectant,t.Technician_first_name,t.Technician_last_name from dialyser d,patient_name pn,reprocessor r,Techniciandetail t where pn.patient_id=d.patient_id and r.dialyzer_id=d.dialyserID and t.technician_id=r.technician_id and d.deleted_status=0 and d.closed_status=0 and pn.status=1 and r.errorCode<106 and r.reprocessor_id in (Select max(reprocessor_id) from reprocessor where dialyzer_id=d.dialyserID) order by pn.patient_first_name,pn.patient_last_name", conn);
conn.Open();
SqlDataReader dr;
dr = cmd.ExecuteReader();
table.AddCell("Reprocessing Date");
table.AddCell("Patient Name");
table.AddCell("Dialyzer(Manufacturer,Size)");
table.AddCell("No.of Reuse");
table.AddCell("Verification");
table.AddCell("DialyzerID");
while (dr.Read())
table.AddCell(dr[2].ToString());
table.AddCell(dr[3].ToString() +"_"+ dr[4].ToString());
table.AddCell(dr[5].ToString() + "-" + dr[6].ToString());
table.AddCell("@count".ToString());
table.AddCell(dr[12].ToString() + "-" + dr[13].ToString());
table.AddCell(dr[0].ToString());
dr.Close();
table.SpacingBefore = 15f;
doc.Add(para);
doc.Add(png);
doc.Add(table);
doc.Close();
System.Diagnostics.Process.Start("AssignedDialyzer.pdf");
if (MessageBox.Show("Do you want to save changes to AssignedDialyzer.pdf before closing?", "DRRS", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation) == DialogResult.Yes)
var writer2 = PdfWriter.GetInstance(doc, new FileStream("AssignedDialyzer.pdf", FileMode.Create));
else if (MessageBox.Show("Do you want to save changes to AssignedDialyzer.pdf before closing?", "DRRS", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation) == DialogResult.No)
this.Close();
The above code executes well with no problem at all!
As you can see the file to which i create and save and open my pdf report is
AssignedDialyzer.pdf.
The column headers of table in pdf report from c# windows forms using iTextSharp are
"Reprocessing Date","Patient Name","Dialyzer(Manufacturer,Size)","No.of Reuse","Verification" and
"DialyzerID".
However the problem i am facing is after execution and opening of document is my
column headers in table in pdf report from
c# and datas in it all appear in bold.
I have browsed through net regarding to solve this problem but with no success.
What i want is my pdf report from c# should be similar to following format which i was able to accomplish in vb6,adodb with MS access using iTextSharp.:
Given below is report which i have achieved from vb6,adodb with MS access using iTextSharp
I know that there has to be another way to solve my problem.I have browsed many articles in net regarding exporting sql datas to above format but with no success!
Is there is any another way to solve to my problem on exporting sql datas from c# windows forms using iTextSharp to above format given in the picture/image above?!
If so Then Can anyone tell me what modifications must i do in my c# code given above so that my pdf report from c# windows forms using iTextSharp will look similar to image/picture(pdf report) which i was able to accomplish from
vb6,adodb with ms access using iTextSharp?
I have approached Sound Forge.Net for help but with no success.
I hope anyone/someone truly understands what i am trying to ask!
I know i have to do lot of modifications in my c# code to achieve this level of perfection but i dont know how to do it.
Can anyone help me please! Any help/guidance in solving this problem would be greatly appreciated.
I hope i get a reply in terms of solving this problem.
vishalHi,
About iTextSharp component issue , I think this case is off-topic in here.
I suggest you consulting to compenent provider.
http://sourceforge.net/projects/itextsharp/
Regards,
Marvin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Report header/footer not getting displayed ondashboard
We added deault header/footer to OBI reports as per the steps given in OBI Presentation services
administrator guide (section 3: Administering Oracle BI Answers):
By adding xml code as below under 'OracleBIData\web\msgdb\customMessages' folder
<WebMessage name="kuiCriteriaDefaultViewElements" translate="no"><HTML>
<view signature="compoundView" >
<pageProps pageSize="a4">
<pageFooter showOnDashboard="true" show="true">
<zone type="top"><caption>Footer Text</caption>
<displayFormat fontColor="#FF0000"/></zone>
</pageFooter>
</pageProps>
</view>
</HTML>
</WebMessage>
The 'Footer text' is coming in all new requests created, but when we add that request to a
dashboard as embedded section, the footer is not displayed. Can anybody please provide some
information that how we can get any customized text/link added in report footer to get displayed
on the dashboard page.
Thanks!Hi..
yes, whatever the headers/footers you have mentioned in report will not be shown in dashboard..
But if you mention the report link - download (don't specify headers/footers for dashboard at this time), when you download that report you can see the headers/footers in that report..
But when you use download option for whole dashboard, you can't see those h/f s unless you mention the h/f s for the dashboard...
This is expected, because when user download the dashboard he shouldn't see the 2 h/f s.
So, you need to mention the print pdf s in edit dashboard.
Hope it's clear..
Thanks & Regards
kishore Guggilla -
Printing from HTML rendered page assume bigger margins than defined on the report
Hello!
I have a report with PageSize and InteractiveSize of 29,7cm x 21cm and Margins of 2cm each.
Body of report is 25cm width.
When rendered in report server and then try to print it I get some blank pages because it changes print margins to 2,032cm each!
I tried other margin sets like 5cm, and it changes to 5,08cm.
If I set margins to 1,5cm it changes to 1,4986cm.
I tried to print to a different printer and does the same.
Does anyone knows why this happens and if I can control it?
Thanks in advance.
Carla BaptistaI'm running OS X 10.5.4 on a Mac Pro with 2 x 2.8 GHz Quad-Core Intel Xeon & 4 GB 800 MHz DDR2 FB-DIMM Memory (I installed the latest security update this past week).
I updated to ACR 4.5 (thru adobe tech help) after installing the security update. I've been using Epson driver 6.10- beta version for Mac OS X 10.5 for several months with no problems.
Seems to me that ACR 4.5 previews stated that some printing issues would be fixed with this upgrade, along with support for more cameras, and support for linking to CS3 from LR2.0.
It is possible that the security update affected printing from Adobe CS3. Several months ago there were serious problems printing from Aperture & Lightroom that were "fixed" with an OS X security update. Some of those problems were printing size & orientation problems, as well as incorrect color. I checked printing after this latest security update, but not with custom sizes.
I guess I'll have to do some further investigating to determine what exactly is causing the current problem & find a workaround. I'm not a computer expert - I'm a photographer. And I'm getting weary of having to find fixes for things that should have been handled by the development staff for the various software products that I'm using - plus, it gets expensive when paper and ink are wasted - very expensive when printing to large custom sized paper. And very bothersome when you cannot depend on what you see in the preview window as to print size nor orientation.
Anybody else out there with similar problem with the latest upgrades? -
Hi,
am going to generate an HTML report for a table by using below code
SET heading off
SET pagesize 80
SET MARKUP HTML ON SPOOL ON HEAD "<TITLE>Job Comparison Report</title> -
STYLE TYPE=’TEXT/CSS’><!--BODY {background: ffffc6} --></STYLE>"
SET ECHO OFF
SPOOL "C:\Jc\Reports\LoadUnmatchedCustomerHistory.htm"
select * from TB_JOB_REPORT;
SPOOL OFF
SET MARKUP HTML OFF
SET ECHO ON
its working fine.
but in my TB_JOB_REPORT table contains more than hundred accounts information also which is having only two fileds one is ACCT_NUM another one is TEXT_REPORT. i just want to geenrate individual report for each account as of now am getting all accounts information in a single report.
is there any possibility to generate a report for individual accounts.
like select * from TB_JOB_REPORT where ACCT_NUM=???, i just want to pass a loop to get corresponding account information but not sure how to implement this logic in for loop.
any ideas to do this please share me...
Thanks in advanceLast week I have played with something like below (not tested!!! not very sure I remember all :( - just to get an idea ;)
html attributes (fonts, colors, borders, ... you name it - I'm not even aware of) were filled in by others
with
the_data as
(select 1 a_number,'abc' a_string,sysdate a_date from dual union all
select 2,'qwertzuiop',trunc(sysdate) - 2 from dual union all
select 3,'qwxy',to_date(null) from dual union all
select 4,null,to_date('1.5.2000','dd.mm.yyyy') from dual union all
select null,'?',trunc(sysdate) from dual
select xmlelement("table",
xmlagg(
xmlelement("tr",
xmlelement("td",xmlattributes('right' as align), 2 * a_number),
xmlelement("td", initcap(a_string)),
xmlelement("td", to_char(a_date,'yyyy-mm-dd hh24:mi:ss'))
order by a_number desc nulls first
).getclobval()
from the_dataRegards
Etbin -
Problems with report using isql*plus
Hi there,
As the title of this topic illustrates, i'm having trouble dumping relevant data from columns of different tables. Using isql*plus, I have three tables appropriatly related. A 'course' table, 'student' and 'next_of_kin' tables. I have many students enrolled on various courses but only a hanfull of courses offer the module option 'Database Systems'. I have no 'module' table but i know the three course names which provide the module option. I intend on producing a report hich lists all students enrolled on the courses which provid the module option 'Database Systems'. I have attempted the report but i keep getting a 'cartesian product' displaying all next_of_kin names instead of the appropriate. Also i am struggling to come up with the right WHERE statement to depict only the three courses which provide the module option 'Database Systems' as defined by 'courseNo' in both 'course' and 'student' tables.
Here is the most recent attempt:
--set echo off*
--set pagesize 24*
--set feedback off*
--set linesize 78*
col A format 99999999 heading 'Student No'
col B format A15 heading 'Student Name'
col C format A15 heading 'Course Name'
col D format 99999999 'Course No'
col E format A10 heading 'Next-of-Kin'
break on A skip 1 on B
TTitle 'Business Studies 1 Option BT300'
BTitle 'Prepared By : Richard Stroud / 20527796'
Select student.StudentNo "Student No",
student.fName || ' ' || student.lName "Student Name",
course.title "Course Name",
course.courseNo "Course No",
next_of_kin.fName || ' ' || next_of_kin.lName "Next-of-Kin"
From student, course, next_of_kin
where course.courseNo = '12885545'
order by studentNo
--clear columns*
--TTitle off*
--BTitle off*
--set feedback on*
--set pagesize 24*
--clear breaks*
Any help towards this toipic will be GREATLY appreciatedAccording to my little knowledge - i don't think Oracle is an AIDB. It is only RDBMS or rather you can call it Advanced RDBMS.
Now, you are thinking that since you have provided the relavant table here - so Oracle should automatically pic the single records. Since you have define every logic including the concept of primary key, foreign key in your table.
But, question is - did you apply the relationship in your join between the tables.
What does a primary key, foreign key do inside a table? Is it automatically select the unique rows from the join tables - when you didn't mention the join criterion.
If you think that - then you are wrong. My advice is - kindly go through the JOIN Concept.
Then start your coding. This is very dangerous way to start. Learn the basics at least.
So, what Senti suggested has a very much valid point.
Regards.
Satyaki De. -
Simple PL/SQL Report - Using Break on and Compute Sum - Not So Simple
Good morning, All:
I have a simple pl/sql report that is not so simple. Basic on the code below, would like to add a blank line/row after the resulting "sum" row to make it easier to read. Any and all help would be appreciated.
Thank you.
Preston@Large
Code:
=======================
BREAK ON ALM_OG_CAMPAIGN_CODE
COMPUTE SUM OF ALM_OG_AMOUNT ON ALM_OG_CAMPAIGN_CODE
set linesize 1024
set pagesize 60
set newpage 0
set serveroutput on
SPOOL &so_outfile;
ttitle center 'Wayne State University' skip 1 Left 'WSU Online Giving Essentials Report' skip 2
select TO_CHAR(sysdate, 'mm/dd/yyyy hh:mm AM') "Report Date" from dual;
CLEAR COLUMNS
column ALM_OG_ACCI_CODE heading "ACCI|CODE" format a10
column ALM_OG_AMOUNT heading "AMOUNT|DONATED" format $999,999,999.99
column ALM_OG_CAMPAIGN_CODE heading "CAMPAIGN|CODE" format a14
select
ALM_OG_CAMPAIGN_CODE,
ALM_OG_ACCI_CODE,
ALM_OG_AMOUNT
From WSUALUMNI.WSU_ONLINE_GIVING_TABLE
ORDER BY ALM_OG_CAMPAIGN_CODE;
CLEAR COLUMNS
spool off
Output:
WSU Online Giving Essentials Report
Report Date
======================
06/05/2009 10:06 AM
1 row selected.
Wayne State University
WSU Online Giving Essentials Report
CAMPAIGN ACCI AMOUNT
CODE CODE DONATED
====== ======== ==========
sum $560.00
NUR 444814 $10.00
***** =======
sum $10.00
PHS 445216 $10.00
***** =======
sum $10.00
PRES 445211 $450.00
445211 $60.00
445211 $250.00
***** =======
sum $760.00
SBA 444216 $10.00
***** =======
sum $10.00
SSW 444469 $10.00
***** =======
sum $10.00Prestone,
Welcome to the Forum!
I have used skip 2 lines you can use 1
SQL> break on job report skip 2
SQL> compute sum of sal on job report
SQL> select job , sal from emp order by job ;
JOB SAL
ANALYST 3000
3000
sum 6000
CLERK 1300
950
800
1100
sum 4150
MANAGER 2850
2975
2450
sum 8275
PRESIDENT 5000
sum 5000
SALESMAN 1500
1250
1250
1600
sum 5600
14 rows selected.READ
Quick SQL*Plus Guide
http://download.oracle.com/docs/cd/B14117_01/server.101/b12171/toc.htm
SQL*Plus Reference
http://download.oracle.com/docs/cd/B14117_01/server.101/b12170/toc.htm
SS -
Hi All,
I am creating a report which is having 2 sql queries ,1 for the main columns that i need to show and 2 from total sum and count.
Report is something as given below
SET TAB OFF;
set linesize 1500;
set pagesize 50;
SET FEEDBACK OFF;
SET WRAP OFF
COLUMN today NEW_VALUE VAR1 NOPRINT;
TTITLE LEFT 'ABC Inc.' SKIP 1 -
LEFT 'Daily Report' SKIP 1 -
LEFT 'As Of ' VAR1 SKIP 2
BTITLE LEFT SKIP 'Page No : ' FORMAT 9999999999 SQL.PNO SKIP 3;
COL SR_NO HEADING 'Seq' FORMAT 999999;
COL REFNO HEADING 'Ref No' FORMAT A20;
COL ORIG_NAME HEADING ' Branch Name'
FORMAT A50;
SELECT ROWNUM SR_NO,
REF_NO REFNO,
ORIGIN_NAME BRNAME
FROM BANK
WHERE PASS_CD=101
SELECT ' Failure Count : '|| NVL(COUNT(DECODE(CODE,1,CODE,NULL)),0) ||
' Failure Total Amt : '|| NVL(SUM(DECODE(CODE,799,AMT,NULL)),0)
|| CHR(10) ||
' Successful Count : '|| NVL(COUNT(DECODE(CODE,000,CODE,NULL)),0) ||
' Successful Total Amt: '|| NVL(SUM(DECODE(CODE,000,AMT,NULL)),0)
FROM BANK;
CLEAR BREAKS;
CLEAR COLUMN;
TTITLE OFF;
When i am running this second query output is going to secong page and title is repeated again and same as 1rst page is showing page no-1
Kindly help me,i want the output on the same page at bottom.
Thanksi think its only work in ISQL* PLUS enivironment iam
not sure.It does work in SQL*Plus
is that i can use in the package??http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12048.htm -
A big problem of Generate report with PDF format....Urgent
I want to generate a report with pdf format through one java file, it have two page 1)gen_report.jsp 2) report_gen.java , the compliation was failed. However, i don't what the problem is .... i hope anyone can help me as it is very argent for me ....Thanks a lot
1)gen_report.jsp
<table id="AutoNumber1">
<tr>
<td background="images/top5movie.png">
<p align="center"> </p>
</td>
</tr>
<tr>
<td >
<div align="center">
<table id="AutoNumber2" >
<form method="GET" action="../report_gen" name="report_gen" target="_blank" onSubmit="javascript:return checkr1(this)">
<tr>
<td ><b>Report Description:</b></td>
<td >This report is to show the top five popular movies in cinemix for a period </td>
</tr>
<tr>
<td><b>Data scope:</b></td>
<td >Start from
<input type="text" name="start" value="2003-1-1" >to
<input type="text" name="end" value="2006-1-1" ></td>
</tr>
<tr>
<td><b>Data processing:</b></td>
<td >Show
<select name="order_by">
<option value="desc" selected>top</option>
<option value="asc">bottom</option>
</select>
5 films</td>
</tr>
<tr>
<td> <p align="center">
<input type="submit" value="View_Report" name="subm">
</p></td>
</tr>
<input type="hidden" name="report" value="r1">
</form>
<form method="GET" action="../report_gen" name="report_gen" target="_blank" onSubmit="javascript:return checkr2(this)">
<input type="hidden" name="report" value="r2">
</form>
</table>
</div>
</td>
</tr>
</table>Then my java code is here
report_gen.java
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.sql.*;
// chart and pdf out
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.xy.*;
import org.jfree.data.xy.XYBarDataset;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.statistics.SimpleHistogramDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.DefaultFontMapper;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfTemplate;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;
import com.lowagie.text.pdf.PdfPCell;
public class report_gen extends HttpServlet
private final String titles[] = {"Top Five popular movies ",
"Financial cirumstance of cinemas",
"Distribution of time segment",
"Distribution of favourite movie type"
private final String descs[] = {"This report is to show the top five popular movies in cinemix for a period ",
"This report is to show the financial circumstance of each cinema site ",
"This report is to analysis the customer when is the most visit time ",
"This report is to analysis the customer which type of movie do they watch the most"
private final String bigTitle = "Cinemix";
private final String driver = "org.gjt.mm.mysql.Driver";
private final String url= "jdbc:mysql://localhost:3306/cinemix";
private final String userID = "abc";
private final String passwd = "abc";
public void init(ServletConfig config) throws ServletException
super.init(config);
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
final int width = 550;
final int height = 200;
/ title font (centre and report title)
final Font fTitle0 = FontFactory.getFont("Helvetica", 42, Font.BOLD);
final Font fTitle1 = FontFactory.getFont("Helvetica", 30, Font.BOLD);
// centre name:
final String title0 = bigTitle;
// Default category for DefaultCategoryDataset
final String cat = "data";
Connection conn;
JFreeChart chart;
String title1 = "xyz Report";
String chartDesc = "description";
String notes[] = new String[4];
String chartTitle = "so bad this is title";
String chartXTitle = "this is x";
String chartYTitle = "this is y.";
String report = request.getParameter("report");
int max=-10000;
int min=10000;
int j=0;
// do some basic checking
if (report == null || report.equals(""))
report = "-1"; // this course unknow report error message
String start = request.getParameter("start");
String end = request.getParameter("end");
String order_by = request.getParameter("order_by"); // ToDo: check invalid string
int topN = 5;
String order = (order_by.equals("desc")) ? "Top" : "Last";
String inv[] = {"08:30", "09:30", "10:30", "11:30", "12:30", "11:30", "12:30", "13:30", "14:30", "15:30", "16:30", "17:30","18:30","19:30","20:30","21:30","22:30","23:30"};
int inv_val[] = new int[inv.length - 1];
try
Class.forName(driver).newInstance();
catch(Exception e)
printE("Cannot load mysql database driver!", response);
e.printStackTrace();
return;
try
conn = DriverManager.getConnection(url, userID, passwd);
if (report.equals("r1")) { // report 1
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
Statement stmt = conn.createStatement();
String sql = "select *,count(f.Name),f.Name from film f, filmDetail fd, ticket t where f.startDate > '" + start + "' and f.endDate < '" + end + "'and fd.filmID = f.filmID and fd.filmDetailID = t.filmDetailID group by f.name order by fd.filmDetailID asc limit '" +topN+"'";
ResultSet rs = stmt.executeQuery(sql);
while (rs.next())
if (rs.getInt("fd.filmDetailID") > max) max = rs.getInt("fd.filmDetailID");
if (rs.getInt("fd.filmDetailID") < min) min = rs.getInt("fd.filmDetailID");
j++;
ataset.setValue(rs.getInt("fd.filmDetailID"), cat,rs.getString("f.Name"));
title1 = titles[0];
chartDesc = descs[0];
chartTitle = order + " " + topN + " popular movie";
chartYTitle = "Box Office record";
chartXTitle = "Film Name";
gender = " ";
chart = ChartFactory.createBarChart(chartTitle, chartXTitle, chartYTitle, dataset,PlotOrientation.VERTICAL, false, true, false);
else
print("Error: I don't inderstand your request!", response);
return;
catch (SQLException e)
printE("Cannot open database connection? <br>", response);
// printE(e.toString);
e.printStackTrace();
return;
response.setContentType("application/pdf");
Document document = new Document(PageSize.A4, 5, 5, 5, 5);
try
PdfWriter writer;
writer = PdfWriter.getInstance(document, response.getOutputStream());
HeaderFooter footer = new HeaderFooter(new Phrase("Page: "), true);
footer.setBorder(Rectangle.NO_BORDER);
document.setFooter(footer);
footer.setAlignment(Element.ALIGN_CENTER);
// step 3
document.open();
document.add(getHeader(title0, title1, start, end, gender, order, topN, chartDesc));
document.add(printChart(chart, writer));
document.add(getFooter(notes));
catch(DocumentException de)
de.printStackTrace();
// step 5
document.close();
return;
}// end doGet()
/** Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
// processRequest(request, response);
/** Returns a short description of the servlet.
public String getServletInfo()
return "Generate reports for " + bigTitle;
/* To print en error and exit(?) */
private void printE(Object obj, HttpServletResponse response) throws IOException
response.setContentType("text/html");
PrintWriter out;
out = response.getWriter();
out.print(obj.toString());
out.close();
// To-Do: how to force exiting?
// create data chart
private PdfPTable getHeader(String title0, String title1, String start, String end, String sex, String order, int topN, String desc)
Font fTitle0 = FontFactory.getFont("Helvetica", 42, Font.BOLD);
Font fTitle1 = FontFactory.getFont("Helvetica", 24, Font.BOLD);
Font fTitle3 = FontFactory.getFont("Helvetica", 12, Font.BOLD);
Font fValue = FontFactory.getFont("Helvetica", 12, Font.UNDERLINE);
Paragraph parStartEnd = new Paragraph();
parStartEnd.add(new Phrase("Data start from: ", fTitle3));
parStartEnd.add(new Phrase(start, fValue));
parStartEnd.add(new Phrase(" to ", fTitle3));
parStartEnd.add(new Phrase(end, fValue));
Paragraph parGenerateDate = new Paragraph();
parGenerateDate.add(new Phrase("Report generated at: ", fTitle3));
parGenerateDate.add(new Phrase(new java.util.Date().toString(), fValue));
Paragraph parGender = new Paragraph();
parGender.add(new Phrase("Current show gender: ", fTitle3));
parGender.add(new Phrase(sex, fValue));
Paragraph parTopN = new Paragraph();
parTopN.add(new Phrase("Now is showing ", fTitle3));
parTopN.add(new Phrase(order, fValue));
parTopN.add(new Phrase(" ", fValue));
parTopN.add(new Phrase(new Integer(topN).toString(), fValue));
parTopN.add(new Phrase(" record(s)", fTitle3));
// Start main table
PdfPTable tblMain = new PdfPTable(1);
tblMain.getDefaultCell().setBorder(0);
// Print title
tblMain.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
tblMain.addCell(new Paragraph(title0, fTitle0));
tblMain.addCell(new Paragraph(title1, fTitle1));
tblMain.addCell("");
tblMain.addCell("");
tblMain.addCell("");
// Print headers data
//tblMain.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
//tblMain.addCell(parInvoiceNum);
//tblMain.addCell("");
tblMain.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
tblMain.addCell(parStartEnd);
tblMain.addCell("");
tblMain.addCell(parGenerateDate);
tblMain.addCell("");
if (sex != " ")
tblMain.addCell(parGender);
else if(order != null && topN > 0)
tblMain.addCell(parTopN);
else
tblMain.addCell(" \n");
tblMain.addCell("");
tblMain.setWidthPercentage(96);
tblMain.addCell(new Paragraph("Description of this report:", fTitle3));
tblMain.addCell(desc);
tblMain.addCell("\n");
// Finish main table
return tblMain;
// print a chart _directly_ to pdf and return a empty Pdftable...
public PdfPTable printChart(JFreeChart chart, PdfWriter writer)
PdfContentByte cb = writer.getDirectContent();
int width = 550;
int height = 450;
PdfTemplate tp = cb.createTemplate(width, height);
Graphics2D g2d = tp.createGraphics(width, height, new DefaultFontMapper());
Rectangle2D r2d = new Rectangle2D.Double(0, 0, width, height); //->,
chart.draw(g2d, r2d);
g2d.dispose();
cb.addTemplate(tp, 20, 170);
// quick method to push down the footer text
// the only things this method return
PdfPTable tblDownDown = new PdfPTable(1);
tblDownDown.getDefaultCell().setBorder(0);
tblDownDown.addCell(" \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n");
tblDownDown.addCell(" \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n");
tblDownDown.addCell(" \n \n \n \n \n \n");
return tblDownDown;
public PdfPTable getFooter(String notes[])
Font fNote = FontFactory.getFont("Helvetica", 14, Font.UNDERLINE);
Font fComment = FontFactory.getFont("Helvetica", 12, Font.ITALIC);
Font fTitle1 = FontFactory.getFont("Helvetica", 30, Font.ITALIC);
// Start footer table
PdfPTable tblFooter = new PdfPTable(1);
tblFooter.getDefaultCell().setBorder(0);
if (notes != null)
tblFooter.addCell(new Paragraph("Notes:", fNote));
tblFooter.addCell("");
tblFooter.addCell("");
tblFooter.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
for (int i=0;i<notes.length;i++)
if (notes[i] != null)
tblFooter.addCell(new Paragraph("" + (i+1) + ". " + notes[i] + "", fComment));
tblFooter.addCell("");
tblFooter.addCell("");
tblFooter.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
tblFooter.addCell(new Paragraph("- End of report -", fComment));
return tblFooter;
}Go to the cache directory and see if you can open the report directly from here (not in IE).
I have seen posts on problems with Acrobat Reader Plugin for IE (I believe it was version 6 of Reader). -
Hi for past 3 days i was thinking and breaking my head on how to add entire new at top table created in pdf report from c# windows forms with iTextSharp.
First: I was able to create/export sql server data in form of table in pdf report from c# windows forms. Given below is the code in c#.
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Text;
using System.Data;
using System.IO;
using System.Data.SqlClient;
using System.Windows.Forms;
using iTextSharp.text;
using iTextSharp.text.pdf;
namespace DRRS_CSharp
public partial class frmPDFTechnician : Form
public frmPDFTechnician()
InitializeComponent();
private void btnExport_Click(object sender, EventArgs e)
Document doc = new Document(PageSize.A4.Rotate());
var writer= PdfWriter.GetInstance(doc, new FileStream("Technician22.pdf", FileMode.Create));
doc.SetMargins(50, 50, 50, 50);
doc.SetPageSize(new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.LETTER.Width, iTextSharp.text.PageSize.LETTER.Height));
doc.Open();
PdfPTable table = new PdfPTable(7);
table.TotalWidth=585f;
table.LockedWidth = true;
PdfPTable inner = new PdfPTable(1);
inner.WidthPercentage = 115;
PdfPCell celt=new PdfPCell(new Phrase(new Paragraph("Institute/Hospital:AIIMS,NEW DELHI",FontFactory.GetFont("Arial",14,iTextSharp.text.Font.BOLD,BaseColor.BLACK))));
inner.AddCell(celt);
Paragraph para = new Paragraph("DCS Clinical Report-Technician wise", FontFactory.GetFont("Arial", 14, iTextSharp.text.Font.BOLD, BaseColor.BLACK));
para.Alignment = iTextSharp.text.Element.TITLE;
iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance("logo5.png");
png.ScaleToFit(95f, 95f);
png.Alignment = Element.ALIGN_RIGHT;
SqlConnection conn=new SqlConnection("Data Source=NPD-4\\SQLEXPRESS;Initial Catalog=DRRS;Integrated Security=true");
SqlCommand cmd = new SqlCommand("Select t.technician_id,td.Technician_first_name,td.Technician_middle_name,td.Technician_last_name,t.technician_dob,t.technician_sex,td.technician_type from Techniciandetail td,Technician t where td.technician_id=t.technician_id and td.status=1", conn);
conn.Open();
SqlDataReader dr;
dr = cmd.ExecuteReader();
table.AddCell("ID");
table.AddCell("First Name");
table.AddCell("Middle Name");
table.AddCell("Last Name");
table.AddCell("DOB" );
table.AddCell("Gender");
table.AddCell("Designation");
while (dr.Read())
table.AddCell(dr[0].ToString());
table.AddCell(dr[1].ToString());
table.AddCell(dr[2].ToString());
table.AddCell(dr[3].ToString());
table.AddCell(dr[4].ToString());
table.AddCell(dr[5].ToString());
table.AddCell(dr[6].ToString());
dr.Close();
table.SpacingBefore = 15f;
doc.Add(para);
doc.Add(png);
doc.Add(inner);
doc.Add(table);
doc.Close();
The code executes well with no problem and get all datas from tables into table in PDF report from c# windows forms.
But here is my problem how can i align Title(DCS Clinical Report-Technician wise) center of pdf report with image named:logo5.png immediately coming to it's right?.
As the problem i am facing is my title or Header(DCS Clinical Report-Technician wise) is at top of my image named:logo5.png and not coming to it's center position of my image.
Second the problem i am facing is how to add new entire row to top of existing table in pdf report from c# windows form using iTextSharp?.
given in below is the row and it's data . So how do i add the given below row and it's data to my top my table in pdf report from c# windows forms using itextsharp?
as you can see how i create my columns in table in pdf report and populate it with sql server data. Given the code below:
Document doc = new Document(PageSize.A4.Rotate());
var writer= PdfWriter.GetInstance(doc, new FileStream("Technician22.pdf", FileMode.Create));
doc.SetMargins(50, 50, 50, 50);
doc.SetPageSize(new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.LETTER.Width, iTextSharp.text.PageSize.LETTER.Height));
doc.Open();
PdfPTable table = new PdfPTable(7);
table.TotalWidth=585f;
table.LockedWidth = true;
Paragraph para = new Paragraph("DCS Clinical Report-Technician wise", FontFactory.GetFont("Arial", 14, iTextSharp.text.Font.BOLD, BaseColor.BLACK));
para.Alignment = iTextSharp.text.Element.TITLE;
iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance("logo5.png");
png.ScaleToFit(95f, 95f);
png.Alignment = Element.ALIGN_RIGHT;
SqlConnection conn=new SqlConnection("Data Source=NPD-4\\SQLEXPRESS;Initial Catalog=DRRS;Integrated Security=true");
SqlCommand cmd = new SqlCommand("Select t.technician_id,td.Technician_first_name,td.Technician_middle_name,td.Technician_last_name,t.technician_dob,t.technician_sex,td.technician_type from Techniciandetail td,Technician t where td.technician_id=t.technician_id and td.status=1", conn);
conn.Open();
SqlDataReader dr;
dr = cmd.ExecuteReader();
table.AddCell("ID");
table.AddCell("First Name");
table.AddCell("Middle Name");
table.AddCell("Last Name");
table.AddCell("DOB" );
table.AddCell("Gender");
table.AddCell("Designation");
while (dr.Read())
table.AddCell(dr[0].ToString());
table.AddCell(dr[1].ToString());
table.AddCell(dr[2].ToString());
table.AddCell(dr[3].ToString());
table.AddCell(dr[4].ToString());
table.AddCell(dr[5].ToString());
table.AddCell(dr[6].ToString());
dr.Close();
table.SpacingBefore = 15f;
doc.Add(para);
doc.Add(png);
doc.Add(table);
doc.Close();
So my question is how to make my column headers in bold?
So these are my questions.
1. how can i align Title(DCS Clinical Report-Technician wise) center of pdf report with image named:logo5.png immediately coming to it's right?.
2. how do i add the given below row and it's data to my top my table in pdf report from c# windows forms using itextsharp?
3.how to make my column headers in bold?
I know that i have to do some modifications to my code but i dont know how to do it. Can anyone help me please.
Any help or guidance in solving this problem would be greatly appreciated.
vishalHi,
>>1. how can i align Title(DCS Clinical Report-Technician wise) center of pdf report with image named:logo5.png immediately coming to it's right?.
2. how do i add the given below row and it's data to my top my table in pdf report from c# windows forms using itextsharp?
3.how to make my column headers in bold?<<
I’m sorry for the issue that you are hitting now.
This itextsharp is third party control, for this issue, I recommended to consult the control provider directly, I think they can give more precise troubleshooting.
http://sourceforge.net/projects/itextsharp/
Thanks for your understanding.
Regards,
Marvin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Report output not using full page.
I have a report that does not use the full screen to display. The output display on about a 1.5 to 2 inch section of the page and the rest is white space. How do I get it to use the full page?
Hi Raymist123,
If I understand correctly, the issue which you occurred is that the report content only displayed about 1.5 to 2 inch. As per my understanding, I think this issue is caused by the report content including all the report items (table, matrix, list, chart,
gauge, text boxes etc.) is only occupied 1.5 to 2 inch on the report design surface. If in this case, we can try to expand the sizes of all the report items to fix the issue. And please make sure that the PageSize of the report have set to 8.5 x 11.
If this issue is still existed, could you please post the screenshot about the design surface and the all the size properties? Then we can make further analysis.
Hope this helps.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support
Maybe you are looking for
-
Enhance output of Target Group in segment builder
Hello Experts, We are implementing SAP CRM Lean Marketing using CRM 7.0. Our business requirement is to do segmentation based on Company attributes and Relationship Category. The output of the target group should enlist the persons related to the Com
-
Trying to make an image of a Server but getting error message
I'm trying to make a disk image (.dmg) of an XServe. I boot the XServe off of an external drive, fire up disk utility and choose File>New>Disk Image from <server volume> Then I choose where I want the .dmg file to be created. It doesn't matter where
-
declare a number; b varchar2(1) : 'c'; c varcha2(2) := 'XX'; d varchar2(2) := 'YY'; e varchar2(2); begin if a is null then b := 'c'; else b := 'd'; end if; execute immediate 'select ' || b || ' from dual ' into e; end; The above example uses a dynami
-
SCEP manager is not showing current logs for any SCEP clients
I have installed SCEP manager on one machine and it is managing one client, which is on another machine. Client is showing virus detected logs in SCEP client UI, but the same events/logs are not getting stored in SCEP manager database, i tried pullin
-
MAJOR problem upgrading from Panther to Tiger.
After what seemed like a successful installation of Tiger, after the installation software asked me to restart my computer, the computer just will not start up. Every time I start my computer up, it tells me that I need to restart it. I would really