Page 1 of 1

Size file to print

Posted: Thu Sep 03, 2009 2:59 pm
by phillip
Hi,

The scenario we have is that we have a gdviewer on a windows form which is not visible to the user.

We use the viewer to send files to print so the user never sees the file in the viewer but they can select print settings.

What I really need to do is to size the file to the page size the user selects, so if the image is say A3 and the user selects to print at A4 aor A5 I need to size the image to the print size.

Have you any ideas on how I can do this? It looks like I could size the image to the size of the viewer, but that would not be the size the user is printing at. Could I maybe size the invisible viewer to be the size the user is printing at then use the zoom mode on the viewer?

Thanks,

Phil

Re: Size file to print

Posted: Thu Sep 03, 2009 3:24 pm
by eharvey
Have you tried the:

PrintDialogFit()

From the documentation:

GdViewer.PrintDialogFit () Invokes the standard Windows Printer Dialog, which allows users to choose the printer settings, then prints the displayed document adjusting pages size to the default paper size.

GdViewer.PrintDialogFit (IWin32Window) Invokes the standard Windows Printer Dialog, which allows users to choose the printer settings, then prints the displayed document adjusting pages size to the default paper size.
This function allows to specify the top-level window that will own the modal dialog box.

-Eric

Re: Size file to print

Posted: Fri Sep 04, 2009 11:34 am
by phillip
Thanks for the response Eric.

I set the printer settings myself on the gdviewer before sending the file to print but I found a similar thing with the print method to the print dialogue in that there is a Print() method and a PrintToFit() method since posting this topic.

Using PrintFit() works much better but I am experiencing a problem with it....

If I print in A4 it works fine and prints to fit the page great. But, if I print to A4 Landscape it sizes the image as if it is printing to Portrait. Is this a bug or do I need to set something else?

My code is like this (notice I set the orientation and use printfit() )...

PrinterSettings printerSettings = _printSettings[batchPrintAttachmentInfo.ID];
gdViewer1.PrintSetActivePrinter(printerSettings.PrinterName);
gdViewer1.PrintSetDocumentName(batchPrintAttachmentInfo.Name);
gdViewer1.PrintSetCopies(printerSettings.Copies);
gdViewer1.PrintSetColorMode(printerSettings.DefaultPageSettings.Color ? PrinterColorMode.PrinterColorModeColor : PrinterColorMode.PrinterColorModeGray);
gdViewer1.PrintSetOrientation(printerSettings.DefaultPageSettings.Landscape ? PrinterOrientation.PrinterOrientationLandscape : PrinterOrientation.PrinterOrientationPortrait);
gdViewer1.PrintSetDuplexMode(printerSettings.Duplex);
gdViewer1.PrintSetStdPaperSize(printerSettings.DefaultPageSettings.PaperSize.RawKind);
gdViewer1.PrintSetPaperBin(printerSettings.DefaultPageSettings.PaperSource.RawKind);


// Send the file to print
gdViewer1.PrintFit();

Re: Size file to print

Posted: Fri Sep 04, 2009 1:35 pm
by Loïc
Hi,

This problem will be solved in next release. See: viewtopic.php?t=1875