Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 161111 Details for
Bug 96394
Printing: get a list of paper formats for a printer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Testcase
PrintDialog_StartPage.java (text/x-java), 2.27 KB, created by
Praveen
on 2010-03-05 07:03:46 EST
(
hide
)
Description:
Testcase
Filename:
MIME Type:
Creator:
Praveen
Created:
2010-03-05 07:03:46 EST
Size:
2.27 KB
patch
obsolete
>package org.eclipse.swt.snippets.MySnippets; > >import org.eclipse.swt.SWT; >import org.eclipse.swt.events.SelectionEvent; >import org.eclipse.swt.events.SelectionListener; >import org.eclipse.swt.layout.FillLayout; >import org.eclipse.swt.printing.PrintDialog; >import org.eclipse.swt.printing.Printer; >import org.eclipse.swt.printing.PrinterData; >import org.eclipse.swt.widgets.Button; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Shell; > >public class PrintDialog_StartPage { > static PrinterData data = new PrinterData(); > public static void main(String[] args) { > Display display = new Display(); > Shell shell = new Shell(display); > shell.setLayout(new FillLayout()); > shell.open(); > /* Printer Name */ > data.name = "Test"; //any existing Printer name > /* Print To File */ > data.printToFile = true; > data.fileName = "output.pdf"; > /* Page Ranges */ > data.scope = PrinterData.PAGE_RANGE | PrinterData.NO_SELECTION; > data.startPage = 2; > data.endPage = 4; > /* Collate */ > data.collate = true; > /* Scale */ > data.scale = 90.0; > /* Page Orientation */ > data.orientation = PrinterData.LANDSCAPE; > /* Number of copies */ > data.copyCount = 3; > /* Duplex */ > data.duplex = PrinterData.DUPLEX_HORIZONTAL; > /* Paper Size */ > String[] paperSize = Printer.getPaperNameList(); > for (int i=0;i<paperSize.length;i++) { > System.out.println(paperSize[i]); > } > data.paperSizeName = PrinterData.PAPER_CUSTOM;//paperSize[7]; //random > data.customPaperHeight = 13; > data.customPaperWidth = 8; > data.customPaperName = "MyCustom"; > data.customPaperDisplayName = "MyCustom"; > /* Pages per Side */ > data.pagesPerSide = 9; > /* Duplex */ > data.duplex = PrinterData.DUPLEX_HORIZONTAL; > data.resolutionX = 600; > data.resolutionY = 600; > > final PrintDialog dialog = new PrintDialog(shell, SWT.NULL); > Button button = new Button(shell, SWT.None); > button.setText("PrintDialog"); > button.addSelectionListener(new SelectionListener() { > @Override > public void widgetSelected(SelectionEvent e) { > if (data!=null) dialog.setPrinterData(data); > data = dialog.open(); > } > @Override > public void widgetDefaultSelected(SelectionEvent e) { > } > }); > shell.pack(); > while (!shell.isDisposed()) { > if (!display.readAndDispatch()) > display.sleep(); > } > > display.dispose(); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 96394
:
158751
|
158841
|
159788
|
161015
| 161111 |
162862
|
162867