Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Open Source Projects
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830
this week in the
Programmer Certification
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
Liutauras Vilda
Jeanne Boyarsky
paul wheaton
Sheriffs:
Ron McLeod
Devaka Cooray
Henry Wong
Saloon Keepers:
Tim Holloway
Stephan van Hulst
Carey Brown
Tim Moores
Mikalai Zaikin
Bartenders:
Frits Walraven
Forum:
Other Open Source Projects
regarding pdf Creation using iText
santhosh kumar vk
Ranch Hand
Posts: 152
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi,
This is Santhosh i am developing pdf using iText.jar, I want to merge my created pdf with existing pdf.
below code is my created pdf , how to merge new pdf with my created pdf
public void doGet(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse) throws ServletException, IOException { HttpSession httpsession = httpservletrequest.getSession(true); try { String s = ""; String s1 = ""; String s2 = ""; String s3 = ""; httpservletresponse.setContentType("application/pdf"); httpservletresponse.setHeader("Cache-Control", "max-age=18"); httpservletresponse.setHeader("Content-Disposition", "inline"); String s4 = httpservletrequest.getParameter("mode") == null ? "PRINT" : httpservletrequest.getParameter("mode"); wri("ls_printFlag*******>" + s4); String s5 = httpservletrequest.getParameter("hf_mailSend") == null ? "N" : httpservletrequest.getParameter("hf_mailSend"); try { List pdfs = new ArrayList(); pdfs.add(new FileInputStream("/srv/jboss_124/server/default/deploy/skanray.ear/skanray.war/upload/Essential Java for Scientists and Engineers.pdf")); pdfs.add(new FileInputStream("/srv/jboss_124/server/default/deploy/skanray.ear/skanray.war" +"/upload/Professional Eclipse 3 for Java Developers - ISBN 0470020059.pdf")); OutputStream output = new FileOutputStream("/srv/jboss_124/server/default/deploy/skanray.ear/skanray.war/upload/merge.pdf"); concatPDFs(pdfs, output, true); } catch (Exception e) { e.printStackTrace(); } wri("ls_emailFlag=========>" + s5); if (s4.equalsIgnoreCase("PRINT")) lb_flag = false; if (s5.equalsIgnoreCase("Y")) { lb_flag = true; lsa_to = httpservletrequest.getParameter("tf_to"); wri("lsa_to=>" + lsa_to); lsa_cc = httpservletrequest.getParameter("tf_cc"); wri("lsa_cc=====>" + lsa_cc); lsa_bcc = httpservletrequest.getParameter("tf_bcc"); wri("lsa_bcc========>" + lsa_bcc); lsa_subject = httpservletrequest.getParameter("tf_subject"); wri("lsa_subject========>" + lsa_subject); lsa_mesg = httpservletrequest.getParameter("txt_mesg"); wri("lsa_mesg=====>" + lsa_mesg); lsa_from = httpservletrequest.getParameter("tf_from"); wri("lsa_from=====>" + lsa_from); lsa_smtp = httpservletrequest.getParameter("tf_smtphost"); wri("lsa_smtp====>" + lsa_smtp); } String[] as = (String[])httpsession.getAttribute("sl.salesOrder.isa_companyAddress"); for (int i = 0; i < as.length; i++) { wri("the values are ******" + as[i]); } String s6 = "21:30"; wri("After Time"); SalesOrder salesorder = (SalesOrder)httpsession.getAttribute("SL.order.printmaster"); wri("sqObj.getFob()******" + salesorder.getFob()); wri("sqObj.getShipVia()*****" + salesorder.getShipVia()); wri("sqObj.getValidTillDate()***" + salesorder.getSoDate()); Vector vector = (Vector)httpsession.getAttribute("SL.order.printitems"); wri("lv_sqDetails.size()=====>" + vector.size()); String[][] as1 = new String[vector.size()][7]; String[] as2 = new String[1]; BigDecimal bigdecimal = new BigDecimal(0.0D); BigDecimal bigdecimal1 = new BigDecimal(0.0D); for (int j = 0; j < vector.size(); j++) { SalesOrderDetails salesorderdetails = new SalesOrderDetails(); salesorderdetails = (SalesOrderDetails)vector.elementAt(j); as1[j][0] = String.valueOf(j + 1); as1[j][1] = salesorderdetails.getItemNo(); as1[j][2] = salesorderdetails.getDescription(); as1[j][3] = salesorderdetails.getQty(); as1[j][4] = salesorderdetails.getPromiseDate(); as1[j][5] = salesorderdetails.getDiscPrice(); BigDecimal bigdecimal2 = new BigDecimal(as1[j][3]).multiply(new BigDecimal(as1[j][5])); String s7 = bigdecimal2 + ""; System.out.println("Value of Amount newamt ======> " + s7); as1[j][6] = s7; System.out.println("Value of Final finalAmt ======> " + s7); bigdecimal = bigdecimal.add(new BigDecimal(as1[j][6] == null ? "0" : as1[j][6])); } wri("After line item details"); byte byte0 = 25; if (!lb_flag) { String s8 = salesorder.getTotal(); wri("The subTotal inside if(!lb_flag)=" + s8); s2 = bigdecimal.toString(); s3 = salesorder.getTerms(); if (s3.equals("")) { String[] as4 = { "", "0.00", "" }; s8 = as4[0]; s2 = as4[1]; s3 = as4[2]; } String[] as5 = new String[3]; as5[0] = s8; as5[1] = s2; as5[2] = s3; httpsession.setAttribute("sl.quote.miscdata", as5); } else { String[] as3 = (String[])httpsession.getAttribute("sl.so.miscdata"); String s10 = as3[0]; s2 = as3[1]; s3 = as3[2]; } wri("After subTotal"); String s9 = (String)httpsession.getAttribute("sl.so.printmode") == null ? "" : (String)httpsession.getAttribute("sl.so.printmode"); if (s9.equals("")) { s = httpservletrequest.getParameter("tf_mode") == null ? "" : httpservletrequest.getParameter("tf_mode"); httpsession.setAttribute("sl.so.printmode", s); } else { s = s9; } wri("2...After misdData"); String[] as6 = new String[32]; String s11 = salesorder.getFob(); if (s11.equals(null)) { s11 = ""; } else if (s11.equalsIgnoreCase("O")) { s11 = "Origin"; } else if (s11.equalsIgnoreCase("D")) s11 = "Destination"; wri("After fob"); String s12 = salesorder.getHrEmpId(); String s13 = salesorder.getCustomerName(); String[] as7 = { "lsa_argAM" }; String[] as8 = { "" }; s12 = salesorder.getSalesContact(); wri("ls_AM********>" + s12); String[][] as9 = { { "Valid Till Date ", salesorder.getSoDate() }, { "Terms", s3 }, { "Sales Contact", s12 } }; String[][] as10 = { { "Ship Via", salesorder.getShipVia() }, { "FOB", s11 } }; wri("After namR, namT declaration"); String s14 = salesorder.getContactName().toUpperCase(); if (s14.trim().startsWith("UNAVAILABLE")) s14 = ""; String[][] as11 = { { "SO #", salesorder.getSoNo() }, { "SO Date", salesorder.getSoDate() }, { "Contact Name ", s14 } }; wri("After namL declaration"); String s15 = ""; s15 = salesorder.getBillCity() + ", " + salesorder.getBillState() + " " + salesorder.getBillZip(); String[] as12 = { "", s13, salesorder.getBillAddress(), s15, salesorder.getBillCountry() }; String[] as13 = formatAddress(as12, 2); String s16 = ""; s16 = salesorder.getShipCity() + ", " + salesorder.getShipState() + " " + salesorder.getShipZip(); String[] as14 = { "", s13, salesorder.getShipAddress(), s16, salesorder.getShipCountry() }; String[] as15 = formatAddress(as14, 2); String[] as16 = { "No.", "Item #", "Description", "Order Qty", "Promise Date", "Price", "Amount" }; float[] af = { 5.0F, 18.0F, 38.0F, 10.0F, 11.0F, 14.0F, 18.0F }; String[] as17 = { "30", "30", "30", "30" }; String s17 = salesorder.getNotes(); RemoveEnter removeenter = new RemoveEnter(s17); String[] as18 = removeenter.getArray(); int k = as18.length; String[] as19 = new String[k + 1]; as19[0] = " "; for (int l = 1; l <= k; l++) { as19[l] = as18[(l - 1)]; } int[] ai = { 0, 5, 6 }; int[] ai1 = { 3, 4 }; try { ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(); ImageHeader imageheader = new ImageHeader(bytearrayoutputstream); imageheader.setDocumentSize(as17); imageheader.setAddressInfo(as); imageheader.setHeader(new String("SALES ORDER")); imageheader.setDate("Date:", (String)httpsession.getAttribute("is_curDate") == null ? "" : (String)httpsession.getAttribute("is_curDate")); imageheader.setTime("Time:", s6 == null ? "" : s6); imageheader.setOrientation("portrait"); imageheader.setImageByte(getCompLogo(httpsession)); imageheader.setFooterFlag(true); imageheader.createImageHeader(); NewLine newline = new NewLine(imageheader.returnDoc(), 19); addr = new Address(newline.returnDoc()); AddText addtext = new AddText(addr.returnDoc()); addtext = new AddText(addtext.returnDoc(), "", "ALIGN_LEFT"); int[] ai2 = { 60, 30 }; addr.setAddress("Bill To Address \n", as13, "Ship To Address \n", as15, ai2); newline = new NewLine(addr.returnDoc()); addtext = new AddText(newline.returnDoc(), "", "ALIGN_LEFT"); newline = new NewLine(addtext.returnDoc()); mdata = new MiscData(newline.returnDoc()); int[] ai3 = { 13, 22, 16, 27, 8, 14 }; mdata.setWidthPercent(ai3); mdata.setMiscData(as11, as9, as10); newline = new NewLine(mdata.returnDoc(), 6); wri("Before Table Feed!"); tab = new AddTable(newline.returnDoc(), as16, as1, af); tab.feedData(ai, ai1, imageheader.returnWriter(), imageheader.returnTable(), mdata.returnTable()); wri("sqObj.getTotalDiscount()" + salesorder.getTotalDiscounts()); wri("sqObj.getTaxAmount()\t" + salesorder.getTotalDiscounts()); wri("sqObj.getShippingCharges()" + salesorder.getShippingCharges()); wri("sqObj.getInsurance()\t" + salesorder.getInsurance()); String s18 = salesorder.getTotalDiscounts(); String s19 = salesorder.getTaxAmount(); wri(" ls_taxAmount" + s19); String s20 = salesorder.getShippingCharges(); String s21 = salesorder.getInsurance(); BigDecimal bigdecimal3 = new BigDecimal(0.0D); bigdecimal3 = bigdecimal3.add(new BigDecimal(s19 == null ? "0" : s19)); bigdecimal3 = bigdecimal3.add(new BigDecimal(s20 == null ? "0" : s20)); bigdecimal3 = bigdecimal3.add(new BigDecimal(s21 == null ? "0" : s21)); wri("ls_subTotal*******>" + s2); bigdecimal3 = bigdecimal3.add(new BigDecimal(s2 == null ? "0" : s2)); bigdecimal3 = bigdecimal3.subtract(new BigDecimal(s18 == null ? "0" : s18)); String s22 = bigdecimal3.toString(); String[][] as20 = { { "Sub-Total ", Float.parseFloat(s2) == 0.0F ? " " : currencyFormat(s2) }, { "Total Discount ", Float.parseFloat(s18) == 0.0F ? " " : currencyFormat(s18) }, { "Tax Amount ", Float.parseFloat(s19) == 0.0F ? " " : currencyFormat(s19) }, { "S & H ", Float.parseFloat(s20) == 0.0F ? " " : currencyFormat(s20) }, { "Insurance ", Float.parseFloat(s21) == 0.0F ? " " : currencyFormat(s21) }, { "Total ", Float.parseFloat(s22) == 0.0F ? " " : currencyFormat(s22) } }; String[][] as21 = { { "Sub-Total ", Float.parseFloat(s2) == 0.0F ? " " : currencyFormat(s2) }, { "Tax Amount ", Float.parseFloat(s19) == 0.0F ? " " : currencyFormat(s19) }, { "S & H ", Float.parseFloat(s20) == 0.0F ? " " : currencyFormat(s20) }, { "Insurance ", Float.parseFloat(s21) == 0.0F ? " " : currencyFormat(s21) }, { "Total ", Float.parseFloat(s22) == 0.0F ? " " : currencyFormat(s22) } }; wri("After Table Feed!"); mdata1 = new MiscData(tab.returnDoc()); int[] ai4 = { 10, 15 }; if (new BigDecimal(s18).signum() == 0) mdata1.setMiscData(as21, ai4, imageheader.returnWriter(), imageheader.returnTable(), mdata.returnTable()); else mdata1.setMiscData(as20, ai4, imageheader.returnWriter(), imageheader.returnTable(), mdata.returnTable()); notes = new Notes(mdata1.returnDoc()); notes.setNotes(as19, imageheader.returnWriter(), imageheader.returnTable(), mdata.returnTable()); notes.close(); if (s4.equalsIgnoreCase("EMAIL")) { wri("inside if EMAIL"); Vector vector1 = (Vector)httpsession.getAttribute("compEmailServer") == null ? new Vector() : (Vector)httpsession.getAttribute("compEmailServer"); String s23 = ""; String s24 = ""; wri("After session"); String s25 = (String)httpsession.getAttribute("is_companyEmailId") == null ? "" : (String)httpsession.getAttribute("is_companyEmailId"); wri("lv_emailServer.size()*****" + vector1.size()); if(vector1.size() > 0) { s23 = (String)vector1.get(0); s24 = (String)vector1.get(1); wri("ls_compEmailServer========>" + s23); wri("ls_fromEmailId====>" + s24); } if ((s24 == null) || (s24.trim().length() <= 0)) s24 = s25; String s26 = ""; try { String[] as22 = { "test inside", "D" }; String[] as23 = { "abc.@def.com" }; String s27; if ((!as23[0].equalsIgnoreCase("NoRecord")) && (!getAttribute(as23, 0).equals("null"))) s27 = getAttribute(as23, 0); } catch (RuntimeException runtimeexception) { String s27; wri("Exception in inside email" + runtimeexception); return; } wri("inside email"); PrintWriter printwriter1 = httpservletresponse.getWriter(); buf = bytearrayoutputstream.toByteArray(); httpservletresponse.setContentType("text/html"); printwriter1.println("<HTML>"); printwriter1.println("<HEAD>"); printwriter1.println("<META HTTP-EQUIV= Content-Type CONTENT= text/html;CHARSET=iso-8859-1 >"); printwriter1.println("<LINK REL='stylesheet' TYPE='text/css' HREF='com/neterp/granada/common/mail.css'> "); printwriter1.println("<SCRIPT LANGUAGE = 'javascript' SRC ='com/neterp/granada/common/utils.js'></SCRIPT>"); printwriter1.println("<SCRIPT>"); printwriter1.println("var Status = 0"); printwriter1.println("var users = new Image();"); printwriter1.println("var rooms = new Image();"); printwriter1.println("var buddies = new Image();"); printwriter1.println("var images = new Image();"); printwriter1.println("var forums = new Image();"); printwriter1.println("var areas = new Image();"); printwriter1.println("var help = new Image();"); printwriter1.println("var exit = new Image();"); printwriter1.println("var usersx = new Image();"); printwriter1.println("var roomsx = new Image();"); printwriter1.println("var buddiesx = new Image();"); printwriter1.println("var imagesx = new Image();"); printwriter1.println("var forumsx = new Image();"); printwriter1.println("var areasx = new Image();"); printwriter1.println("var helpx = new Image();"); printwriter1.println("var exitx = new Image();"); printwriter1.println("function onSend(){\t\tdocument.QUOTEPDF.hf_mailSend.value = 'Y'; \tdocument.QUOTEPDF.submit(); }"); printwriter1.println("function makeclose(){\tparent.close();}"); printwriter1.println("function openHelp(){\twind_name=window.open('/forums/forums/neterp/granada/help/help.htm'," +"'help','top=75,left=50,toolbar=no,resizable=yes,menubar=no,width=690,height=400,scrollbars=yes');}"); printwriter1.println("</SCRIPT>"); printwriter1.println("<TITLE>Granada - Mail Composer</TITLE></HEAD><body bgcolor='#FFFFFF' text='#000000' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>" +"<table width='100%' border='0' cellspacing='0' cellpadding='0'>\t<tr>\t\t<td height='26' class='table_bg' width='43%' valign='middle'>" +" Mail Composer</td>\t\t<td height='26' class='table_bg' align='right' width='57%' valign='middle'>\t\t\t\t" +"<a href='#' onClick = 'return onSend();' onMouseOver = window.document.images['Image13'].src='img/en/send_down.gif'; " +"onMouseOut = window.document.images['Image13'].src='img/en/send_up.gif'; >" +"<img name='Image13' border='0' src='img/en/send_up.gif' align='absmiddle' alt='Send'>" +"</a>\t\t\t\t<a href='#' onMouseOver = window.document.images['Image4'].src='img/en/reset_down.gif';" +" onMouseOut = window.document.images['Image4'].src='img/en/reset_up.gif'; >" +"<img name='Image4' src='img/en/reset_up.gif' border='0' width='50' height='16' align='absmiddle' alt='Reset'></a>" +"\t\t\t\t<a href='#' onClick='openHelp()' onMouseOver = window.document.images['Image5'].src='img/en/help_down.gif';" +" onMouseOut = window.document.images['Image5'].src='img/en/help_up.gif'; >" +"<img name='Image5' src='img/en/help_up.gif' border='0' align='absmiddle' alt='Help'></a>" +"\t\t\t\t<a href='#' onClick='makeclose()' onMouseOver = window.document.images['Image6'].src='img/en/close_down.gif';" +"onMouseOut = window.document.images['Image6'].src='img/en/close_up.gif'; >" +"<img name='Image6' src='img/en/close_up.gif' border='0' align='absmiddle' alt='Close'></a> \t\t</td>\t</tr>\t<tr>" +"\t\t<td colspan='2' valign='middle'><img src='img/en/trans.gif' width='1' height='1'></td>\t</tr>\t<tr>\t\t" +"<td class='border' colspan='2' valign='middle'><img src='img/en/trans.gif' width='1' height='1'></td>\t</tr>\t<tr valign='top'>" +"\t\t<td colspan='2'><img src='img/en/trans.gif' width='1' height='15'></td>\t</tr>\t<tr valign='top'>\t\t" +"<td colspan='2'> \t\t\t<FORM ACTION=/india/servlet/com.neterp.granada.sl.SL_QUOTEPDF METHOD=GET " +" ENCTYPE=application/x-www-form-urlencoded NAME=QUOTEPDF>\t\t\t\t<INPUT TYPE='HIDDEN' NAME='hf_mailSend' VALUE='N'>" +"\t\t\t\t<table border='0' cellspacing='0' cellpadding='0' class='txt' align='center' width='780'>\t\t\t\t\t" +"<tr valign='top'>\t\t\t\t\t\t<td class='txt'>\t\t\t\t\t\t\t<table width='100%' border='0' cellspacing='0' cellpadding='0'>" +"\t\t\t\t\t\t\t\t<tr valign='top'>\t\t\t\t\t\t\t\t\t<td class='txt' colspan='5'>\t\t\t\t\t\t\t\t\t\t" +"<table width='100%' border='0' cellspacing='0' cellpadding='0'>\t\t\t\t\t\t\t\t\t\t\t<tr>\t\t\t\t\t\t\t\t\t\t\t\t" +"<td class='txt' width='7%' align='right'>SMTP : </td>\t\t\t\t\t\t\t\t\t\t\t\t<td class='txt' width='93%'>" +"\t\t\t\t\t\t\t\t\t\t\t\t\t<INPUT TYPE='TEXT' NAME='tf_smtphost' Value='" + s23 + "' SIZE='15' class='txtbox'>" + "\t\t\t\t\t\t\t\t\t\t\t\t\t From :" + "\t\t\t\t\t\t\t\t\t\t\t\t\t<INPUT TYPE='TEXT' NAME='tf_from' Value='" + s24 + "' SIZE='15' class='txtbox'>" + "\t\t\t\t\t\t\t\t\t\t\t\t</td>" + "\t\t\t\t\t\t\t\t\t\t\t</tr>" + "\t\t\t\t\t\t\t\t\t\t\t<tr>" + "\t\t\t\t\t\t\t\t\t\t\t\t<td class='txt' colspan='2'>" +"<img src='img/en/trans.gif' width='1' height='7'></td>" + "\t\t\t\t\t\t\t\t\t\t\t</tr>" + "\t\t\t\t\t\t\t\t\t\t\t<tr>" + "\t\t\t\t\t\t\t\t\t\t\t\t<td class='txt' width='7%' align='right'>To : </td>" + "\t\t\t\t\t\t\t\t\t\t\t\t<td class='txt' width='93%'>" + "\t\t\t\t\t\t\t\t\t\t\t\t\t<INPUT TYPE='TEXT' NAME='tf_to' SIZE='68' class='txtbox_big' >" + "\t\t\t\t\t\t\t\t\t\t\t\t</td>" + "\t\t\t\t\t\t\t\t\t\t\t</tr>" + "\t\t\t\t\t\t\t\t\t\t\t<tr>" + "\t\t\t\t\t\t\t\t\t\t\t\t<td class='txt' colspan='2'>" +"<img src='img/en/trans.gif' width='1' height='7'></td>" + "\t\t\t\t\t\t\t\t\t\t\t</tr>" + "\t\t\t\t\t\t\t\t\t\t\t<tr>" + "\t\t\t\t\t\t\t\t\t\t\t\t<td class='txt' width='7%' align='right'>CC : </td>" + "\t\t\t\t\t\t\t\t\t\t\t\t<td class='txt' width='93%'>" + "\t\t\t\t\t\t\t\t\t\t\t\t\t<INPUT TYPE='TEXT' NAME='tf_cc' SIZE='68' class='txtbox_big'>" + "\t\t\t\t\t\t\t\t\t\t\t\t</td>" + "\t\t\t\t\t\t\t\t\t\t\t</tr>" + "\t\t\t\t\t\t\t\t\t\t\t<tr>" + "\t\t\t\t\t\t\t\t\t\t\t\t<td class='txt' colspan='2'><img src='img/en/trans.gif' width='1' height='7'></td>" + "\t\t\t\t\t\t\t\t\t\t\t</tr>" + "\t\t\t\t\t\t\t\t\t\t\t<tr>" + "\t\t\t\t\t\t\t\t\t\t\t\t<td class='txt' width='7%' align='right'>BCC : </td>" + "\t\t\t\t\t\t\t\t\t\t\t\t<td class='txt' width='93%'>" + "\t\t\t\t\t\t\t\t\t\t\t\t\t<INPUT TYPE='TEXT' NAME='tf_bcc' SIZE='68' class='txtbox_big'>" + "\t\t\t\t\t\t\t\t\t\t\t\t</td>" + "\t\t\t\t\t\t\t\t\t\t\t</tr>" + "\t\t\t\t\t\t\t\t\t\t\t<tr>" + "\t\t\t\t\t\t\t\t\t\t\t\t<td class='txt' colspan='2'>" +"<img src='img/en/trans.gif' width='1' height='7'></td>" + "\t\t\t\t\t\t\t\t\t\t\t</tr>" + "\t\t\t\t\t\t\t\t\t\t\t<tr>" + "\t\t\t\t\t\t\t\t\t\t\t\t<td class='txt' align='right' width='7%'>Subject : </td>" + "\t\t\t\t\t\t\t\t\t\t\t\t<td class='txt' width='93%'>" + "\t\t\t\t\t\t\t\t\t\t\t\t\t<INPUT TYPE='TEXT' NAME='tf_subject' SIZE='68' class='txtbox_big'>" + "\t\t\t\t\t\t\t\t\t\t\t\t</td>" + "\t\t\t\t\t\t\t\t\t\t\t</tr>" + "\t\t\t\t\t\t\t\t\t\t\t<tr>" + "\t\t\t\t\t\t\t\t\t\t\t\t<td class='txt' colspan='2'><img src='img/en/trans.gif' width='1' height='7'></td>" + "\t\t\t\t\t\t\t\t\t\t\t</tr>" + "\t\t\t\t\t\t\t\t\t\t\t<tr align='center'>" + "\t\t\t\t\t\t\t\t\t\t\t\t<td class='txt' colspan='2'>" + "\t\t\t\t\t\t\t\t\t\t\t\t\t<TEXTAREA NAME='txt_mesg' ROWS='19' COLS='92' style='overflow:auto' class='txtareabox_big2'></TEXTAREA>" + "\t\t\t\t\t\t\t\t\t\t\t\t</td>" + "\t\t\t\t\t\t\t\t\t\t\t</tr>" + "\t\t\t\t\t\t\t\t\t\t</table>" + "\t\t\t\t\t\t\t\t\t</td>" + "\t\t\t\t\t\t\t\t</tr>" + "\t\t\t\t\t\t\t</table>" + "\t\t\t\t\t\t</td>" + "\t\t\t\t\t</tr>" + "\t\t\t\t</table>" + "\t\t\t</form>" + "\t\t</td>" + "\t</tr>" + "</table>" + "</body>" + "</html>"); } else { httpservletresponse.setContentType("application/pdf"); synchronized (this) { wri("inside elsePdf********"); ServletOutputStream servletoutputstream = httpservletresponse.getOutputStream(); buf = bytearrayoutputstream.toByteArray(); httpservletresponse.setContentLength(buf.length); httpservletresponse.setBufferSize(buf.length); bytearrayoutputstream.writeTo(servletoutputstream); bytearrayoutputstream.flush(); bytearrayoutputstream.close(); } } if (lb_flag) { wri("15"); mail = new Mail(lsa_smtp); wri("lsa_smtp=====>" + lsa_smtp); mail.setFrom(lsa_from); wri("lsa_from====>" + lsa_from); mail.setTo(lsa_to); wri("lsa_to====>" + lsa_to); mail.setCc(lsa_cc); wri("lsa_cc=====>" + lsa_cc); mail.setBcc(lsa_bcc); wri("lsa_bcc====>" + lsa_bcc); mail.setSubject(lsa_subject); wri("lsa_subject===>" + lsa_subject); mail.setDate(); mail.setBody(lsa_mesg); wri("lsa_mesg====>" + lsa_mesg); mail.setAttachmentName("SL Quotation"); buf = bytearrayoutputstream.toByteArray(); mail.setAttachment(buf); boolean flag = mail.sendMsg(); wri("lb_result=========>" + flag); lb_flag = false; } bytearrayoutputstream.close(); } catch (FileNotFoundException filenotfoundexception) { filenotfoundexception.printStackTrace(); PrintWriter printwriter = httpservletresponse.getWriter(); printwriter.println("<SCRIPT> alert('Exception Occured !! Try sending later'); this.close(); </SCRIPT>"); } } catch (Exception exception) { wri("error====>" + exception.toString()); return; } }
Lester Burnham
Rancher
Posts: 1337
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
iText comes with several tool classes in the com.lowagie.tools package; check out the ConcatPdf class in particular.
Don't sweat petty things, or pet sweaty things. But cuddle this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Having problem using Ajax
probleme scriptlet in javaScripts
How to to validation in java script involve two jsp page?
resultset is not working properly
How to set timer for select the time am to pm on front end in a jsp page like calender for date?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
More...