Details
-
Bug
-
Status: Closed
-
Resolution: Fixed
-
0.93
-
None
-
None
-
Operating System: Windows XP
Platform: PC
-
43383
Description
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)
DocPrintJob pj = pservice.createPrintJob();
Doc doc = new SimpleDoc(input, flavor, null);
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(MediaSizeName.ISO_A4);
try
catch (PrintException e)
{ throw new RuntimeException(e); }}
The used FOP XML document (fopString) is attached to this bug report.