Results 1 to 5 of 5

Thread: Oracle XML Publisher - Page number logic

  1. #1
    Join Date
    Jun 2010
    Posts
    3

    Oracle XML Publisher - Page number logic

    Hi,
    I have creaed an RTF document (inovice) in Word using the Oracle XML Publisher Desktop version. The document works fine but there is one last requirement that I cannot seem to find the solution to. Basically a one line invoice should not take more that two pages (one sheet to print) but with the problem that I am having, it takes 5 pages. This is how:

    Page 1is header and summary that could grow to span many pages but for one liner invoice it is usually is one page. I am ending this section1 on even page so that the details start on new odd page. This section does not have to end on even but there is a reasone I am doing that. I will explain below.So page 1 & 2 are taken.

    Details start on page 3 and this section has to end on even so that the last section 3 which is header and coupon prints on a page on it own, page 5. The coupon is the one that is making us pay this price. The coupon page has a header and the coupon is the footer (call to a template). The coupon has to be blank on the back so that if the customer tears it and accompanies it with a check in the mail, there should not be anything on the back, which would mean they will lose the details etc.

    What I wanted to do was:
    Page 1: print header, summary and coupon on the first page.
    Page 2: header , details, and a blank coupon on page 2.
    Page 3: continuation of details if any. So now a one liner invoice will print on 2 page, which would be 1 sheet of paper instead of 3 sheets.

    Question is: How can I call coupon saying, if page_number = 1 then call coupon1. if page_number =2 then coupon 2. I cannot do that. I want to move coupon to the bottom of page one and coupon 2 to the bottom of page 2 and the details to flow to as long as they could be with no footers (coupons).

    I do not know if page number logic is possible, counting rows and assigning it to a varible is possible. Basically, i have no clue how to resolve this issue. Can anyone date to take a stab at it ? :-)

    Thanks,
    Muz

  2. #2
    Join Date
    Dec 2007
    Posts
    996

    Re: Oracle XML Publisher - Page number logic

    You can try to set the page numbering value with the setPageNumberValue(int initialValue, int startPageIndex) method. The initialValue specifies the initial value of page numbering. The startPageIndex specifies the page number from which numbering should start:

    pdfMerger.setPageNumberValue(1, 1);
    Run the PDF Document Merger:

    pdfMerger.process();
    You’ll find the merged PDF document, catalog3.pdf, in the sample code.

  3. #3
    Join Date
    Jun 2010
    Posts
    3

    Re: Oracle XML Publisher - Page number logic

    Super Cop,
    Can I use these functions in an RTF doccument? Could you provide an example of that? i would really appreciate as business is stressing to get this resolved. I jsut want to see how you would call setPageNumberValue() function and how the parameters would get passed to it. If you could help me get rid of the blank pages and reset the coupon, you could well become my hero as all other sources so far could not help :-) Thanks,Muz

  4. #4
    Join Date
    Dec 2007
    Posts
    1,736

    Re: Oracle XML Publisher - Page number logic

    Just as an example, create input streams and a output stream:

    Code:
          FileInputStream[] input = new FileInputStream[2];      input[0] = new FileInputStream("PDFDoc1.pdf");      input[1] = new FileInputStream("PDFDoc2.pdf");      FileOutputStream output = new FileOutputStream("MergedPDF.pdf");
    Create a new PDFDOcMerger object with as input the input and output streams.

    Code:
    PDFDocMerger pdfMerger = new PDFDocMerger(input, output);
    optionally set the page number and a watermark

    Code:
          pdfMerger.setPageNumberCoordinates(300, 20);      pdfMerger.setPageNumberFontInfo("Arial", 10);      pdfMerger.setPageNumberValue(1, 1);      pdfMerger.setTextDefaultWatermark("DRAFT");
    Merge the pdf documents with the PDFMerger class

    Code:
    pdfMerger.process();
    Execute the Java class and you will have your documents merged.
    The full class below

    Code:
    package nl.amis.xmlpublisher;
    
       import oracle.apps.xdo.XDOException;   import oracle.apps.xdo.common.pdf.util.PDFDocMerger;
       import java.io.FileInputStream;   import java.io.FileNotFoundException;   import java.io.FileOutputStream;
    
        public class XMLPublisher {        public XMLPublisher() {        }
    
            public void pdfDocumentMerger() {            try {                FileInputStream[] input = new FileInputStream[2];                input[0] = new FileInputStream("PDFDoc1.pdf");                input[1] = new FileInputStream("PDFDoc2.pdf");
    
                    FileOutputStream output = new FileOutputStream("MergedPDF.pdf");                PDFDocMerger pdfMerger = new PDFDocMerger(input, output);
    
                    pdfMerger.setPageNumberCoordinates(300, 20);                pdfMerger.setPageNumberFontInfo("Arial", 10);                pdfMerger.setPageNumberValue(1, 1);                pdfMerger.setTextDefaultWatermark("DRAFT");                pdfMerger.process();                pdfMerger = null;            } catch (XDOException e) {                System.out.println("XDOException" + e.getMessage());            } catch (FileNotFoundException e) {                System.out.println("FileNotFoundException " + e.getMessage());            }        }
    
            public static void main(String[] argv) {            MLPublisher xmlPublisher = new XMLPublisher();            xmlPublisher.pdfDocumentMerger();        }    }
    More examples here.

  5. #5
    Join Date
    Jun 2010
    Posts
    3

    Re: Oracle XML Publisher - Page number logic

    Thank you James 911,
    I really appreciate your time helping me out. Basically, i am an newbie to XMLP and all I know if to create and embed formulas in RTF document. RTF is all I have. I do not know how and where on the RTF I could do that. Do I have to create a "Text Form" and use "<?xdofx> tags for this? or jsut <?xsl> tags?
    or do I need to convert my RTF to FO formated XML document and use this example? It would be a great help if you could contact me at 678-907-7331 anytime and chat about it. Can we do that?

    Thanks again.
    Muz

Similar Threads

  1. oracle admin page cannot connect
    By Yret in forum Operating Systems
    Replies: 4
    Last Post: 13-11-2010, 06:37 PM
  2. Need help for Main Source of Logic Design in Visual Logic software
    By PsYcHo 1 in forum Software Development
    Replies: 4
    Last Post: 16-01-2010, 07:17 PM
  3. Replies: 2
    Last Post: 30-07-2009, 11:28 PM
  4. Add a footer page number after first page
    By Fantastic Zero in forum Windows Software
    Replies: 3
    Last Post: 24-06-2009, 09:00 AM
  5. How do i start page number on page 3?
    By pushpendra in forum MS Office Support
    Replies: 1
    Last Post: 26-04-2008, 01:53 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,407,349.29612 seconds with 16 queries