QR 如何依紙張大小壓縮文件 |
答題得分者是:jieshu
|
wenjung
一般會員 發表:21 回覆:61 積分:21 註冊:2002-04-29 發送簡訊給我 |
|||
jieshu
版主 發表:42 回覆:894 積分:745 註冊:2002-04-15 發送簡訊給我 |
引言: 大家好,我有一個問題一直無法解決。以下是我的問題: 不知QR 是否可以依紙張大小來壓縮所要輸出的文件,如:紙張設定大小為a4 ,但 輸出的資料長度卻比 A4 大,請問是QR否可以設定壓縮的比率,或是有其他元件可 用 。 謝謝大家 !QR產生的是一圖形檔,你可以將圖縮印到A4大小。其列印的原始碼如下: procedure TQRPrinter.Print; type TSmallPoint = record X, Y : integer; end; var I : integer; aPoint : TSmallPoint; ASize : TPoint; APage : TMetafile; FromPage, ToPage: integer; begin {$ifdef EVAL} if not DelphiRunning then MessageDlg('Unregistered evaluation copy - Printing is only allowed while Delphi is running',mtWarning,[mbOK],0) // do not locallize else {$endif} {$ifdef VER36PRO} if assigned(FMaster) and not ReportLoaded and ( not PrintMetafile and (Status = mpFinished)) then {$else} if assigned(FMaster) and not ReportLoaded then {$endif} PostMessage(Master.Handle, CM_QRPRINT, 0, 0) else // print metafile if (Status = mpFinished) and PrinterOK then try APrinter.Title := Title; if APrinter.Printing then APrinter.Abort; {$ifdef VER36PRO} self.aPrinterSettings.ApplySettings; {$endif} APrinter.BeginDoc; FromPage := 1; ToPage := PageCount; { if (FirstPage <> 0) or (LastPage <> 0) then begin FromPage := FirstPage; ToPage := LastPage; end; } if FirstPage <> 0 then FromPage := FirstPage; if LastPage <> 0 then ToPage := LastPage; for I := FromPage to ToPage do begin Application.ProcessMessages; PageNumber := I; aPoint.X := GetDeviceCaps(APrinter.Handle, PHYSICALOFFSETX); aPoint.Y := GetDeviceCaps(APrinter.Handle, PHYSICALOFFSETY); aSize.X := GetDeviceCaps(APrinter.Handle, PHYSICALWIDTH); aSize.Y := GetDeviceCaps(APrinter.Handle, PHYSICALHEIGHT); APage := GetPage(I); try APrinter.Canvas.StretchDraw(Rect(0, 0, APrinter.PageWidth, APrinter.PageHeight), APage); finally APage.Free; end; // if I < PageCount then APrinter.NewPage; if I < ToPage then APrinter.NewPage; if Cancelled then APrinter.Abort; end finally if APrinter.Printing then APrinter.EndDoc; end; end;
------
人生有夢,逐夢而行 人若為善,福雖未至,禍已遠離 人若為惡,禍雖未至,福已遠離 http://www.taconet.com.tw/jieshu/ |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |