DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43383>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43383

           Summary: AWT Renderer prints pages in the wrong order
           Product: Fop
           Version: 0.93
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: awt renderer
        AssignedTo: fop-dev@xmlgraphics.apache.org
        ReportedBy: [EMAIL PROTECTED]


When i print a specific document with 2 pages with AWT Renderer, the second page
is printed first, and then the first page.
Even if i select a PDF pseudo printer driver (WIN2PDF), the generated PDF
contains first the second page, then the first page (see attached PDF).

Printing code:
Pageable p = getFop93Pageable(fopString);
printJavaxDefault(p,DocFlavor.SERVICE_FORMATTED.PAGEABLE);


Utility method code for generating Pageable:

    public static Pageable getFop93Pageable(String fopString){
       StringReader reader = new StringReader(fopString);

       if(fopFactory == null){
           fopFactory = FopFactory.newInstance();
       }

        try {
            AWTRenderer renderer = new AWTRenderer();
            FOUserAgent agent = fopFactory.newFOUserAgent();
            agent.setRendererOverride(renderer);
            renderer.setPreviewDialogDisplayed(false);
            renderer.setUserAgent(agent);
            Fop fop = fopFactory.newFop(AWTRenderer.MIME_TYPE, agent);
            TransformerFactory factory = TransformerFactory.newInstance();
            Transformer transformer = factory.newTransformer();
            Source src = new StreamSource(reader);
            Result res = new SAXResult(fop.getDefaultHandler());
            transformer.transform(src, res);
            return renderer;
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        } finally{
            if(reader != null)
                reader.close();
        }
    }

Utility method code for printing pageable:

    public static void printJavaxDefault(Object input, DocFlavor flavor){
        PrintService pservice = PrintServiceLookup.lookupDefaultPrintService();
        if(pservice==null) {
            throw new RuntimeException("No print service available");
        }
        DocPrintJob pj = pservice.createPrintJob();
        Doc doc = new SimpleDoc(input, flavor, null);
        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
        aset.add(MediaSizeName.ISO_A4);
        try {
              pj.print(doc, aset);
         } catch (PrintException e) {
             throw new RuntimeException(e);
         }
    }


The used FOP XML document (fopString) is attached to this bug report.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Reply via email to