printpagestatus (OpenInsight 32-bit)
At 26 JUL 2012 08:17:31AM John Grant wrote:
I am printing a letter using OIPI. First I place a template BMP (this is a scanned picture of a business letterhead with a heading and names of people down the left margin. I then print text contained a TEXT variable within reduced margins like 3, 1.5, 1 , 2
If the text exceeds the lower print margin, the printing continues on a new page. This new page, however does not have the BMP template and therefore I want to print the remaining text within new margins - like 1, 1, 1, 1
This could all be done if the functions PrintPageStatus() would sense that 0 lines remained on page 1 and then PrintNewPage() would start a new page new PrintSetMargins().
Can PringPageStatus() work when the text is a variable?
Here is a snipit of my code…
* Create the fonts for the OIPI report
* 18 point Arial font with left justified, bold
Font1 = "Arial":@fm:18:@fm:"L":@fm:0:@fm:0:@fm:0:@fm:0
* 12 point Times New Roman with left justified
Font2 = "Times New Roman":@fm:12:@fm:"L":@fm:1:@fm:0:@fm:0:@fm:0
* 14 point Times New Roman with left justified
Font3 = "Times New Roman":@fm:14
*Start the OIPI report with the INIT message
FileName = "Patient Profile"
PrintTitle = ""
PreviewTitle = "" ;* Change the title of the print preview window
Orientation = 0
PrintSetup = ""
PrintSetup<1, 1> = 5 ;* Print Preview at a specific location - defined In PrintSetup <3>, <4>, <5> & <6>
PrintSetup<1, 2> = 2 ;* Hide the PrintSetup button
PrintSetup<2> = -1 ;* Set initial zoom to PageWidth
PrintSetup<3> = 5 ;* Set the Print Preview position at 5% from top and left
PrintSetup<4> = 5
PrintSetup<5> = 95
PrintSetup<6> = 95
PATH1 = DRIVE()
PATHLETTER = Field(PATH1,"\",1,1)
Begin Case
Case PATH1 = PATHLETTER:"\REVSOFT\OINSIGHT"
Swap "REVSOFT\OINSIGHT" With "REVSOFT\" In PATH1CASE PATH1 = PATHLETTER:"\REVSOFT\REVSOFT\OINSIGHT"
Swap "REVSOFT\REVSOFT\OINSIGHT" With "REVSOFT\REVSOFT\" In PATH1End CASE
SWAP ";" WITH @FM IN MARGINS
OFFICEVAR = XLATE('BOLDPARAMETERS','BOLD','LOCLETTERTEMPLATE','X')
OFFICEVAR = PATH1:OFFICEVAR
*OFFICEVAR = "C:\Revsoft Stony Brook\Templates\OFFICELETTER.BMP"
HOSPVAR = XLATE('BOLDPARAMETERS','BOLD','HOSPTEMPLATE','X')
HOSPVAR = PATH1:HOSPVAR
SUBCODE = 'SELECTPRINTVIEW'
CALL @SUBCODE
IF @USER1 = 3 THEN
RETURN 0
END
IF @USER1 = 1 THEN
status = Set_Printer("INIT", FileName, PrintTitle:@fm:PreviewTitle, 3:@FM:1.5:@FM:1:@FM:2, Orientation, 0)
END ELSE
status = Set_Printer("INIT", FileName, PrintTitle:@fm:PreviewTitle, 3:@FM:1.5:@FM:1:@FM:2, Orientation, 3)
END
@USER1 = ''
If status < 1 Then
*Always check the return value of the INIT message for errors
ErrorMsg = "Fatal error with the INIT message"
Goto fatalExit
End
If Set_Printer("FONT", Font1) < 0 Then
ErrorMsg = "Error with the FONT message"
Goto fatalExit
End
If Set_Printer("FONT", Font2) < 0 Then
ErrorMsg = "Error with the FONT message"
Goto fatalExit
End
TEXT = TODAY:CRLF
TEXT:= REFMDSTREETVAR:CRLF
TEXT:= REFMDADDRESSVAR:CRLF:CRLF
TEXT:= "Re: ":FULLNAME:CRLF:"MRN: ":HXVAR:CRLF:"DOS: ":DATEORVAR:CRLF:CRLF
TEXT:= "Dr. ":REFMDVAR:',':CRLF:CRLF
TEXT:= "We thank you for referring ":MRMSVAR:" ":NAMEVAR:" for weight loss surgery. I had the pleasure of seeing ":HERHIM:" in clinic "
TEXT:= "today. I have attached a copy of my clinic note for details about my assessment and plan. In short:":CRLF:CRLF
TEXT:= CAPHISHERVAR:" initial medications were: ":ORIGMEDSVAR:CRLF:CRLF
TEXT:= CAPSHEHEVAR:" is being evaluated for ":TYPEORSURGVAR:" and will continue preoperative testing.":CRLF:CRLF
TEXT:= "Thank you for allowing us to participate in this patient's care. Should any questions arise relative to ":HISHERVAR:" management "
TEXT:= "during the intervening period of time, please do not hesitate to contact me. ":CRLF:CRLF
TEXT:= "Sincerely,":CRLF:CRLF:CRLF
TEXT:= CLINICMD:CRLF
MDSHORT = CLINICMD[1,12]
If MDSHORT = 'Aurora Pryor' THEN
TEXT:= "Professor and Chief":CRLF:"Division of General Surgery":CRLF:"ADP/cf"
END
x = Set_Printer("BMP", OFFICEVAR, -3.1:@FM:-1.25:@FM:8.75:@FM:10.5, 0, 0)
if x < 0 then
x = msg("", "BMP Error")end
x = Set_Printer("TEXT", text)
if Set_Printer("FONT", Font2) < 0 Then
ErrorMsg = "Error with the FONT message"
Goto fatalExit
End
* Force a page break
if Set_Printer("PAGEBREAK") < 0 then
ErrorMsg = "Error with the PAGEBREAK message"
goto fatalExit
End
* End the report
x = Set_Printer("TERM")
Return
At 26 JUL 2012 08:50AM Dave Harmacek wrote:
set PicLocation for your background.
Place the Set_Printer( 'BMP'…) at the top of printing.
argument PicRepeat should be 1 = repeat every page
foo = Set_Printer("BMP", OFFICEVAR, PicLocation, PicNoScale, PicRepeat)
Dave Harmacek
Harmacek Database Systems
At 26 JUL 2012 09:24AM John Grant wrote:
Thanks Dave, however I want the BMP to print ONLY on the first page, not every page. Only the remaining unprinted text should be on the next blank pages…
At 26 JUL 2012 12:27PM Dave Harmacek wrote:
Sorry, I didn't clearly read your requirements.
I believe you will have to print line each separately and determine when a newpage is
about to occur, then change margins.
Dave Harmacek
Harmacek Database Systems
At 27 JUL 2012 10:27AM John Grant wrote:
Ok, I have determined when I want a page break and what text remains after the break. However, when I change the margins after the page break, it changes the margins for the text on the first page as well. Here is my attempt at code:
stat = Set_Printer("MARGIN", 3:@fm:1.5:@fm:1:@fm:1)
X = Set_Printer("TEXT",FIRSTTEXT)
stat = Set_Printer("PAGEBREAK")
stat = Set_Printer("MARGIN", 1:@fm:1:@fm:1:@fm:1)
X = Set_Printer("TEXT",SECONDTEXT)
* End the report
x = Set_Printer("TERM")
At 29 JUL 2012 03:51AM Barry Stevens wrote:
I think PrintPageStatus() can only be used when usint 'print' command
try:
stat = Set_Printer("PAGEBREAK")
X = Set_Printer("TEXT",SECONDTEXT)
stat = Set_Printer("MARGIN", 1:@fm:1:@fm:1:@fm:1)
At 06 AUG 2012 08:52AM Barry Hausner wrote:
John,
I frequently need to know where the "printhead" is on a page for the forms that I create. I use the following code snippet below to determine this. Perhaps you can incorporate this approach and execute your "PAGEBREAK" and "MARGIN" commands if y_pos is greater than your lower margin position. Just a thought. Let me know if this is of any assistance to you.Barry HausnerGet_Printer_Y:
y_pos=Get_Printer("POS")
y_pos=y_pos<2> ;* get the current printhead y coordinate
Return