Text in multiple pages

Hi,
i have some static data in the first page.. in the 2nd half i have some text (dynamic) which may extend to 2nd page..
how to handle this..
Regards,
shekhar

hi Sekhar,
with respect to your problem please go thru this link in which I have provided the solution for a similar kind of problem.
Re: Display more lines of table than size of current page
let me know if u still face any problem.
Thanks,
kris

Similar Messages

  • I am trying to highlight text on multiple pages, but Adobe will not autoscroll via cursor.

    I am trying to highlight text on multiple pages, but when I select the text and bring the cursor to the bottom of the screen Adobe does not advance the document. How do I make it so I can highlight from page to page without having to release the mouse button?
    Also, how do I get adobe to realize that there is a header and footer on each page, but the actual text in the file is in two columes. Is there a way to make this clear and embade it in the document so other programs recognize this too?

    Regarding your first question, change the view to Single Page Continuous.

  • How to flow text across multiple pages in 9

    My form is lengthy, and one Master Page section will be text with no form fields, but the text is 10+ pages, depending on the version of terms and conditions provided.  In this link, http://forums.adobe.com/message/5112687, there is much discussion on how to accomplish in 8.2, but how would I accomplish in 9?  I would like to be able to paste the 10+ pages and have it automatically flow for that Master Page section. Have tried placing a text field and also tried a text into a flowable subform, setting it to multiple lines, keep with next, but just not sure how to set it up properly.  I can see the plus sign at the bottom of the text box, but when I preview, it does not flow to the other pages.  Was hoping to avoid setting up 10+ pages in the form, as from time to time these terms/conditions are updated, and it would be much faster to just be able to copy/paste from Word into a properly set up text field or subform.  Hope this makes sense, and appreciate any advice, thank you.

    Get your text from Word (or wherever you'd like to edit the text so that it looks right).
    Open a LiveCycle document (a new one if you're starting from scratch, anyway)
    Select your page1 subform, set content to Flowed (Allow page breaks should set automatically).
    Add a text field (make sure it's listed as a part of that page1 subform).
    Change the text field's caption position to none and make sure Allow multiple lines is checked (as well as allow page breaks). Set height to auto expand
    click on the default value for the text field. Paste that 9-page document inside.
    Wait a few seconds (or minutes) for LiveCycle to catch up.
    Preview and enjoy your new document with several pages automatically paginated for you.

  • How can I copy text spanning multiple pages in iBook?

    I like to drop sections of text from i
    books into letters, journal entries etc and for the life of me I cannot figure out the functionality of grabbing text that spans multiple pages.

    Hi James,
    Thank you so much for taking the time to help me out.  You actually solved the problem.  I am able to select as much text as I want now.  The bummer is the lame feature where you cannot take more than a couple hundred words at a time.  The section I wanted was about one and a half pages and it took me 3 separate copy pastes to get it all.  Does anyone know of software or a trick to overcome this limitation?
    James thanks again.  I really appreciate your help.

  • Columns text over multiple pages

    Greetings.
    I''ve created a two-page word processing document with 2 columns. I would like to be able to type in column 1 until it reaches the end of the page and then have it continue on to column 1 on page 2. Ditto for column 2. I would also like to be able to insert returns in column 1 without effecting the text in column 2. In other words, I'd like the columns to operate independent of one another. I am not using text boxes or tables. I've searched the forum and found this handy thread http://discussions.apple.com/thread.jspa?messageID=11793863&#11793863 with a great illustration, but that person seemed to be using text boxes. I could do that, but it seems clumsy.
    Surely this can be done. I'm using Pages '09 (version 4.0.3). This computer is at OS 10.5.8.
    Jim

    To do what you describe you must use text boxes as explained in your linked post. Sorry, that's the way it is.
    Walt

  • How do I select text from multiple pdf pages using Microsoft Document Imaging

    Hello.  I have scanned 3 pages and saved to pdf, now in Microsoft Document Imaging I can only select text from the first page and cannot select text from the other 2 pages.  Is there a way to select multiple pages?
    Thank you.
    Cat

    Why don't you ask in a MS forum? This forum is for an Adobe product and I have no idea why you are asking about Microsoft Document Imaging here.

  • Data Merge, multiple records, one text box, one page

    I need to my data to merge in one text box on multiple lines.
    Example:
    My TXT file:
    Name
    Mary
    Bob
    Paul
    I want my InDesign file to look like this: (one text box, one page)
    Mary
    Bob
    Paul
    I don't want multiple pages or multiple text boxes. I hope this makes sense.
    TIA

    Sorry, that's not how it works in Data Merge.
    Your list will require multiple records per page, or a restucturing of the data (a better choice, in this case) so you have Name1, Name2, Name3 or something similar.
    Have you considered just placing the text file?
    How many records are you really using?

  • Scanning multiple pages as one pdf file

    Hi Im using a Macbook Pro 10.9.5 and am trying to scan multiple pages and save as one pdf file.  One suggestion is to use image capture.  However, when I try to do this it says no camera or scanner is detected but it does not give me an option to copy multiple pages.  Any suggestions.  I have tried lowering the resolution but still have no luck.  

    Hi SusieG1026,
     Are you sure to select  file type Correct as text in image capture window? 

  • How to link text frames in Pages 5.2?

    How to link text frames in Pages 5.2?

    The correct term in Pages is Text Boxes, and true linking is not implemented in v5.2. You can Unite, Intersect, Subtract, and Exclude multiple Text Boxes via the Arrange panel. These attributes only appear when two or more Text Boxes are selected. Also, on the Arrange menu, you will need Object Placement set to Move with Text, and the Text Wrap set to None for more accurate positioning.
    In the following example, there was initially a Text Box with overflowing text that was duplicated. With both Text Boxes selected and aligned, I could then use the Unite feature from the Arrange panel. This allowed the text to flow into the second box. Selecting text in one box and dragging upwards continues the text selection between both boxes. Hoefler italic applied in one box is applied to both. Appropriately placed, another trip to the Arrange panel to enable Text Wrap around and text fit adjustments.

  • Checkbox in Tabular Form (Solution to span multiple pages)

    Hi,
    We had a case where a large report needed to have check boxes. These check boxes would populate a list of id's which we then processed for a specific task. By default APEX doesn't support this.
    After spending some time on this, I thought I'd post my solution to help any others who experience the same problems. For this example we will use P10
    1. Create a new "normal" report.
    SELECT e.*, APEX_ITEM.CHECKBOX(1,e.EMPNO,'onClick="updateList(this);"',:P10_LIST, ',') AS Cancel,
    FROM emp e
    2. Create a hidden item called P10_LIST
    3. Add an HTML region to the page whose template is "No Template" (do this so it doesn't show up. Call the region "JavaScript". Set its sequence to 1
    4. Add the following in the JavaScript region:
    <script src="http://SERVER_NAME/String.js" type="text/javascript"></script>
    <script src="http://SERVER_NAME/Ajax.js" type="text/javascript"></script>
    <script type="text/javascript">
    function updateList(pObject){
    vItem = 'P10_LIST';
    myAjax = new Ajax();
    vList = myAjax.getItemValue(vItem);
    //Determine to remove or add from list
    if (pObject.checked) {
    //Add item
    vList = vList.listAppend(pObject.value);
    else{
    //Remove from list
    vList = vList.listRemoveItem(pObject.value);
    }//if
    //Set the session value
    myAjax.setItemValue(vItem,vList);
    //Set the HTML value
    document.getElementById(vItem).value = vList;
    </script>
    This script:
    - Loads the List from the session
    - Modifies the list
    - Stores it in the session
    5. The JavaScript region references 2 files, which you'll need to add to your server. They are as follows:
    Ajax.js
    function Ajax(){
    // TODO: Enter proper names etc.
    this.appProcessNameNull = 'AJAX_null';
    this.appProcessNameReturnItem = 'AJAX_ReturnItem';
    this.tempItem = 'P0_AJAX_TEMP';
    * TODO: Document
    * Sets Item in session
    Ajax.prototype.setItemValue = function(pItem,pValue,pAppProcess){
    if (pAppProcess == null)
    pAppProcess = this.appProcessNameNull;
    var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=' + pAppProcess,0);
    get.add(pItem,pValue);
    gReturn = get.get();
    * TODO: Document
    * @param pItem Name of item to get
    * @param pTempItem Name of temp item
    * @param pAppProcess Application Process to call which will return item
    * @return session value
    Ajax.prototype.getItemValue = function(pItem,pTempItem,pAppProcess){
    if (pTempItem == null)
    pTempItem = this.tempItem;
    if (pAppProcess == null)
    pAppProcess = this.appProcessNameReturnItem;
    var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=' + pAppProcess,0);
    get.add(pTempItem,pItem);
    gReturn = get.get();
    return gReturn;
    String.js
    // From http://www.somacon.com/p355.php
    String.prototype.trim = function() {
         return this.replace(/^\s+|\s+$/g,"");
    // From http://www.somacon.com/p355.php
    String.prototype.ltrim = function() {
         return this.replace(/^\s+/,"");
    // From http://www.somacon.com/p355.php
    String.prototype.rtrim = function() {
         return this.replace(/\s+$/,"");
    * Appends value to list
    * @param pValue Value to add to list
    * @param pDelimeter Defaults to comman
    String.prototype.listAppend = function(pValue, pDelimeter){
    if (pDelimeter == null)
    pDelimeter = ',';
    vStr = this;
    if (vStr.length == 0)
    vStr = pValue;
    else
    vStr = vStr + pDelimeter + pValue;
    return vStr;
    * Removes a value from list
    * @param pValue Value to remove from list
    * @param pDelimeter Defaults to comman
    String.prototype.listRemoveItem = function(pValue, pDelimeter){
    if (pDelimeter == null)
    pDelimeter = ',';
    vStr = this;
    vStr = pDelimeter + vStr + pDelimeter;
    // Remove value
    vStr = vStr.replace(pDelimeter + pValue + pDelimeter, pDelimeter);
    //Remove prefix and suffix items
    if (vStr.length > 0 & vStr.charAt(0) == pDelimeter){
    vStr = vStr.substring(1);
    if (vStr.length > 0 & vStr.charAt(vStr.length-1) == pDelimeter){
    vStr = vStr.substring(0,vStr.length - 1);
    return vStr;
    6. On Page 0 Create a hidden Item called: P0_AJAX_TEMP
    (Note: this is can be used for all your AJAX calls)
    7. Create an Application Process called: "AJAX_null". Process Text: null;
    8. Create an Application Process called: "AJAX_ReturnItem". Process Text:
    begin
    htp.prn(v(v('P0_AJAX_TEMP')));
    end;
    If you look at the Ajax.js you'll notice points 6,7, and 8 are all customizable etc... I just put it in so you can test right away.
    Now the user can select items on multiple pages (if pagination applies). Once they hit a submit button you can use P10_LIST to process your values.
    Hope this helps.
    Martin

    Hi Martin,
    I was trying to use your funda in my App. But i dont know why it is not doing anything.
    Also i'm facing a very small but severe problem with one of my report. I am using checkbox. So that user will be able to select all those records he/she wants. but the problem is that when i'm selecting few records with the help of the check boxes, selections are there. When moving to other page and coming back to that page, selections are gone. I think selections should not go like this. Otherwise the user will get confused.
    Can you tell me how can retain the check box selections??
    Thanks
    Sudipta

  • In InDesign CS6/Cloud, is it possible to link selected text on one page to a separate page, or even to an object on a separate page?

    I have an InDesign layout with multiple pages. The layout involves text and images, and there are text references for those images, that end up a page or two behind the image itself. What I'd like to know is if I can select certain text (for example, I want to select the number 3 in the text "Image 1 on page 3") and link it to a specific page, or to the actual placed image for "Image 1", so that if I have to re-paginate the layout later, the number 3 in the text will automatically change to a 2 or a 4, much like the functionality of page numbers. Let me know if my question isn't clear enough. Thanks!

    This will work if you all use the file syncing of the Creative Cloud desktop application and then you use the Collaborate option for the folder containing all the files. Then it will work on each of your desktops.
    Links to files will not work in the browser when viewing the InDesign document from https://creative.adobe.com/files.

  • How to print multiple pages using Internet Explorer with af:showPrintablePageBehavior

    Hello,
    I am facing one issue with using af:showPrintablePageBehavior. I found similar posts and google pages, but unable to fix the issue. Most relevant post is,
    Print issues with af:showPrintablePageBehavior and Internet Explorer
    I have a page show in a af:popup. This page contain a Title in the top, af:outputText and a Print button below it. I have added af:showPrintablePageBehavior to Print button. I am using lots of data in the af:outputText. When I click on Print button, showPrintablePageBehavior is opening new browser window with multiple pages. But when I click on the Print Preview or Print, only first page is shown.
    I have tried the solution mentioned in above post but no luck.
        <f:verbatim>
            <style type="text/css">
                textarea {
                    width: 95%;
                    height: 350px;
                    overflow: auto;
                @agent ie {
                    af|document:maximized::printable {
                        position: static;
            </style>
      </f:verbatim>
      <af:panelStretchLayout bottomHeight="10%" startWidth="0%" endWidth="0%" topHeight="10%" inlineStyle="height: 100%; width: 100%">
      <f:facet name="top">
      <af:panelGroupLayout id="pnlGrpTitle"  layout="vertical" halign="center" inlineStyle="width: 100%;">
      <af:spacer id="titleSpacer" height="10px" />
      <af:label value="Title" inlineStyle="font-weight:bold; font-size: 16px; color:#000066; padding-left: 5px" id="dialogTitle" />
      <af:spacer id="titleSpacer2" height="20px" />
      </af:panelGroupLayout>
      </f:facet>
      <f:facet name="center">
      <af:panelStretchLayout bottomHeight="0" topHeight="0" startWidth="0" endWidth="0">
      <f:facet name="center">
      <af:panelStretchLayout bottomHeight="0" topHeight="25" startWidth="0" endWidth="0">
      <f:facet name="center">
      <af:panelGroupLayout id="pnlTextArea" layout="scroll">
      <af:outputText binding="#{mybean.tfdArea}" escape="false" id="tfdArea" />
      </af:panelGroupLayout>
      </f:facet>
      </af:panelStretchLayout>
      </f:facet>
      </af:panelStretchLayout>
      </f:facet>
      <f:facet name="bottom">
      <af:panelGroupLayout id="pnlGrpBottom" layout="vertical" halign="center" inlineStyle="width: 100%">
      <af:commandToolbarButton id="cbPrint" shortDesc="Print" icon="/images/print.png" inlineStyle="width: 40%" >
      <!--af:clientListener method="self.print" type="action"/-->
      <af:showPrintablePageBehavior />
      </af:commandToolbarButton>
      </af:panelGroupLayout>
      </f:facet>
      </af:panelStretchLayout>
    Any idea how to fix it?
    - Sujay

    Hello,
    I am facing one issue with using af:showPrintablePageBehavior. I found similar posts and google pages, but unable to fix the issue. Most relevant post is,
    Print issues with af:showPrintablePageBehavior and Internet Explorer
    I have a page show in a af:popup. This page contain a Title in the top, af:outputText and a Print button below it. I have added af:showPrintablePageBehavior to Print button. I am using lots of data in the af:outputText. When I click on Print button, showPrintablePageBehavior is opening new browser window with multiple pages. But when I click on the Print Preview or Print, only first page is shown.
    I have tried the solution mentioned in above post but no luck.
        <f:verbatim>
            <style type="text/css">
                textarea {
                    width: 95%;
                    height: 350px;
                    overflow: auto;
                @agent ie {
                    af|document:maximized::printable {
                        position: static;
            </style>
      </f:verbatim>
      <af:panelStretchLayout bottomHeight="10%" startWidth="0%" endWidth="0%" topHeight="10%" inlineStyle="height: 100%; width: 100%">
      <f:facet name="top">
      <af:panelGroupLayout id="pnlGrpTitle"  layout="vertical" halign="center" inlineStyle="width: 100%;">
      <af:spacer id="titleSpacer" height="10px" />
      <af:label value="Title" inlineStyle="font-weight:bold; font-size: 16px; color:#000066; padding-left: 5px" id="dialogTitle" />
      <af:spacer id="titleSpacer2" height="20px" />
      </af:panelGroupLayout>
      </f:facet>
      <f:facet name="center">
      <af:panelStretchLayout bottomHeight="0" topHeight="0" startWidth="0" endWidth="0">
      <f:facet name="center">
      <af:panelStretchLayout bottomHeight="0" topHeight="25" startWidth="0" endWidth="0">
      <f:facet name="center">
      <af:panelGroupLayout id="pnlTextArea" layout="scroll">
      <af:outputText binding="#{mybean.tfdArea}" escape="false" id="tfdArea" />
      </af:panelGroupLayout>
      </f:facet>
      </af:panelStretchLayout>
      </f:facet>
      </af:panelStretchLayout>
      </f:facet>
      <f:facet name="bottom">
      <af:panelGroupLayout id="pnlGrpBottom" layout="vertical" halign="center" inlineStyle="width: 100%">
      <af:commandToolbarButton id="cbPrint" shortDesc="Print" icon="/images/print.png" inlineStyle="width: 40%" >
      <!--af:clientListener method="self.print" type="action"/-->
      <af:showPrintablePageBehavior />
      </af:commandToolbarButton>
      </af:panelGroupLayout>
      </f:facet>
      </af:panelStretchLayout>
    Any idea how to fix it?
    - Sujay

  • Multiple page form to email with sessions doesn't send mail

    I am creating a multiple page form where a user can apply for finance. I am trying to use session to keep the user input values and then the last page sent the application by email.
    My problem is the last step where it doen't send the email. I'm not sure if it the session I'm using is wrong because a simple form without sessions works fine.
    here are the forms
    First page is the input for with variables
    <form action="Finance_form_proposal_Address.php" method="post" >
      <span id="sprycheckbox1">
      <input  name="Disclaimer" type="checkbox" value="yes">
      <span class="checkboxRequiredMsg">Please confirm that you have read and understood the Terms and Conditions.</span></span>
      <div id="F1"><table width="100%" border="1" align="center" cellpadding="3" cellspacing="2">
      <tr>
        <td align="right" bgcolor="#F7E4F8" ><strong>Title:</strong></td>
        <td align="left" bgcolor="#F7E4F8"><select name="Title">
              <option value="Mr">Mr</option>
              <option value="Mrs">Mrs</option>
              <option value="Miss">Miss</option>
              <option value="Ms">Ms</option>
              <option value="Dr">Dr</option>
              <option value="Rev">Rev</option>
            </select></td>
    etc..
    </form>
    The second form:
    Getting values and input new form
    <?php session_start();
    $_SESSION['Disclaimer'] = $_POST['Disclaimer'];
    $_SESSION['Title'] = $_POST['Title'];
    $_SESSION['Forname'] = $_POST['Forname'];
    $_SESSION['Middle_name'] = $_POST['Middle_name'];
    $_SESSION['Surname'] = $_POST['Surname'];
    $_SESSION['email'] = $_POST['email'];
    $_SESSION['DOB'] = $_POST['DOB'];
    $_SESSION['DOB2'] = $_POST['DOB2'];
    $_SESSION['DOB3'] = $_POST['DOB3'];
    $_SESSION['Gender'] = $_POST['Gender'];
    $_SESSION['checkboxGroup1'] = $_POST['checkboxGroup1'];
    $_SESSION['checkboxGroup2'] = $_POST['checkboxGroup2'];
    $_SESSION['home_phone'] = $_POST['home_phone'];
    $_SESSION['mobil'] = $_POST['mobil'];
    $_SESSION['marital_status'] = $_POST['marital_status'];
    $_SESSION['Occupancy'] = $_POST['Occupancy'];
    $_SESSION['Dependants'] = $_POST['Dependants'];
    ?>
    Form on second page
    <form action="Finance_form_proposal_Bank_Details_employment.php" method="post"> <input  name="Disclaimer" type="checkbox" value="yes">
        <div id="F1"><table width="100%" border="1" align="center" cellpadding="3" cellspacing="2">
      <tr>
        <td align="right" bgcolor="#F7E4F8" ><strong>Correspondence Address:</strong></td>
        <td align="left" bgcolor="#F7E4F8"><input name="Correspondence" type="checkbox" id="Correspondence" value="yes" checked="CHECKED">
          <label for="Correspondence"></label></td>
      </tr>
      <tr>
        <td bgcolor="#F7E4F8"><strong>Street:</strong></td>
        <td bgcolor="#F7E4F8"><input name="Street" type="text"></td>
      </tr>
      <tr>
        <td bgcolor="#F7E4F8"><strong>District:</strong></td>
        <td bgcolor="#F7E4F8"><input name="District" type="text"></td>
      </tr>
      <tr>
        <td bgcolor="#F7E4F8"><strong>Town:</strong></td>
        <td bgcolor="#F7E4F8"><input name="Town" type="text"></td>
      </tr>
    etc ..
    </form
    Third page
    Getting values
    session_start();
    $_SESSION['Correspondence'] = $_POST['Correspondence'];
    $_SESSION['Street'] = $_POST['Street'];
    $_SESSION['District'] = $_POST['District'];
    $_SESSION['Town'] = $_POST['Town'];
    $_SESSION['County'] = $_POST['County'];
    $_SESSION['Country'] = $_POST['Country'];
    $_SESSION['Years'] = $_POST['Years'];
    $_SESSION['Months'] = $_POST['Months'];
    $_SESSION['Street2'] = $_POST['Street2'];
    $_SESSION['District2'] = $_POST['District2'];
    $_SESSION['Town2'] = $_POST['Town2'];
    $_SESSION['County2'] = $_POST['County2'];
    $_SESSION['Country2'] = $_POST['Country2'];
    $_SESSION['Years2'] = $_POST['Years2'];
    $_SESSION['Months2'] = $_POST['Months2'];
    $_SESSION['Street3'] = $_POST['Street3'];
    $_SESSION['District3'] = $_POST['District3'];
    $_SESSION['Town3'] = $_POST['Town3'];
    $_SESSION['County3'] = $_POST['County3'];
    $_SESSION['Country3'] = $_POST['Country3'];
    $_SESSION['Years3'] = $_POST['Years3'];
    $_SESSION['Months3'] = $_POST['Months3'];
    Then there is a another form to fill in , wont show that as it is in principle the same.
    This is the last page that should sent the data to email:
    <?php
    session_start();
    /* Subject mail variables */
    $emailsubject = 'Finance application from PandKshop';
    $webmaster = '[email protected]';
    /* Gathering Data */
    $goods = $_POST['goods'];
    $amount = $_POST['amount'];
    $Total_Cash = $_POST['Total_Cash'];
    $Deposit = $_POST['Deposit'];
    $Balance = $_POST['Balance'];
    $Payments = $_POST['Payments'];
    $Diclaimer = $_SESSION['Disclaimer'];
    $Title = $_SESSION['Title'];
    $Forname = $_SESSION['Forname'];
    $Middle_name = $_SESSION['Middle_name'];
    $Surname = $_SESSION['Surname'];
    $email = $_SESSION['email'];
    $DOB = $_SESSION['DOB'];
    $DOB2 = $_SESSION['DOB2'];
    $DOB3 = $_SESSION['DOB3'];
    $Gender =  $_SESSION['Gender'];
    $CheckboxGroup1 = $_SESSION['CheckboxGroup1'];
    $CheckboxGroup2 = $_SESSION['CheckboxGroup2'];
    $home_phone = $_SESSION['home_phone'];
    $mobil_phone = $_SESSION['mobil_phone'];
    $marital_status = $_SESSION['marital_status'];
    $Occupancy = $_SESSION['Occupancy'];
    $Dependants = $_SESSION['Dependants'];
    $Correspondence = $_SESSION['Correnspondence'];
    $Street = $_SESSION['Street'];
    $District = $_SESSION['District'];
    $Town = $_SESSION['Town'];
    $County = $_SESSION['County'];
    $Country = $_SESSION['Country'];
    $Years = $_SESSION['Years'];
    $Months = $_SESSION['Months'];
    $Street2 = $_SESSION['Street2'];
    $District2 = $_SESSION['District2'];
    $Town2 = $_SESSION['Town2'];
    $County2 = $_SESSION['County2'];
    $Country2 = $_SESSION['Country2'];
    $Years2 = $_SESSION['Years2'];
    $Months2 = $_SESSION['Months2'];
    $Street3 = $_SESSION['Street3'];
    $District3 = $_SESSION['District3'];
    $Town3 = $_SESSION['Town3'];
    $County3 = $_SESSION['County3'];
    $Country3 = $_SESSION['Country3'];
    $Years3 = $_SESSION['Years3'];
    $Months3 = $_SESSION['Months3'];
    $Sort_Code          = $_SESSION['Sort_Code'];
    $Account = $_SESSION['Account'];
    $Years_with_Bank = $_SESSION['Years_with_Bank'];
    $Months_with_Bank = $_SESSION['Months_with_Bank'];
    $CreditCard = $_SESSION['CreditCard'];
    $ChequeCard = $_SESSION['ChequeCard'];
    $Employment = $_SESSION['Employment'];
    $income = $_SESSION['Income'];
    $Income2 = $_SESSION['Income2'];
    $Occupation = $_SESSION['Occupation'];
              $Body = <<<EOD
    <br><hr><br>
    Goods: $goods <br>
    Amount: $amount <br>
    Total Cash: $Total_Cash <br>
    Deposit: $Deposit <br>
    Balance: $Balance
    Nine Monthly Payments of : £ $Payments
    Title: $Title <br>
    Forname: $Forname <br>
    Middle Name: $Middle_name <br>
    Surname : $Surname <br>
    Email: $email <br>
    DOB: $DOB/$DOB2/$DOB3 <br>
    Gender: $Gender <br>
    Home_phone: $CheckboxGroup1 Mobile phone: $CheckboxGroup2 <br>
    Home Phone number: $home_phone <br>
    Mobile Phone number: $mobil_phone <br>
    Marital_Status: $marital_status <br>
    Occupancy : $Occupancy <br>
    Dependants: $Dependants <br>
    Correspondence Address: $Correspondence <br>
    Street: $Street <br>
    District: $District <br>
    Town: $Town <br>
    County: $County <br>
    Country: $Country
    Years: $Years
    Months: $Months
    Street2: $Street <br>
    District2: $District2 <br>
    Town2: $Town2 <br>
    County2: $County2 <br>
    Country2: $Country2
    Years2: $Years2
    Months2: $Months2
    Street3: $Street3 <br>
    District3: $District3 <br>
    Town3: $Town3 <br>
    County3: $County3 <br>
    Country3: $Country3 <br>
    Years3: $Years3 <br>
    Months3: $Months3 <br>
    Sort Code: $Sort_Code <br>
    Account: $Account <br>
    Years with the Bank: $Years_with_Bank <br>
    Months with the Bank: $Months_with_Bank <br>
    CreditCards: $CreditCard <br>
    Cheque Card: $ChequeCard <br>
    Employment: $Employment <br>
    Income: £$income <br>
    Income Frequency: $Income2 <br>
    Occupation: $Occupation <br>
    EOD;
              $headers = "From: $email\r\n";
              $headers .= "content-type: text/html\r\n";
              $succes = mail($webmaster, $emailsubject, $Body, $headers);
    session_destroy();
    /* Results rendered as HTML */
    $theResults = <<<EOD
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
    <head>
          <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
          <title>Thank you! The Piano and Keyboard Shop Online</title>
          <link rel="STYLESHEET" type="text/css" href="contact.css">
          <link href="The Piano and Keyboard Shop.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <h2>Thanks for your application!<br />
    We endavour to get back to you as soon as possible with application results</h2>
    Please contact us on 0116 2541053 if you have any questions regarding your finance application
    Return to <a href="../index_main.php">Home Page</a>
    <div id="advertising">
        <div id="add_left"><a href="Contact.php">Contact us</a><br>
          <a href="About.php">About us</a><br>
          <a href="Finance.php">Finance</a><br>
    </div>
        <div id="adds_middle"><a href="term-conditions.php">Terms and Conditions</a><br>
          <a href="Privacy-Policy.php">Privacy Conditions</a><br>
          <a href="FAQ.php">FAQ</a><br>
    </div>
        <div id="adds_right"><a href="http://www.youtube.com/user/KeysoundWebsite">Follow us on YouTube</a><br>
          <a href="https://twitter.com/KeysoundUK">Follow us on Twitter</a><br>
          <a href="https://www.facebook.com/pages/Keysound/163590297024385">Follow us on Face book</a><br>
    </div>
      </div>
      <div id="advertising"> <div id="copy"><img src="files/Images/copyright.gif" width="19" height="22">
    </div> </div>
    </body>
    </html>
    EOD;
    echo "$theResults";
    ?>
    Is there something wrong with my sessions or just something in the code?

    Standard Apple Mail. I'm running Yosemite 10.10.1, and I'm amazed to see that About Mail says it's Mail Version 8.1 (1993), copyright 1995-2014 Apple Inc. 
    Interesting thought, do you think that it doesn't like to work with itself?  Actually, I'm fairly sure I've had the problem inside of other apps but I should document that.  I'll keep notes to see where this happens. 

  • Print JTable with Multiple pages and rows

    I took the printing example at http://java.sun.com/developer/onlineTraining/Programming/JDCBook/advprint.html#pe and modified it a bit to include the following:
    1) To Print Multiple pages
    2) To wrap lines that is too long for the column
    3) To print with a more proffesional style, so that it doesn't look like a screen capture is printed
    4) To align the numbers to the right and center column headings
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.print.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.awt.Dimension;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import java.text.*;
    public class Report implements Printable
         private final int LEFT_ALIGN = -1;
         private final int CENTER_ALIGN = 0;
         private final int RIGHT_ALIGN = 1;
         private JFrame frame;
         private JTable tableView;
         private String lastPrintDate;
         private Font defaultFont;
         private Font headerFont;
         private Font footerFont;
         private int headerHeight;
         private int footerHeight;
         private int cellBuffer = 5;
         private boolean first_pass;
         private ArrayList pages;
         public Report()
              frame = new JFrame("Sales Report");
              frame.addWindowListener(new WindowAdapter()
                   public void windowClosing(WindowEvent e)
                        System.exit(0);
              final String[] headers =
                   "ID",
                   "Description",
                   "open price",
                   "latest price",
                   "End Date",
                   "Quantity"
              int count = 0;
              final Object[][] data =
                   {new Integer(count++), "Box of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of Biros ppppppppppppppp", "1.00", "4.99", new Date(), new Integer(200000)},
                   {new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++), "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++), "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++), "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++),  "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++),  "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++),  "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++),  "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)}
              TableModel dataModel = new AbstractTableModel()
                   public int getColumnCount() { return headers.length; }
                   public int getRowCount() { return data.length;}
                   public Object getValueAt(int row, int col)
                        return data[row][col];
                   public String getColumnName(int column)
                        return headers[column];
                   public Class getColumnClass(int col)
                        return getValueAt(0,col).getClass();
                   public boolean isCellEditable(int row, int col)
                        return (col==1);
                   public void setValueAt(Object aValue, int row, int column)
                        data[row][column] = aValue;
              tableView = new JTable(dataModel);
              JScrollPane scrollpane = new JScrollPane(tableView);
              scrollpane.setPreferredSize(new Dimension(500, 80));
              frame.getContentPane().setLayout(new BorderLayout());
              frame.getContentPane().add(BorderLayout.CENTER,scrollpane);
              frame.pack();
              JButton printButton= new JButton();
              printButton.setText("print me!");
              frame.getContentPane().add(BorderLayout.SOUTH,printButton);
              // for faster printing turn double buffering off
              RepaintManager.currentManager(frame).setDoubleBufferingEnabled(false);
              printButton.addActionListener( new ActionListener()
                   public void actionPerformed(ActionEvent evt)
                        doPrint();
              frame.setVisible(true);
          * Reset variables before printing
         private void prepareForPrint()
              pages = new ArrayList();
              first_pass = true;
          * Display a print dialog with some hardcoded defaults
          * The print fonts are also hardcoded
         public void doPrint()
              try
                   String jobName = "Java Report";
                   defaultFont = new Font("Arial", Font.PLAIN, 8);
                   footerFont = new Font("Arial", Font.PLAIN, 6);
                   headerFont = new Font("Arial", Font.BOLD, 10);
                   PrinterJob prnJob = PrinterJob.getPrinterJob();
                   prnJob.setPrintable(this);
                   PrintRequestAttributeSet prnSet = new HashPrintRequestAttributeSet();
                   prnSet.add(new Copies(1));
                   prnSet.add(new JobName(jobName, null));
                   prnSet.add(MediaSizeName.ISO_A4);
                   PageFormat pf = prnJob.defaultPage();
                   pf.setOrientation(java.awt.print.PageFormat.PORTRAIT);
                   prnJob.setJobName(jobName);
                   PrintService[] services = PrinterJob.lookupPrintServices();
                   if (services.length > 0)
                        if (prnJob.printDialog(prnSet))
                              * Get print date
                             String dateFormat = "dd/MM/yyyy HH:mm:ss";
                             DateFormat m_DateFormat = new SimpleDateFormat(dateFormat);
                             lastPrintDate = m_DateFormat.format(new Date()).toString();
                             prepareForPrint();
                             prnJob.print(prnSet);
                   else
                        JOptionPane.showMessageDialog(frame, "No Printer was found!!", "Printer Error", JOptionPane.ERROR_MESSAGE);
                        return;
              catch (PrinterException e)
                   e.printStackTrace();
         public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException
               * Check if this is the first time the print method is called for this print action.
               * It is not guaranteed that the print will be called with synchronous pageIndex'es,
               * so we need to calculate the number of pages and which rows appear on which pages.
               * Then the correct page will be printed regardless of which pageIndex is sent through.
              if (first_pass)
                   calcPages(g, pageFormat);
              first_pass = false;
              // Stop printing if the pageIndex is out of range
              if (pageIndex >= pages.size())
                   return NO_SUCH_PAGE;
              Graphics2D     g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              // The footer will be one line at the bottom of the page, cater for this.
              g2.setFont(footerFont);
              footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
              g2.setFont(defaultFont);
              FontMetrics fontMetrics = g2.getFontMetrics();
              int fontHeight = fontMetrics.getHeight();
              int fontDescent = fontMetrics.getDescent();
              double pageHeight = pageFormat.getImageableHeight() + pageFormat.getImageableY();
              double pageWidth = pageFormat.getImageableWidth();
              double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
              // Shrink or expand the table to fit the page width
              double scale = pageWidth / (tableWidth+ (cellBuffer * tableView.getColumnCount()));
              // Calculate the width in pixels for each column
              double[] columnWidths = new double[tableView.getColumnCount()];
              for(int i = 0; i < tableView.getColumnCount(); i++)
                   columnWidths[i] = (double)tableView.getColumnModel().getColumn(i).getWidth() * scale;
              // Reset the view to the start of the page
              g2.translate(0, 0);
              // Draw a rectangle to see the printable area
              g2.draw3DRect((int)pageFormat.getImageableX(),
                        (int)pageFormat.getImageableY(),
                        (int)pageFormat.getImageableWidth(),
                        (int)pageFormat.getImageableHeight(),
                        false);
              // Calculate the header height
              g2.setFont(headerFont);
              fontMetrics = g2.getFontMetrics();
              // Print the headers and retreive the starting position for the data
              int next_row = printLine(g2, pageFormat, fontMetrics, -1, (int)pageFormat.getImageableY() + fontHeight, columnWidths);
              g2.setFont(defaultFont);
              fontMetrics = g2.getFontMetrics();
              // Start printing the detail
              ArrayList page = (ArrayList)pages.get(pageIndex);
              int start = ((Integer)page.get(0)).intValue();
              int end = ((Integer)page.get(1)).intValue();
              for (int i = start; i <= end; i++)
                   next_row = printLine(g2, pageFormat, fontMetrics, i, next_row, columnWidths);
              // Print the footer
              g2.setFont(footerFont);
              String pageFooter = "Page " + (pageIndex + 1) + " - " + lastPrintDate;
              g2.drawString(pageFooter,
                             (int)pageFormat.getWidth() / 2 - (fontMetrics.stringWidth(pageFooter) / 2),
                             (int)(pageHeight - fontDescent));
              return PAGE_EXISTS;
          * We can't guarantee that the same amount of rows will be displayed on each page,
          * the row heights are dynamic and may wrap onto 2 or more lines.
          * Thus we need to calculate the height of each row and then test how may rows
          * fit on a specific page. eg. Page 1 contains rows 1 to 10, Page 2 contains rows 11 to 15 etc.
         public void calcPages(Graphics g, PageFormat pageFormat) throws PrinterException
              Graphics2D     g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              // The footer will be one line at the bottom of the page, cater for this.
              g2.setFont(footerFont);
              footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
              g2.setFont(defaultFont);
              FontMetrics fontMetrics = g2.getFontMetrics();
              int fontHeight = fontMetrics.getHeight();
              int fontDescent = fontMetrics.getDescent();
              double pageHeight = pageFormat.getImageableHeight() - fontHeight;
              double pageWidth = pageFormat.getImageableWidth();
              double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
              // Shrink or expand the table to fit the page width
              double scale = pageWidth / (tableWidth+ (cellBuffer * tableView.getColumnCount()));
              // Calculate the width in pixels for each column
              double[] columnWidths = new double[tableView.getColumnCount()];
              for(int i = 0; i < tableView.getColumnCount(); i++)
                   columnWidths[i] = (double)tableView.getColumnModel().getColumn(i).getWidth() * scale;
              // Calculate the header height
              int maxHeight = 0;
              g2.setFont(headerFont);
              fontMetrics = g2.getFontMetrics();
              for (int j = 0; j < tableView.getColumnCount(); j++)
                   String value = tableView.getColumnName(j).toString();
                   int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                   if (numLines > maxHeight)
                        maxHeight = numLines;
              headerHeight = g2.getFontMetrics().getHeight() * maxHeight;
              g2.setFont(defaultFont);
              fontMetrics = g2.getFontMetrics();
              int pageNum = 0;
              int bottom_of_page = (int)(pageFormat.getImageableHeight() + pageFormat.getImageableY()) - footerHeight;
              int prev_row = 0;
              int next_row = (int)pageFormat.getImageableY() + fontHeight + headerHeight;
              int i = 0;
              ArrayList page = new ArrayList();
              page.add(new Integer(0));
              for (i = 0; i < tableView.getRowCount(); i++)
                   maxHeight = 0;
                   for (int j = 0; j < tableView.getColumnCount(); j++)
                        String value = tableView.getValueAt(i, j).toString();
                        int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                        if (numLines > maxHeight)
                             maxHeight = numLines;
                   prev_row = next_row;
                   next_row += (fontHeight * maxHeight);
                   // If we've reached the bottom of the page then set the current page's end row
                   if (next_row > bottom_of_page)
                        page.add(new Integer(i - 1));
                        pages.add(page);
                        page = new ArrayList();
                        page.add(new Integer(i));
                        pageNum++;
                        next_row = (int)pageFormat.getImageableY()
                                       + fontHeight
                                       + ((int)pageFormat.getHeight() * pageNum)
                                       + headerHeight;
                        bottom_of_page = (int)(pageFormat.getImageableHeight()
                                            + pageFormat.getImageableY())
                                            + ((int)pageFormat.getHeight() * pageNum)
                                            - footerHeight;
                        //Include the current row on the next page, because there is no space on this page
                        i--;
              page.add(new Integer(i - 1));
              pages.add(page);
          * Print the headers or a row from the table to the graphics context
          * Return the position of the row following this one
         public int printLine(Graphics2D g2,
                                       PageFormat pageFormat,
                                       FontMetrics fontMetrics,
                                       int rowNum,
                                       int next_row,
                                       double[] columnWidths)
                   throws PrinterException
              int lead = 0;
              int maxHeight = 0;
              for (int j = 0; j < tableView.getColumnCount(); j++)
                   String value = null;
                   int align = LEFT_ALIGN;
                   if (rowNum > -1)
                        Object obj = tableView.getValueAt(rowNum, j);
                        if (obj instanceof Number)
                             align = RIGHT_ALIGN;
                        value = obj.toString();
                   else
                        align = CENTER_ALIGN;
                        value = tableView.getColumnName(j);
                   int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                   if (numLines > maxHeight)
                        maxHeight = numLines;
                   if (fontMetrics.stringWidth(value) < columnWidths[j])
                        // Single line
                        int offset = 0;
                        // Work out the offset from the start of the column to display alignment correctly
                        switch (align)
                             case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)); break;
                             case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)) / 2; break;
                             default: offset = 0; break;
                        g2.drawString(value,
                                       lead + (int)(pageFormat.getImageableX() + offset),
                                       next_row);
                   else
                        for(int a = 0; a < numLines; a++)
                             //Multi-Line
                             int x = 0;
                             int width = 0;
                             for(x = 0; x < value.length(); x++)
                                  width += fontMetrics.charWidth(value.charAt(x));
                                  if (width > columnWidths[j])
                                       break;
                             int offset = 0;
                             // Work out the offset from the start of the column to display alignment correctly
                             switch (align)
                                  case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)); break;
                                  case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)) / 2; break;
                                  default: offset = 0; break;
                             g2.drawString(value.substring(0, x),
                                            lead + (int)(pageFormat.getImageableX() + offset),
                                            next_row + (fontMetrics.getHeight() * a));                    
                             value = value.substring(x);
                   lead += columnWidths[j] + cellBuffer;
              // Draw a solid line below the row
              g2.draw(new Line2D.Double(pageFormat.getImageableX(),
                             next_row + (fontMetrics.getHeight() * (maxHeight - 1)) + fontMetrics.getDescent(),
                             pageFormat.getImageableY() + pageFormat.getImageableWidth(),
                             next_row + (fontMetrics.getHeight() * (maxHeight - 1)) + fontMetrics.getDescent()));
              // Return the position of the row following this one
              return next_row + (fontMetrics.getHeight() * maxHeight);
         public static void main(String[] args)
              new Report();
    }

    Fixed some bugs and added a title. Just pass in a JTable and the class will do the rest.
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.print.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import java.text.*;
    import java.math.*;
    public class PrintJTable implements Printable
         private final int LEFT_ALIGN = -1;
         private final int CENTER_ALIGN = 0;
         private final int RIGHT_ALIGN = 1;
         private JFrame m_parent;
         private String m_title;
         private JTable tableView;
         private String lastPrintDate;
         private Font defaultFont;
         private Font headerFont;
         private Font footerFont;
         private int headerHeight;
         private int footerHeight;
         private int cellBuffer = 5;
         private boolean first_pass;
         private ArrayList pages;
         public PrintJTable(JFrame parent, JTable table)
              m_parent = parent;
              tableView = table;
              doPrint();
         public PrintJTable(JFrame parent, String title, JTable table)
              m_parent = parent;
              m_title = title;
              tableView = table;
              doPrint();
          * Reset variables before printing
         private void prepareForPrint()
              pages = new ArrayList();
              first_pass = true;
          * Display a print dialog with some hardcoded defaults
          * The print fonts are also hardcoded
         public void doPrint()
              try
                   String jobName = "Java Report";
                   defaultFont = new Font("Arial", Font.PLAIN, 8);
                   footerFont = new Font("Arial", Font.PLAIN, 6);
                   headerFont = new Font("Arial", Font.BOLD, 8);
                   PrinterJob prnJob = PrinterJob.getPrinterJob();
                   prnJob.setPrintable(this);
                   PrintRequestAttributeSet prnSet = new HashPrintRequestAttributeSet();
                   prnSet.add(new Copies(1));
                   prnSet.add(new JobName(jobName, null));
                   prnSet.add(MediaSizeName.ISO_A4);
                   PageFormat pf = prnJob.defaultPage();
                   pf.setOrientation(java.awt.print.PageFormat.PORTRAIT);
                   prnJob.setJobName(jobName);
                   PrintService[] services = PrinterJob.lookupPrintServices();
                   if (services.length > 0)
                        if (prnJob.printDialog(prnSet))
                              * Get print date
                             String dateFormat = "dd/MM/yyyy HH:mm:ss";
                             DateFormat m_DateFormat = new SimpleDateFormat(dateFormat);
                             lastPrintDate = m_DateFormat.format(new Date()).toString();
                             prepareForPrint();
                             prnJob.print(prnSet);
                   else
                        JOptionPane.showMessageDialog(m_parent, "No Printer was found!!", "Printer Error", JOptionPane.ERROR_MESSAGE);
                        return;
              catch (PrinterException e)
                   e.printStackTrace();
         public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException
               * Check if this is the first time the print method is called for this print action.
               * It is not guaranteed that the print will be called with synchronous pageIndex'es,
               * so we need to calculate the number of pages and which rows appear on which pages.
               * Then the correct page will be printed regardless of which pageIndex is sent through.
              if (first_pass)
                   calcPages(g, pageFormat);
              first_pass = false;
              // Stop printing if the pageIndex is out of range
              if (pageIndex >= pages.size())
                   return NO_SUCH_PAGE;
              Graphics2D     g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              // The footer will be one line at the bottom of the page, cater for this.
              g2.setFont(footerFont);
              footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
              g2.setFont(defaultFont);
              FontMetrics fontMetrics = g2.getFontMetrics();
              int fontHeight = fontMetrics.getHeight();
              int fontDescent = fontMetrics.getDescent();
              double pageHeight = pageFormat.getImageableHeight() + pageFormat.getImageableY();
              double pageWidth = pageFormat.getImageableWidth();
              double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
              // Shrink or expand the table to fit the page width
              double scale = (pageWidth - (cellBuffer * tableView.getColumnCount())) / tableWidth;
              // Calculate the width in pixels for each column
              double[] columnWidths = new double[tableView.getColumnCount()];
              double test = 0;
              for(int i = 0; i < tableView.getColumnCount(); i++)
                   columnWidths[i] = (double)Math.floor(tableView.getColumnModel().getColumn(i).getWidth() * scale);
                   test += columnWidths;
              // Reset the view to the start of the page
              g2.translate(0, 0);
              // Draw a rectangle to see the printable area
              g2.draw3DRect((int)pageFormat.getImageableX(),
                        (int)pageFormat.getImageableY(),
                        (int)pageFormat.getImageableWidth(),
                        (int)pageFormat.getImageableHeight(),
                        false);
              // Calculate the header height
              g2.setFont(headerFont);
              fontMetrics = g2.getFontMetrics();
              // Print the headers and retreive the starting position for the data
              int next_row = (int)pageFormat.getImageableY() + fontMetrics.getHeight();
              if ((m_title != null) && (!m_title.equalsIgnoreCase("")))
                   g2.drawString(m_title,
                                       (int)(pageFormat.getImageableX()),
                                       next_row);
                   Color current_color = g2.getColor();
                   g2.setColor(Color.lightGray);
                   int y = next_row + fontMetrics.getDescent();
                   g2.draw(new Line2D.Double(pageFormat.getImageableX(),
                                  y,
                                  (pageFormat.getImageableY() + pageFormat.getImageableWidth()),
                                  y));
                   g2.setColor(current_color);
                   next_row += fontMetrics.getHeight();
              next_row = printLine(g2, pageFormat, fontMetrics, -1, next_row, columnWidths);
              g2.setFont(defaultFont);
              fontMetrics = g2.getFontMetrics();
              // Start printing the detail
              ArrayList page = (ArrayList)pages.get(pageIndex);
              int start = ((Integer)page.get(0)).intValue();
              int end = ((Integer)page.get(1)).intValue();
              for (int i = start; i <= end; i++)
                   next_row = printLine(g2, pageFormat, fontMetrics, i, next_row, columnWidths);
              // Print the footer
              g2.setFont(footerFont);
              String pageFooter = "Page " + (pageIndex + 1) + " - " + lastPrintDate;
              g2.drawString(pageFooter,
                             (int)pageFormat.getWidth() / 2 - (fontMetrics.stringWidth(pageFooter) / 2),
                             (int)(pageHeight - fontDescent));
              return PAGE_EXISTS;
         * We can't guarantee that the same amount of rows will be displayed on each page,
         * the row heights are dynamic and may wrap onto 2 or more lines.
         * Thus we need to calculate the height of each row and then test how may rows
         * fit on a specific page. eg. Page 1 contains rows 1 to 10, Page 2 contains rows 11 to 15 etc.
         public void calcPages(Graphics g, PageFormat pageFormat) throws PrinterException
              Graphics2D     g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              // The footer will be one line at the bottom of the page, cater for this.
              g2.setFont(footerFont);
              footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
              g2.setFont(defaultFont);
              FontMetrics fontMetrics = g2.getFontMetrics();
              int fontHeight = fontMetrics.getHeight();
              int fontDescent = fontMetrics.getDescent();
              double pageHeight = pageFormat.getImageableHeight() - fontHeight;
              double pageWidth = pageFormat.getImageableWidth();
              double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
              // Shrink or expand the table to fit the page width
              double scale = (pageWidth - (cellBuffer * tableView.getColumnCount())) / tableWidth;
              // Calculate the width in pixels for each column
              double[] columnWidths = new double[tableView.getColumnCount()];
              for(int i = 0; i < tableView.getColumnCount(); i++)
                   columnWidths[i] = (double)Math.floor(tableView.getColumnModel().getColumn(i).getWidth() * scale);
              // Calculate the header height
              int maxHeight = 0;
              g2.setFont(headerFont);
              fontMetrics = g2.getFontMetrics();
              headerHeight = 0;
              if ((m_title != null) && (!m_title.equalsIgnoreCase("")))
                   headerHeight = fontMetrics.getHeight();
              for (int j = 0; j < tableView.getColumnCount(); j++)
                   String value = tableView.getColumnName(j).toString();
                   int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                   if (numLines > maxHeight)
                        maxHeight = numLines;
              headerHeight += g2.getFontMetrics().getHeight() * maxHeight;
              g2.setFont(defaultFont);
              fontMetrics = g2.getFontMetrics();
              int pageNum = 0;
              int bottom_of_page = (int)(pageFormat.getImageableHeight() + pageFormat.getImageableY()) - footerHeight;
              int prev_row = 0;
              int next_row = (int)pageFormat.getImageableY() + fontHeight + headerHeight;
              int i = 0;
              ArrayList page = new ArrayList();
              page.add(new Integer(0));
              for (i = 0; i < tableView.getRowCount(); i++)
                   maxHeight = 0;
                   for (int j = 0; j < tableView.getColumnCount(); j++)
                        String value = formatObject(tableView.getValueAt(i, j));
                        int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                        if (numLines > maxHeight)
                             maxHeight = numLines;
                   prev_row = next_row;
                   next_row += (fontHeight * maxHeight);
                   // If we've reached the bottom of the page then set the current page's end row
                   if (next_row > bottom_of_page)
                        page.add(new Integer(i - 1));
                        pages.add(page);
                        page = new ArrayList();
                        page.add(new Integer(i));
                        pageNum++;
                        next_row = (int)pageFormat.getImageableY()
                                       + fontHeight
                                       + ((int)pageFormat.getHeight() * pageNum)
                                       + headerHeight;
                        bottom_of_page = (int)(pageFormat.getImageableHeight()
                                            + pageFormat.getImageableY())
                                            + ((int)pageFormat.getHeight() * pageNum)
                                            - footerHeight;
                        //Include the current row on the next page, because there is no space on this page
                        i--;
              page.add(new Integer(i - 1));
              pages.add(page);
         * Print the headers or a row from the table to the graphics context
         * Return the position of the row following this one
         public int printLine(Graphics2D g2,
                                       PageFormat pageFormat,
                                       FontMetrics fontMetrics,
                                       int rowNum,
                                       int next_row,
                                       double[] columnWidths)
                   throws PrinterException
              int lead = 0;
              int maxHeight = 0;
              for (int j = 0; j < tableView.getColumnCount(); j++)
                   String value = null;
                   int align = LEFT_ALIGN;
                   if (rowNum > -1)
                        Object obj = tableView.getValueAt(rowNum, j);
                        if (obj instanceof Number)
                             align = RIGHT_ALIGN;
                        value = formatObject(obj);
                   else
                        //align = CENTER_ALIGN;
                        value = tableView.getColumnName(j);
                   int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                   if (numLines > maxHeight)
                        maxHeight = numLines;
                   if (fontMetrics.stringWidth(value) < columnWidths[j])
                        // Single line
                        int offset = 0;
                        // Work out the offset from the start of the column to display alignment correctly
                        switch (align)
                             case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)); break;
                             case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)) / 2; break;
                             default: offset = 0; break;
                        g2.drawString(value,
                                       lead + (int)(pageFormat.getImageableX() + offset),
                                       next_row);
                   else
                        for(int a = 0; a < numLines; a++)
                             //Multi-Line
                             int x = 0;
                             int width = 0;
                             for(x = 0; x < value.length(); x++)
                                  width += fontMetrics.charWidth(value.charAt(x));
                                  if (width > columnWidths[j])
                                       break;
                             int offset = 0;
                             // Work out the offset from the start of the column to display alignment correctly
                             switch (align)
                                  case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value.substring(0, x))); break;
                                  case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value.substring(0, x))) / 2; break;
                                  default: offset = 0; break;
                             g2.drawString(value.substring(0, x),
                                            lead + (int)(pageFormat.getImageableX() + offset),
                                            next_row + (fontMetrics.getHeight() * a));                    
                             value = value.substring(x);
                   lead += columnWidths[j] + cellBuffer;
              // Draw a solid line below the row
              Color current_color = g2.getColor();
              g2.setColor(Color.lightGray);
              int y = next_row + (fontMetrics.getHeight() * (maxHeight - 1)) + fontMetrics.getDescent();
              g2.draw(new Line2D.Double(pageFormat.getImageableX(),
                             y,
                             (pageFormat.getImageableY() + pageFormat.getImageableWidth()),
                             y));
              g2.setColor(current_color);
              // Return the position of the row following this one
              return next_row + (fontMetrics.getHeight() * maxHeight);
         public String formatObject(Object obj)
              String value = (obj == null) ? "" : obj.toString();
              return value;

  • Laserjet Pro 200 M251NW printing Garbage characters multiple pages after just setting up

     I am installing the printer for the first time on a Dell Optiplex with Windows 7 32bit, it is about a year old and is working fine with other printers. The printer was working fine through USB on a laptop running windows XP. 
    Connected the printer to an open USB on the computer and the auto install started running from the printer. It seemed to run OK, I followed all of the prompts, etc. When I said it should print a test page it started printing multiple pages each with a few lines of what I would call garbage text, strange characters, spaces, random letters, etc. It kept printing pages and I had to turn the printer off to get it to stop. 
    I was thinking that maybe the drivers from the printer were old and not for Windows 7, so I then download the full driver from the HP website and installed that. It said it would uninstall the original driver, which it did, then it installed and again all seemed OK until I printed the test page, and the same thing as above happened. I also tried printing some text from notepad and it went to the print queue then disappeared. It still seemed like a driver problem to me so I manually uninstalled from the start menu program Uninstall for the printer. This time I downloaded the basic driver and installed - still with the same result. I thought maybe it was because the Quick STart from the printer kept loading when the printer was turned on so I turned it off from the menu on the printer, but it still didn't help. I also tried another USB port on the computer with the same result. 
    Is it possible there is software left from the first install that may not have been for Windows 7 and it needs to be removed manually?? 
    Any help from HP or anyone would be greatly appreciated as I need to get this printer running for our shipping system ASAP.
    Thanks,
    Rich

    I tried all of those things and it is always the same result. Even on the network, printing from the same computer. I was able to print properly from a different computer, to the HP 200 connected to the USB and shared on the original computer - so I then knew the USB was OK.
    I was looking online further and found the HP Universal  PCL6 driver, and it actually worked! I don't really understand why the proper driver will not work with the printer though. I even created a new user on the computer so all of the programs, etc. would not load, then I uninstalled and reinstalled the driver - still same problem. The computer also has drivers and printer software for Epson printers, so I don't know if that could be causing some type of problem.
    It is good that we can at least do basic printing but I really should have the fully functional driver working for the system. Any help from anyone, and hopefully HP monitors these discussions and can help out.
    Thanks,
    Rich

Maybe you are looking for

  • Central Domain Controller in Solution manager

    Hi All, We have configured ChaRM successfully for ECC and BI system landscapes, by creating domain links between Solution Manager domain controller and individual domain controllers for ECC and BI systems. Now, we are planning to go for a central dom

  • New views in oracle 11.2

    Hello, I came across this link that lists all the new views that oracle introduced in 11.2 and indeed appear to be available, but many of the views doesn't contain/register any value. Does any one have any info on these views or how can one configure

  • Change the default search criteria in CMD-F

    When you enter CMD-F from a Finder window, the default search criteria that come up is "Kind" is "Any".  This is probably the most useless search criterion I can imagine.  It is always necessary to add more criteria to get a minimally useful search u

  • Change optimization

    hi , oracle 10.2.0.1.0 I just ran a simple explan stmnt and o/p was based on RBO . how to change it to CBO . ? SQL> explain plan for select count(*) from employee_details; Explained. SQL> select * from table(dbms_xplan.display); PLAN_TABLE_OUTPUT | I

  • Error 4850 when trying to burn a cd??

    Any ideas trying to burn a paylist to cd but at any point it cancels and comes up with error code 4850? this has happened over the last 2 weeks.I am running Winows XP