Einzelnen Beitrag anzeigen

Benutzerbild von Computerbabalulu
Computerbabalulu

Registriert seit: 26. Sep 2003
233 Beiträge
 
#2

Re: Drucken auf Plotter mit TPrinter

  Alt 15. Nov 2009, 20:46
Hat sich erledigt, ich komme wohl nicht drum rum dem Drucker Objekt die Daten zu übergeben.

Wem es interessiert ...

Einstellungen des aktuellen Standartdruckers auslesen...

Delphi-Quellcode:
var
Device : array[0..255] of char;
Driver : array[0..255] of char;
Port : array[0..255] of char;
hDMode : THandle;
PDMode : PDEVMODE;
begin
  //Default Printer oder hier mit Printer.PrinterIndex:=xxx einen bestimmten Drucker wählen
  Printer.GetPrinter(Device, Driver, Port, hDMode);
  if hDMode <> 0 then begin
    pDMode := GlobalLock(hDMode);
    if pDMode <> nil then begin
    Memo1.Lines.Add('DmSize : '  + IntToStr(pDMode^.dmSize));
    Memo1.Lines.Add('dmDriverExtra : '  + IntToStr(pDMode^.dmDriverExtra));
    Memo1.Lines.Add('dmFields : '  + IntToStr(pDMode^.dmFields));
    Memo1.Lines.Add('dmOrientation : '  + IntToStr(pDMode^.dmOrientation));
    Memo1.Lines.Add('dmPaperSize : '  + IntToStr(pDMode^.dmPaperSize));
    Memo1.Lines.Add('dmPaperLength : '  + IntToStr(pDMode^.dmPaperLength));
    Memo1.Lines.Add('dmPaperWidth :'  + IntToStr(pDMode^.dmPaperWidth));
    Memo1.Lines.Add('dmScale : '  + IntToStr(pDMode^.dmScale));
    Memo1.Lines.Add('dmCopies : '  + IntToStr(pDMode^.dmCopies));
    Memo1.Lines.Add('dmDefaultSource : '  + IntToStr(pDMode^.dmDefaultSource));
    Memo1.Lines.Add('dmPrintQuality : '  + IntToStr(pDMode^.dmPrintQuality));
    Memo1.Lines.Add('dmColor : '  + IntToStr(pDMode^.dmColor));
    Memo1.Lines.Add('dmDuplex : '  + IntToStr(pDMode^.dmDuplex));
    Memo1.Lines.Add('dmYResolution : '  + IntToStr(pDMode^.dmYResolution));
    Memo1.Lines.Add('dmTTOption : '  + IntToStr(pDMode^.dmTTOption));
    Memo1.Lines.Add('dmCollate : '  + IntToStr(pDMode^.dmCollate));
    Memo1.Lines.Add('dmLogPixels : '  + IntToStr(pDMode^.dmLogPixels));
    Memo1.Lines.Add('dmBitsPerPel : '  + IntToStr(pDMode^.dmBitsPerPel));
    Memo1.Lines.Add('dmPelsWidth : '  + IntToStr(pDMode^.dmPelsWidth));
    Memo1.Lines.Add('dmPelsHeight : '  + IntToStr(pDMode^.dmPelsHeight));
    Memo1.Lines.Add('dmDisplayFlags : '  + IntToStr(pDMode^.dmDisplayFlags));
    Memo1.Lines.Add('dmDisplayFrequency : '  + IntToStr(pDMode^.dmDisplayFrequency));
    Memo1.Lines.Add('dmMediaType : '  + IntToStr(pDMode^.dmMediaType));
    Memo1.Lines.Add('dmDitherType : '  + IntToStr(pDMode^.dmDitherType));
    Memo1.Lines.Add('dmICCManufacturer : '  + IntToStr(pDMode^.dmICCManufacturer));
    Memo1.Lines.Add('dmICCModel : '  + IntToStr(pDMode^.dmICCModel));
    Memo1.Lines.Add('dmPanningWidth : '  + IntToStr(pDMode^.dmPanningWidth));
    Memo1.Lines.Add('dmICMIntent : '  + IntToStr(pDMode^.dmPanningHeight));

    GlobalUnlock(hDMode);
   end;
  end;
end;

Einstellungen des aktuellen Standartdruckers schreiben...

Delphi-Quellcode:
var
Device : array[0..255] of char;
Driver : array[0..255] of char;
Port : array[0..255] of char;
hDMode : THandle;
PDMode : PDEVMODE;
begin

   //Default Printer oder hier mit Printer.PrinterIndex:=xxx einen bestimmten Drucker wählen
  Printer.GetPrinter(Device, Driver, Port, hDMode);

  if hDMode <> 0 then
  begin
    pDMode := GlobalLock(hDMode);
    if pDMode <> nil then
    begin
     {Set to custom Settings}
      pDMode^.dmFields := pDMode^.dmFields or
                          DM_PAPERSIZE or
                          DM_SCALE or
                          DM_ORIENTATION or
                          DM_DEFAULTSOURCE or
                          DM_PRINTQUALITY or
                          DM_COLOR or
                          DM_PAPERWIDTH or
                          DM_PAPERLENGTH or
                          DM_MEDIATYPE or
                          DM_DITHERTYPE;

       pDMode^.dmPaperSize := 256;
       pDMode^.dmScale := 100;
       pDMode^.dmOrientation:= 2;
       pDMode^.dmDefaultSource:= 400;
       pDMode^.dmPrintQuality:= 600;
       pDMode^.dmColor:= 2;
       pDMode^.dmPaperWidth := 4320;
       pDMode^.dmPaperLength := 6950;
       pDMode^.dmMediaType:=1;
       pDMode^.dmDitherType:=2;
      GlobalUnlock(hDMode);
    end;
  end;
end;
Gruß Baba
Frank
  Mit Zitat antworten Zitat