Size file to print

Discussions about document printing in GdPicture.NET using GdPictureImaging.
Post Reply
phillip
Posts: 6
Joined: Wed Jul 01, 2009 5:06 pm

Size file to print

Post by phillip » Thu Sep 03, 2009 2:59 pm

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

eharvey
Posts: 8
Joined: Sat Mar 21, 2009 4:26 pm

Re: Size file to print

Post by eharvey » Thu Sep 03, 2009 3:24 pm

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

phillip
Posts: 6
Joined: Wed Jul 01, 2009 5:06 pm

Re: Size file to print

Post by phillip » Fri Sep 04, 2009 11:34 am

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();

User avatar
Loïc
Site Admin
Posts: 5597
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Size file to print

Post by Loïc » Fri Sep 04, 2009 1:35 pm

Hi,

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

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests