|
Вопрос # 1 728/ вопрос открыт / |
|
Здравствуйте!
Заранее всем спасибо. У меня задача: есть изображение. По введённым параметрам надо его отмасштабировать и вывести на принтер. В масштабе картинка мотбыть больше А4 (примерно 1500*500 мм). После распечатки листочки обрезаем, складываем, и получаем картинку 1:1. Как это сделать? Мотбыть есть какаято спецштука для работы с принтером? И как это изображение лучше хранить, чтоб масштабилось без особой потери качества. (рисунок типа эскиза детали-чернобелый)
 |
Вопрос задал: red_88 (статус: Посетитель)
Вопрос отправлен: 25 июня 2008, 21:07
Состояние вопроса: открыт, ответов: 3.
|
Ответ #1. Отвечает эксперт: Мережников Андрей
Здравствуйте, red_88!
Может быть поможет информация, приведенная в приложении (опубликовано в DelphiWorld)
Приложение: Переключить в обычный режим- procedure DrawImage(Canvas: TCanvas; DestRect: TRect; ABitmap:
- TBitmap);
- var
- Header, Bits: Pointer;
- HeaderSize: Integer;
- BitsSize: Longint;
- begin
- GetDIBSizes(ABitmap.Handle, HeaderSize, BitsSize);
- Header := MemAlloc(HeaderSize);
- Bits := MemAlloc(BitsSize);
- try
- GetDIB(ABitmap.Handle, ABitmap.Palette, Header^, Bits^);
- StretchDIBits(Canvas.Handle, DestRect.Left, DestRect.Top,
- DestRect.Right, DestRect.Bottom,
- 0, 0, ABitmap.Width, ABitmap.Height, Bits, TBitmapInfo(Header^),
- DIB_RGB_COLORS, SRCCOPY);
-
-
- finally
- MemFree(Header, HeaderSize);
- MemFree(Bits, BitsSize);
- end;
- end;
-
-
-
- procedure PrintBitmap(ABitmap: TBitmap);
- var
- relheight, relwidth: integer;
- begin
- screen.cursor := crHourglass;
- Printer.BeginDoc;
- if ((ABitmap.width / ABitmap.height) > l(printer.pagewidth /
- printer.pageheight)) then
- begin
-
- relwidth := printer.pagewidth;
- relheight := MulDiv(ABitmap.height, printer.pagewidth, ABitmap.width);
- end
- else
- begin
-
- relwidth := MulDiv(ABitmap.width, printer.pageheight, ABitmap.height);
- relheight := printer.pageheight;
- end;
- DrawImage(Printer.Canvas, Rect(0, 0, relWidth, relHeight), ABitmap);
- Printer.EndDoc;
- screen.cursor := crDefault;
- end;
-
-
 |
Ответ отправил: Мережников Андрей (статус: Абитуриент)
Время отправки: 25 июня 2008, 22:36
|
Ответ #2. Отвечает эксперт: ANBsoft
Здравствуйте, red_88!
Для таких целей существуют специальные программы, например PrpPoster.
Она делает как раз то, что Вам нужно.
 |
