English
Forum

RTF and Print out

 
- Page 1 -



Thomas
Freier
found I had of Andreas:
CompileMarkSeparation
 $I Profalt.inc
'################################
'Drucken mit dem Richedit-Control
'################################
DEF StartDoc(2)      ! "gdi32","StartDocA"
DEF StartPage(1)     ! "gdi32","StartPage"
DEF EndPage(1)       ! "gdi32","EndPage"
DEF EndDoc(1)        ! "gdi32","EndDoc"
DEF CreateDC(4)      ! "gdi32","CreateDCA"
DEF DeleteDC(1)      ! "gdi32","DeleteDC"
DEF GetDeviceCaps(2) ! "gdi32","GetDeviceCaps"
DEF PrintDlg(1)      ! "comdlg32","PrintDlgA"
Declare Richedit&,RichDLL&,Ende&,Print&,Exit&,FileName$,Driver$,Printer$
Declare Horzres&,Vertres&,PixelsX&,PixelsY&,iWidthTwips&,iHeightTwips&
Declare iTextOut&,iTextLength&,DocName$
Declare PrinterDC&
Declare FormatRange#,PrintDLG#,cRect#
Declare DocInfo#
Dim FormatRange#,48
Dim DocInfo#,12
Clear DocInfo#
Dim PrintDLG#,66
Clear PrintDLG#
Dim cRect#,16
SetTrueColor 1
Window 0,0-640,480
CLS RGB(196,196,196)
Print& = CreateButton(%hwnd,"Drucken",500,40,80,24)
Exit& = CreateButton(%hwnd,"Ende",500,70,80,24)
RichEdit& = Create("RichEdit",%hwnd,"",0,2,460,430)
FileName$ = LoadFile$("Als RTF öffnen","*.RTF")

If FileName$ <> ""

    RTF("LoadRTF",Richedit&,Filename$)

EndIf

DocName$ = "Profan-RTFPrinter"

