169 похожих чатов

Pdf файл можно ли печатать с параметрами книжный и

в реальном размере без открывая ? Кто-то может знает

2 ответов

8 просмотров

if Stream is TLOBLocator then TLOBLocator(Stream).SaveToFile(FileName) else Assert(False, '{003DB66F-5C7E-400E-A61C-A23A786DD82F}'); h := ShellExecute(Application.Handle , PChar(PrnCommand) , PChar(FileName) , PChar(PrnParams) , nil , SW_HIDE ); if h <= 32 then //Returns a value greater than 32 if successful. raise Exception.Create(SysErrorMessage(GetLastError)); end;

Ты не можешь управлять этими параметрами. Можно сделать несколько принтеров с разным набором настроек и регулировать этим. class function TdmFile.PrintToParams(iPrn: Integer): string; var pl: TStrings; sPrnTag: string; i: Integer; Device, Driver, Port: array[0..255] of Char; hDeviceMode: THandle; begin Result := ''; sPrnTag := IntToStr(prnBarcodes + iPrn); pl := Printer.Printers; // Не освобождаем его - не наше! for i := 0 to pl.Count - 1 do if Pos(sPrnTag, pl[i]) > 0 then begin Printer.PrinterIndex := i; Printer.GetPrinter(Device, Driver, Port, hDeviceMode); Result := Format('"%s" "%s" "%s"', [Device, Driver, Port]); Exit; end; end; //печать файла средствами ОС procedure TdmFile.Print(Stream: TStream; const sRpt: string; iJob, iPrn: Integer); {$region 'ms-help://borland.bds5/ShellCC/platform/shell/reference/functions/shellexecute.htm'} { Return Value Returns a value greater than 32 if successful, or an error value that is less than or equal to 32 otherwise. The following table lists the error values. The return value is cast as an HINSTANCE for backward compatibility with 16-bit Windows applications. It is not a true HINSTANCE, however. The only thing that can be done with the returned HINSTANCE is to cast it to an int and compare it with the value 32 or one of the error codes below. 0 The operating system is out of memory or resources. ERROR_FILE_NOT_FOUND The specified file was not found. ERROR_PATH_NOT_FOUND The specified path was not found. ERROR_BAD_FORMAT The .exe file is invalid (non-Microsoft Win32 .exe or error in .exe image). SE_ERR_ACCESSDENIED The operating system denied access to the specified file. SE_ERR_ASSOCINCOMPLETE The file name association is incomplete or invalid. SE_ERR_DDEBUSY The Dynamic Data Exchange (DDE) transaction could not be completed because other DDE transactions were being processed. SE_ERR_DDEFAIL The DDE transaction failed. SE_ERR_DDETIMEOUT The DDE transaction could not be completed because the request timed out. SE_ERR_DLLNOTFOUND The specified DLL was not found. SE_ERR_FNF The specified file was not found. SE_ERR_NOASSOC There is no application associated with the given file name extension. This error will also be returned if you attempt to print a file that is not printable. SE_ERR_OOM There was not enough memory to complete the operation. SE_ERR_PNF The specified path was not found. SE_ERR_SHARE A sharing violation occurred. } {$endregion} {$region 'Windows.pas'} (* const { ShowWindow() Commands } {$EXTERNALSYM SW_HIDE} SW_HIDE = 0; const { The system cannot find the file specified. } ERROR_FILE_NOT_FOUND = 2; { The system cannot find the path specified. } ERROR_PATH_NOT_FOUND = 3; { An attempt was made to load a program with an incorrect format. } ERROR_BAD_FORMAT = 11; *) {$endregion} {$region 'ShellAPI.pas'} (*{ ShellExecute() and ShellExecuteEx() error codes } const { regular WinExec() codes } SE_ERR_FNF = 2; { file not found } SE_ERR_PNF = 3; { path not found } SE_ERR_ACCESSDENIED = 5; { access denied } SE_ERR_OOM = 8; { out of memory } SE_ERR_DLLNOTFOUND = 32; { error values for ShellExecute() beyond the regular WinExec() codes } SE_ERR_SHARE = 26; SE_ERR_ASSOCINCOMPLETE = 27; SE_ERR_DDETIMEOUT = 28; SE_ERR_DDEFAIL = 29; SE_ERR_DDEBUSY = 30; SE_ERR_NOASSOC = 31; *) {$endregion} const PrnCommand = 'printto'; var PrnParams: string; FileName: string; h: HINST{ANCE}; begin Assert(Assigned(dm), '{60C1CF4F-8AB5-469B-A36E-9F930B1912F7}'); Assert(Assigned(Stream), '{BA902204-1632-47BB-B2E6-DB41631FB9DE}'); Assert(sRpt > '', '{E335C751-95C0-47ED-8EA4-BC74AEC74E2E}'); Assert(iJob > 0, '{E1590804-CFD9-465E-BB05-373EA6DB059B}'); Assert(iPrn > 0, '{3CB545D6-14F6-46F4-8273-825B44778F9B}'); FileName := FileNameGet(sRpt); PrnParams := PrintToParams(iPrn); Tdm.infMsg(FileName);

Похожие вопросы

Обсуждают сегодня

Друзья, за кем?
Magic
12
А шо, ты этой библиотекой пользуешься?
Darkanronpa Dark Hole
10
Anyone here suffers from unexplained aural migraines, who would be up for talking for a bit? Doesn't *have* to be aural, but I am not asking about headaches, I mean actual mi...
Martin Rys
58
Сообщение* в закодированном виде. То есть, просто сделать sendMessage?text=Привет бла-бла! не получится, надо в HEX переводить, и добавлять процент, типа такого: sendMessage?t...
КТ315
21
А случайно нет ли в паскале штатной возможности передать указатель и количество туда где array of в качестве аргумента?
zamtmn
25
Всем привет. Кто-то может подсказать, как можно перевести значения Selection поля, если список значений в нем формируется динамически? Я изначально их получаю из selection дру...
Наталья Селезнева
6
Или даже по-другому вопрос выстрою Есть ли вообще в electron'e для винды, возможность кнопки действий в нотификацию впихнуть ?
Андрей
7
Hello friends, I have a question. I have a site written in HTML. This site has been ranking high on Google for about 10 years. I will change the hosting of the site and I will...
Ens
4
приветы , подскажите что я не так сделал , почему у меня скрипт не работает в программе Revit ? ;Autohotkey_RU IfWinActive ("ahk_exe Revit.exe") ; только в открытом Revit Gu...
Anton Terentev
2
> комьюнити я бы не судил по этому чату. Как мы видели по статам просмотров нескольких телеговских постов, то в чате их набивается 30-40 или даже выше, когда как общаются акти...
Constantin F.
4
Карта сайта