Ответ отправил: ANBsoft (статус: Студент)
Время отправки: 25 июня 2008, 23:58
|
Ответ #3. Отвечает эксперт: Feniks
Здравствуйте, red_88!
Попробуйте еще функции из Приложения.
Желаю удачи.
Приложение: Переключить в обычный режим- {
-
-
- (c) Alexey Torgashin, 2007
-
-
- http://atorg.net.ru/delphi/atviewer.htm
-
-
-
-
-
-
-
-
-
-
-
-
- -----------------------------------
-
- Image printing. Uses Printers unit.
- Should work with all graphics: bitmaps, metafiles and icons.
-
- Parameters:
- - AImage: TImage object.
- - ACopies: number of copies (you may set 0 for a single copy).
- - AFitToPage: fit image to a printer page. If image is smaller than a page and
- AFitOnlyLarger=False then image will be stretched up to a page.
- - AFitOnlyLarger: allows to stretch images smaller than a page.
- - ACenter: center image on a page.
- - APixelsPerInch: pass here value of PixelsPerInch property of your form or
- of a Screen object (Screen.PixelsPerInch).
- - ACaption: print job caption in Print Manager.
- }
-
- function ImagePrint(
- AImage: TImage;
- ACopies: word;
- AFitToPage,
- AFitOnlyLarger,
- ACenter: boolean;
- APixelsPerInch: integer;
- const ACaption: string): boolean;
- var
- bmp: TBitmap;
- begin
- bmp:= TBitmap.Create;
- try
- bmp.PixelFormat:= pf24bit;
-
- {$ifdef ADV_IMAGE_CONV}
- if not CorrectImageToBitmap(AImage, bmp, clWhite) then
- begin
- Result:= false;
- Exit
- end;
- {$else}
- with AImage.Picture do
- begin
- bmp.Width:= Graphic.Width;
- bmp.Height:= Graphic.Height;
- bmp.Canvas.Draw(0, 0, Graphic);
- end;
- {$endif}
-
- Result:= BitmapPrint( //Declared below
- bmp,
- ACopies,
- AFitToPage,
- AFitOnlyLarger,
- ACenter,
- APixelsPerInch,
- ACaption);
-
- finally
- bmp.Free;
- end;
- end;
-
-
- function BitmapPrint(
- ABitmap: TBitmap;
- ACopies: word;
- AFitToPage,
- AFitOnlyLarger,
- ACenter: boolean;
- APixelsPerInch: integer;
- const ACaption: string): boolean;
- var
- Scale, ScalePX, ScalePY, ScaleX, ScaleY: Double;
- SizeX, SizeY,
- RectSizeX, RectSizeY, RectOffsetX, RectOffsetY: integer;
- i: integer;
- Begin
- Result:= true;
-
- Assert(
- Assigned(ABitmap) and (ABitmap.Width>0) and (ABitmap.Height>0),
- 'BitmapPrint: bitmap is empty.');
-
- if ACopies = 0 then
- Inc(ACopies);
-
- with Printer do
- begin
- SizeX:= PageWidth;
- SizeY:= PageHeight;
-
- ScalePX:= GetDeviceCaps(Handle, LOGPIXELSX) / APixelsPerInch;
- ScalePY:= GetDeviceCaps(Handle, LOGPIXELSY) / APixelsPerInch;
-
- ScaleX:= SizeX / ABitmap.Width / ScalePX;
- ScaleY:= SizeY / ABitmap.Height / ScalePY;
-
- if ScaleX < ScaleY then
- Scale:= ScaleX
- else
- Scale:= ScaleY;
-
- if (not AFitToPage) or (AFitOnlyLarger and (Scale > 1.0)) then
- Scale:= 1.0;
-
- RectSizeX:= Trunc(ABitmap.Width * Scale * ScalePX);
- RectSizeY:= Trunc(ABitmap.Height * Scale * ScalePY);
-
- if ACenter then
- begin
- RectOffsetX:= (SizeX - RectSizeX) div 2;
- RectOffsetY:= (SizeY - RectSizeY) div 2;
- end
- else
- begin
- RectOffsetX:= 0;
- RectOffsetY:= 0;
- end;
-
- Title:= ACaption;
-
- try
- BeginDoc;
- try
- for i:= 1 to ACopies do
- begin
- Canvas.StretchDraw(
- Rect(
- RectOffsetX,
- RectOffsetY,
- RectOffsetX + RectSizeX,
- RectOffsetY + RectSizeY),
- ABitmap
- );
- if i < ACopies then
- NewPage;
- end;
- finally
- EndDoc;
- end;
- except
- Result:= false;
- end;
- end;
- end;
 |
Ответ отправил: Feniks (статус: Бакалавр)
Время отправки: 26 июня 2008, 10:02
|
Мини-форум вопроса
Всего сообщений: 5; последнее сообщение — 26 июня 2008, 10:56; участников в обсуждении: 2.
|
ANBsoft (статус: Студент), 26 июня 2008, 00:01 [#1]:
Пардон, опечатка, нужно ProPoster.
|
|
Dron (статус: Студент), 26 июня 2008, 10:07 [#2]:
Бубырь Александр Николаевич: а ссылку на программу Вам было сложно привести?
С уважением.
|
|
Dron (статус: Студент), 26 июня 2008, 10:27 [#4]:
Цитата:
Для тех кто не хочет пользоваться поиском 
А не в этом дело. Чем выше статус эксперта, тем более высокие требования к качеству ответов.
Цитата:
http://depositfiles.com/files/6217459
А официального сайта у программы нет что ли?
С уважением.
|
|
ANBsoft (статус: Студент), 26 июня 2008, 10:56 [#5]:
В принципе согласен,
офф сайт http://www.ronyasoft.com/products/proposter/,
но для нормального человека достаточно знать что искать.
Яндекс по ключу "Proposter" выдал тучу ссылок.
А выложенная мной ссылка гораздо лучше чем офф,
кто скачал поймет о чем я .
|
Чтобы оставлять сообщения в мини-форумах, Вы должны авторизироваться на сайте.
|