Printing from code doesn't care of DMPAPER_USER
Hi,
I need to print on envelopes. Thanks to helpful people, now I can position the memos using mm-s.
If I print on an A4 sheet, every memo is at the expected position.
But if I put an envelop in, the Left property of the memos is not at the right place.
My code:
FrRep := TFrxReport.Create(nil);
FrRep.clear;
Page := TfrxReportPage.Create(FrRep);
Page.CreateUniqueName;
Page.PaperSize := DMPAPER_USER ;
Page.PaperWidth := 162; //
Page.PaperHeight := 114;
Page.Orientation := poLandscape; // it doesn't matter if I use landscape or portrait
Page.LeftMargin := 0.4;
Page.RightMargin := 0.4;
Page.TopMargin := 0.4;
Page.BottomMargin := 0.4;
Memo := TfrxMemoView.Create(Page);
Memo.CreateUniqueName;
Memo.Text := MyText;
Memo.SetBounds(fr01cm *20,fr01cm *50,100,20); //20 mm from the left and 50mm from the top
FrRep.PrepareReport;
FrRep.Print;
Thank you very much for your help!
I need to print on envelopes. Thanks to helpful people, now I can position the memos using mm-s.
If I print on an A4 sheet, every memo is at the expected position.
But if I put an envelop in, the Left property of the memos is not at the right place.
My code:
FrRep := TFrxReport.Create(nil);
FrRep.clear;
Page := TfrxReportPage.Create(FrRep);
Page.CreateUniqueName;
Page.PaperSize := DMPAPER_USER ;
Page.PaperWidth := 162; //
Page.PaperHeight := 114;
Page.Orientation := poLandscape; // it doesn't matter if I use landscape or portrait
Page.LeftMargin := 0.4;
Page.RightMargin := 0.4;
Page.TopMargin := 0.4;
Page.BottomMargin := 0.4;
Memo := TfrxMemoView.Create(Page);
Memo.CreateUniqueName;
Memo.Text := MyText;
Memo.SetBounds(fr01cm *20,fr01cm *50,100,20); //20 mm from the left and 50mm from the top
FrRep.PrepareReport;
FrRep.Print;
Thank you very much for your help!
Comments
envelopes are usually inverted.
Hi,
Thank you for the answer. If I put the printed envelope on the printed A4 (both are set to middle in the printer) it can be seen that the FR thinks that the sheet is an A4 and not what I set. See the attached image I drew to show the problem.
So Fr prints the memo exactly at the same area and it doesn't use the custom settings.
Thank you
Hello,
The printer support the custom sizes.
If I set the printer to the envelope size it works.... but I though that the FR can set the custom size on its own.
I just cannot expect the novice users to make a setting for each envelope they use. Most of them haven't heard of Control Panel in Windows.
I know from experience: if a user needs to do any setting in Windows, no matter what he will say that the software is a piece of bu****t and he will not use it. [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> If I need to make the custom size for each printer then why should I use the following? Page.PaperSize := DMPAPER_USER ; Page.PaperWidth := 162; Page.PaperHeight := 114; I used Rave Reports previously and Rave could change the size of the sheet from code. Thank you[/img]
Thank you very much! It works!
It is very interesting because I tried the following previously, but it didn't work (I set to poLandscape after PaperHeight)- it seems that the order matters! Thank you again! [img]style_emoticons/<#EMO_DIR#>/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> Page.PaperSize := DMPAPER_USER; Page.PaperWidth := 162; Page.PaperHeight := 114; Page.Orientation := poLandscape;[/img]