Whilenot Ende&

    Waitinput

    If GetFocus(Exit&)

        Ende& = 1

    ElseIf GetFocus(Print&)

        Long PrintDLG#,0  = 66
        Long PrintDLG#,4  = %hwnd
        Long PrintDLG#,20 = $0140'PD_RETURNDC,PD_PRINTSETUP
        PrintDlg(PrintDLG#)
        PrinterDC& = Long(PrintDLG#,16)

        If PrinterDC&

            HorzRes& = GetDeviceCaps(PrinterDC&,8)
            VertRes& = GetDeviceCaps(PrinterDC&,10)
            PixelsX& = GetDeviceCaps(PrinterDC&,88)
            PixelsY& = GetDeviceCaps(PrinterDC&,90)
            iWidthTwips& = Int((HorzRes&/PixelsX&))*1440
            iHeightTwips& = Int((VertRes&/PixelsY&))*1440
            Long cRect#,0 = 0
            Long cRect#,4 = 0
            Long cRect#,8 = iWidthTwips&
            Long cRect#,12 = iHeightTwips&
            Long DocInfo#,0 = 12
            Long DocInfo#,4 = ADDR(Docname$)
            Long FormatRange#,0 = PrinterDC&'HDC
            Long FormatRange#,4 = PrinterDC&'TargetHDC
            Long FormatRange#,8 = 0'linker Rand in Twips
            Long FormatRange#,12 = 0'oberer Rand in Twips
            Long FormatRange#,16 = iWidthTwips&'rechter Rand in Twips
            Long FormatRange#,20 = iHeightTwips&'unterer Rand in Twips
            Long FormatRange#,24 = 0'linker Rand in Twips
            Long FormatRange#,28 = 0'oberer Rand in Twips
            Long FormatRange#,32 = iWidthTwips&'rechter Rand in Twips
            Long FormatRange#,36 = iHeightTwips&'unterer Rand in Twips
            Long FormatRange#,40 = 0'CharRange-MIN
            Long FormatRange#,44 = -1'CharRange MAX ( -1 = alles )
            iTextOut& = 0
            iTextLength& = SendMessage(RichEdit&, 14, 0, 0)- SendMessage(RichEdit&,186,0,0)
            StartDoc(PrinterDC&,DocInfo#)

            Whilenot OR(iTextOut& >= iTextLength&,itextOut& = -1)

                StartPage(PrinterDC&)
                Long FormatRange#,44 = -1
                iTextOut& = SendMessage(RichEdit&, 1081, 1, FormatRange#)
                Long FormatRange#,40 = iTextOut&
                SendMessage(RichEdit&,1075,0,cRect#)
                EndPage(PrinterDC&)

            Wend

            EndDoc(PrinterDC&)
            SendMessage(RichEdit&, 1081, 1, 0)

        Endif

    Endif

EndWhile

Dispose FormatRange#
Dispose DocInfo#
Dispose PrintDLG#
DeleteDCon>PrinterDC&)
End

unfortunately end the pressure to 3 pages. WordPad druckt everything. How geht's with XProfan?

2.867 kB
Hochgeladen:10/06/10
Downloadcounter89
Download
 
Gruß Thomas
Windows XP SP2, XProfan X2
10/06/10  
 



« this Posting watts as Solution marked. »


Uwe
''Pascal''
Niemeier
Hi Thomas!

apparently becomes from the FORMATRANGE-structure not only the To bedruckende area read, separate to the Print too the objectively genutzte area hinterlegt (or something like in the manner). therefore must the betroffene cut offed the structure each Schleifendurchlauf new equips go.

SeeYou
Pascal

6 kB
Version:2
Kurzbeschreibung: RTF print
Hochgeladen:10/26/10
Downloadcounter151
Download
 
10/26/10  
 



and by me (win7) attend The Images first not at all:



.

16 kB
Hochgeladen:10/06/10
Downloadcounter82
Download
 
10/06/10  
 




Thomas
Freier
Sorry! In my example I had The RTFHandling.pcu uses: [...] 
slopes The important pieces on and the geänderte Script:
CompileMarkSeparation
 $U RTFHandling.pcu = R_'TRF-PCU einbinden
 $U objects.pcu = R_
 $I Profalt.inc
'################################
'Drucken mit dem Richedit-Control
'################################
DEF StartDoc(2)      ! "gdi32","StartDocA"
DEF StartPage(1)     ! "gdi32","StartPage"
DEF EndPage(1)       ! "gdi32","EndPage"
DEF EndDoc(1)        ! "gdi32","EndDoc"
DEF CreateDC(4)      ! "gdi32","CreateDCA"
DEF DeleteDC(1)      ! "gdi32","DeleteDC"
DEF GetDeviceCaps(2) ! "gdi32","GetDeviceCaps"
DEF PrintDlg(1)      ! "comdlg32","PrintDlgA"
Declare Richedit&,RichDLL&,Ende&,Print&,Exit&,FileName$,Driver$,Printer$,Print_PCU&
Declare Horzres&,Vertres&,PixelsX&,PixelsY&,iWidthTwips&,iHeightTwips&
Declare iTextOut&,iTextLength&,DocName$
Declare PrinterDC&
Declare FormatRange#,PrintDLG#,cRect#
Declare DocInfo#
Dim FormatRange#,48
Dim DocInfo#,12
Clear DocInfo#
Dim PrintDLG#,66
Clear PrintDLG#
Dim cRect#,16
SetTrueColor 1
Window 0,0-1040,480
CLS RGB(196,196,196)
Print_PCU& = CreateButton(%hwnd,"Druck PCU",900,40,120,24)
Print& = CreateButton(%hwnd,"Druck direkt",900,80,120,24)
Exit& = CreateButton(%hwnd,"Ende",900,120,120,24)
Declare rtf_dll&,rtf_hdc&
rtf_dll& =  R_INTITFORCREATERTF()'DLL laden mit PCU
RichEdit& = R_CREATERICHEDIT(%hWnd,"",0,0,810,420)' Richedit erstellen mit PCU
rtf_hdc& = R_PREPAREFORLINEBREAK(RichEdit&)' Device Context erzeugen mit PCU
R_Init_object(RichEdit&)'Zum Bildempfang vorbereiten
FileName$ = R_RTFLOAD(RichEdit&)
DocName$ = "Profan-RTFPrinter"

Whilenot Ende&

    Waitinput

    If GetFocus(Exit&)

        Ende& = 1

    ElseIf GetFocus(Print_PCU&)

        R_RTFPrint(RichEdit&,0,0,0)' Print über die PCU

    ElseIf GetFocus(Print&)

        Long PrintDLG#,0  = 66
        Long PrintDLG#,4  = %hwnd
        Long PrintDLG#,20 = $0140'PD_RETURNDC,PD_PRINTSETUP
        PrintDlg(PrintDLG#)
        PrinterDC& = Long(PrintDLG#,16)

        If PrinterDC&

            HorzRes& = GetDeviceCaps(PrinterDC&,8)
            VertRes& = GetDeviceCaps(PrinterDC&,10)
            PixelsX& = GetDeviceCaps(PrinterDC&,88)
            PixelsY& = GetDeviceCaps(PrinterDC&,90)
            '     iWidthTwips& = Int((HorzRes&/PixelsX&))*1440 ' Original
            '     iHeightTwips& = Int((VertRes&/PixelsY&))*1440 ' Original
            iWidthTwips& = Int((HorzRes&/PixelsX&))*1450' geändert, nun ohne Umbruch in Zeile 1
            iHeightTwips& = Int((VertRes&/PixelsY&))*1240' geändert, nun alle Bilder gedruckt
            ' Bei weiteren Seiten werden dann allerdings nicht mehr alle gedruckt??
            Long cRect#,0 = 0
            Long cRect#,4 = 0
            Long cRect#,8 = iWidthTwips&
            Long cRect#,12 = iHeightTwips&
            Long DocInfo#,0 = 12
            Long DocInfo#,4 = ADDR(Docname$)
            Long FormatRange#,0 = PrinterDC&'HDC
            Long FormatRange#,4 = PrinterDC&'TargetHDC
            Long FormatRange#,8 = 0'linker Rand in Twips
            Long FormatRange#,12 = 0'oberer Rand in Twips
            Long FormatRange#,16 = iWidthTwips&'rechter Rand in Twips
            Long FormatRange#,20 = iHeightTwips&'unterer Rand in Twips
            Long FormatRange#,24 = 0'linker Rand in Twips
            Long FormatRange#,28 = 0'oberer Rand in Twips
            Long FormatRange#,32 = iWidthTwips&'rechter Rand in Twips
            Long FormatRange#,36 = iHeightTwips&'unterer Rand in Twips
            Long FormatRange#,40 = 0'CharRange-MIN
            Long FormatRange#,44 = -1'CharRange MAX ( -1 = alles )
            iTextOut& = 0
            iTextLength& = SendMessage(RichEdit&, 14, 0, 0)- SendMessage(RichEdit&,186,0,0)
            StartDoc(PrinterDC&,DocInfo#)

            Whilenot OR(iTextOut& >= iTextLength&,itextOut& = -1)

                StartPage(PrinterDC&)
                Long FormatRange#,44 = -1
                iTextOut& = SendMessage(RichEdit&, 1081, 1, FormatRange#)
                Long FormatRange#,40 = iTextOut&
                SendMessage(RichEdit&,1075,0,cRect#)
                EndPage(PrinterDC&)

            Wend

            EndDoc(PrinterDC&)
            SendMessage(RichEdit&, 1081, 1, 0)

        Endif

    Endif

EndWhile

R_DEINITRTF(RichEdit&,rtf_hdc&,rtf_dll&)'RTF-Aufräumen
R_DeInit_object()'RTF-Aufräumen
Dispose FormatRange#
Dispose DocInfo#
Dispose PrintDLG#
DeleteDC=s2>(PrinterDC&)
End

at that pressure be I something moreover, but not wiklich happy.
3 pages pattern without edge supra ok. ex 5 pages old Error.

63 kB
Hochgeladen:10/06/10
Downloadcounter98
Download
6 kB
Hochgeladen:10/06/10
Downloadcounter83
Download
54 kB
Hochgeladen:10/06/10
Downloadcounter96
Download
234 kB
Hochgeladen:10/06/10
Downloadcounter196
Download
 
Gruß Thomas
Windows XP SP2, XProfan X2
10/06/10  
 



for the rtfhandling.pcu could I The .def-File from the Originalpaket [...]  entnehmen, for objects.pcu have I but no found.

by me print both Options To T.Radke on 3 pages but not the word "Ende.".

Perhaps. ought to to the everything first on a (everywhere-same-) working Base reduce or vlt. lying the trouble end the Dokumentes. ^^

too ifs with the trouble "RTF-Ausdrucken" not plenty To do has so ists end vlt. plainer simply self To print or. self The pages/ Images To produce. ^^

let itself HTML plainer print?

1.254 kB
Hochgeladen:10/06/10
Downloadcounter138
Download
1.254 kB
Hochgeladen:10/06/10
Downloadcounter118
Download
 
10/06/10  
 




Thomas
Freier
resolve not The task, that the document moreover given go should, derjenige it even with Word or WordPad open and Edit can should. simply from the Program print isn't the trouble and it should still How with WordPad too over XProfan possible his.
Dieter becomes these Lines indeed reading and Perhaps after a Solution search.

Nachtrag: a 26 seitige RTF with reinem Text is free from problems To print.
 
Gruß Thomas
Windows XP SP2, XProfan X2
10/06/10  
 



Irgendwas Have I Schonmal found [...]  ^^
 
10/06/10  
 




Thomas
Freier
Jo! The Page [...]  have I already long as Lesezeichen in the Browser lying. can but only little for want of Programmier- and Englischkenntnissen verwerten.
with reinen Textseiten runs the pressure gesteuert over
CompileMarkSeparation
While 1

    StartPage(PrinterDC&)
    Long FormatRange#,44 = -1
    iTextOut& = SendMessage(RichEdit&, 1081, 1, FormatRange#)
    Long FormatRange#,40 = iTextOut&
    SendMessage(RichEdit&,1075,0,cRect#)
    EndPage(PrinterDC&)
    case (iTextOut& >=iTextLength&) OR (itextOut& = -1): Break

E
e
tidy ex.
has The RTF but only Images, is correct the Dokumentenende not any more. The pressure end already before.
with something Spielerei
CompileMarkSeparation
var x%=1

While 1

    StartPage(PrinterDC&)
    Long FormatRange#,44 = -1
    iTextOut& = SendMessage(RichEdit&, 1081, 1, FormatRange#)
    Long FormatRange#,40 = iTextOut&
    SendMessage(RichEdit&,1075,0,cRect#)
    EndPage(PrinterDC&)
    case (iTextOut& > (iTextLength&+x%)) OR (itextOut& = -1): Break' OR ((itextOut&+1) = -1)
    x%=x%+2

Wend

could I it so steer, that The To expected seven pages with pictures any ausgedruckt get. having but too with To hohem x% up to 12.000 additional Leerseiten.
 
Gruß Thomas
Windows XP SP2, XProfan X2
10/08/10  
 



And if You time PrinterDC too per Schleifendurchgang new beget?

Nachtrag: sooner balderdash there PrinterDC& = Long(PrintDLG#,16)
 
10/08/10  
 



I mean I Have what, must yet verifizzeln...
 
10/08/10  
 



withal absolutem chaos-Garbage do I you the on because the by me any pages druckt until end:

346 kB
Hochgeladen:10/08/10
Downloadcounter76
Download
4 kB
Hochgeladen:10/08/10
Downloadcounter75
Download
2.049 kB
Hochgeladen:10/08/10
Downloadcounter152
Download
 
10/08/10  
 




Thomas
Freier
in the momentum come I lest moreover. Erststart the Text99.exe with printer freePDF watts The 1. Page printed. as printer whom Epson select --> no reaction. as printer whom Destiller chosen --> no reaction. again freePDF chosen --> now too no reaction More. will be me on the evening The Text99.xprf distinguished and try To Druckergebnissen To come.
 
Gruß Thomas
Windows XP SP2, XProfan X2
10/08/10  
 



Ah one see I immediate - have at Übersetzen
CompileMarkSeparationhdc... should hdcc heissen.

4 kB
Hochgeladen:10/08/10
Downloadcounter92
Download
346 kB
Hochgeladen:10/08/10
Downloadcounter80
Download
 
10/08/10  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

17.069 Views

Untitledvor 0 min.
Uwe Lang02/18/24
H.Brill09/18/20
boh109/11/20
Alibre12/25/19
More...

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie