On 10/09/2010 16:01, Nurettin DAG wrote: > Hi, > > Is it possible to enforce(or at least default) some print preferences > for pdfs created by iText? Basically, I would like to enforce(default > to) page scaling or rotate preferences in the print dialog to None. It > would also be useful to know if pdf spec accommadates this even if not > iText. Would it be possible to have javascript run when clicked on Print > and then set preferences using JS?
Go to http://1t3xt.be/?024 Use the links under B.2 to download the PDF spec and the JavaScript reference. If you read the PDF spec, you'll find out that the print preferences are limited to: PrintScaling name (Optional; PDF 1.6) The page scaling option that shall be selected when a print dialog is displayed for this document. Valid values are None, which indicates no page scaling, and AppDefault, which indicates the conforming reader’s default print scaling. If this entry has an unrecognized value, AppDefault shall be used. Default value: AppDefault. If the print dialog is suppressed and its parameters are provided from some other source, this entry nevertheless shall be honored. Duplex name (Optional; PDF 1.7) The paper handling option that shall be used when printing the file from the print dialog. The following values are valid: Simplex Print single-sided DuplexFlipShortEdge Duplex and flip on the short edge of the sheet DuplexFlipLongEdge Duplex and flip on the long edge of the sheet Default value: none PickTrayByPDFSize boolean (Optional; PDF 1.7) A flag specifying whether the PDF page size shall be used to select the input paper tray. This setting influences only the preset values used to populate the print dialog presented by a conforming reader. If PickTrayByPDFSize is true, the check box in the print dialog associated with input paper tray shall bechecked. This setting has no effect on operating systems that do not provide the ability to pick the input tray by size. Default value: as defined by the conforming reader PrintPageRange array (Optional; PDF 1.7) The page numbers used to initialize the print dialog box when the file is printed. The array shall contain an even number of integers to be interpreted in pairs, with each pair specifying the first and last pages in a sub-range of pages to be printed.The first page of the PDF file shall be denoted by 1. Default value: as defined by the conforming reader NumCopies integer (Optional; PDF 1.7) The number of copies that shall be printed when the print dialog is opened for this file. Values outside this range shall be ignored. Default value: as defined by the conforming reader, but typically 1 All of these are supported by iText, and of course explained in the second edition of "iText in Action". If you read the JS reference, you'll find out that you can write scripts like this: http://examples.itextpdf.com/resources/js/print_page.js (This is a small example used in the second edition of "iText in Action") ------------------------------------------------------------------------------ Automate Storage Tiering Simply Optimize IT performance and efficiency through flexible, powerful, automated storage tiering capabilities. View this brief to learn how you can reduce costs and improve performance. http://p.sf.net/sfu/dell-sfdev2dev _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
