One issue that we have encountered is strange behavior when printing
to the CutePDF writer. In many applications, printing to CutePDF will
present the user with the standard "Save As..." dialog, allowing the
user to select location, filename, and file type. (Including PDF,
which is A Good Thing.)
Our code:
PrintDialog dialog = new PrintDialog(tree.getShell(), SWT.NONE);
PrinterData printerData = dialog.open();
if (printerData != null) { // Will be null if 'Cancel' clicked
Printer printer = new Printer(printerData);
// ... Build a Print object
PrintJob printJob = new PrintJob("...", pagePrint);
PaperClips.print(printJob, printer);
}
When executed, will display the standard print dialog, allowing users
to select CutePDF. When confirming the print options however, instead
of being presented with the usual "Save As..." dialog, a simple Dialog
with title "Print to File" is shown, with a single text field asking
for an "Output File Name." Upon manually typing an output file name, a
*PostScript* file is created at this location. Is this an issue with
our code above, or is it an incompatibility with Paperclips and
CutePDF?
I have been unable to find any reference to this issue in the forums
or in the examples, which (are very well written, I should add) we are
following diligently.
Thanks,
Craig
I'm not sure if it will make a difference but one thing I notice is that
you are creating a Printer instance which is unnecessary. You can pass
the PrinterData to PaperClips.print and it will create and dispose a
printer internally.
If that doesn't help, send some screenshots of the dialogs you see so I
can get an idea what you're looking at.
Matthew
Thanks for the reply, unfortunately leaving the Printer creation to
PaperClips results in the same behavior. I'll email you two
screenshots, the first of which shows the dialog presented using
PaperClips, the second shows the dialog presented when printing from a
webpage in Chrome. (Simply Ctrl+P)
I'm wondering if this is an issue in SWT, as the PrintDialog class
appears a bit differently from the dialog presented in other
applications.
Thanks,
Craig
Craig