Page 1 of 1

Exception in PrintBySize

Posted: Thu Aug 12, 2010 3:01 pm
by pyh
Hi, I have an error when I'm trying to print image from programm.
Exception ‘InvalidPrinterException’ - “No Printers are installed.” throws in method PrintBySize. In other programs (Paint for example) I can print without these error.

GDPicture version: 6.7.0.8
Framework version: 3.5
My printer sets as default.

Exception info:
System.Drawing.Printing.InvalidPrinterException occurred
Message="Установленные принтеры не обнаружены."
Source="System.Drawing"
StackTrace:
в System.Drawing.Printing.StandardPrintController.OnStartPrint(PrintDocument document, PrintEventArgs e)
в System.Drawing.Printing.PrintController.Print(PrintDocument document)
в System.Drawing.Printing.PrintDocument.Print()
в Ꮫ.ᡲ.᤯(Int32 ᤰ, Single ᤱ, Single ᤲ, Single ᤳ, Single ᤴ, Boolean ᤵ)
в Ꮫ.ᡲ.ᣱ(Int32 ᣲ, Single ᣳ, Single ᣴ, Single ᣵ, Single ᣶)
в GdPicture.GdPictureImaging.PrintBySize(Int32 ImageID, Single DstLeft, Single DstTop, Single Width, Single Height)
в Chocolography.Printing.PrintingHelper.PrintImage(Bitmap imageToPrint) в H:\_src\Chocolography Printing Studio\Chocolography Printing Studio\Printing\PrintingHelper.cs:строка 153
InnerException:

Re: Exception in PrintBySize

Posted: Fri Aug 13, 2010 2:12 pm
by Loïc
Hi,

Which code are you using to reproduce this error ?

Kind regards,

Loïc

Re: Exception in PrintBySize

Posted: Fri Aug 13, 2010 4:01 pm
by pyh
Loïc wrote:Hi,

Which code are you using to reproduce this error ?

Kind regards,

Loïc
Hi, Loïc. It's very simple code:

Code: Select all

var imageId = 0;
var oGdPictureImaging = new GdPicture.GdPictureImaging();
oGdPictureImaging.SetLicenseNumber(GdLicenseNumber);
var gdiBitmap = imageToPrint.ToGdiplusBitmap();
imageId = oGdPictureImaging.CreateGdPictureImageFromBitmap(gdiBitmap);
oGdPictureImaging.PrintSetShowPrintingProgress(false);
oGdPictureImaging.PrintSetDocumentName(ProjectData.ProjectName); 
oGdPictureImaging.PrintBySize(imageId, 0, 0, PrintingHelper.PalletWidthInch, PrintingHelper.PalletHeightInch); // !!! exception
But this exception appears only on specified printer "Encad CadJet T-200" other printers works well with this code.