You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Ranjith Kodikara <ra...@lankaorix.com> on 2011/09/08 13:27:12 UTC

How to print a PDF document to custom page size or Landscap

Hi   friends,

I am trying to print a PDF document. but it's always printed as portrait. I cannot get it to a custom page size or in Ladnscape.


        document = PDDocument.load("C:\\Temp\\test.pdf");
            PageFormat pf1=document.getPageFormat(0);
            Paper p = pf1.getPaper();
            p.setSize(8.5, 5.5);
            pf1.setPaper(p);
            pf1.setOrientation(0);
//            org.apache.pdfbox.PrintPDF.main(args["C:\\Temp\\test.pdf"]);

//           Printable pr= document.getPrintable(0);
            document.silentPrint();
Appreciate your response.


Thanks and best regards,
Ranjith


This message (including any attachments) is intended only for the use of the individual or entity to which it is addressed and may contain information that is non-public, proprietary, privileged, confidential, and exempt from disclosure under applicable law or may constitute as attorney work product. If you are not the intended recipient, you are hereby notified that any use, dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, notify us immediately by telephone and (i) destroy this message if a facsimile or (ii) delete this message immediately if this is an electronic communication. Thank you.