Printer metafile

Printer metafile

Postby Otto » Thu Nov 29, 2007 11:23 am

I need a one to one copy.
Is it possible to print from one preview a original and a copy and to mark the copy with a watermark or a text as copy I mean can you add text or graphics to the metafile.

For example:
I print an invoice the preview remains on the screen. Then the
invoice get paid. On the copy I would like to have the way how it is paid (cash, Card, …).
But I wouldn’t like to recreate the metafile I would like to add this to the original so that I am sure it is the same.


Regards,
Otto
Last edited by Otto on Thu Nov 29, 2007 6:27 pm, edited 3 times in total.
User avatar
Otto
 
Posts: 6033
Joined: Fri Oct 07, 2005 7:07 pm

Postby Silvio » Thu Nov 29, 2007 11:27 am

yes you must load a bitmaps on the metafile
there is an sample on \sample\reports
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Otto » Thu Nov 29, 2007 11:28 am

Thanks Silvio could you tell me which one.
User avatar
Otto
 
Posts: 6033
Joined: Fri Oct 07, 2005 7:07 pm

Postby Silvio » Thu Nov 29, 2007 11:37 am

ACTIVATE REPORT oReport ON STARTGROUP oReport:NewLine() ;
ON STARTPAGE StartPage()

STATIC Function StartPage()

oReport:Box(0.1, ;
0.1, ;
oReport:PhyHeight()-0.1, ;
oReport:PhyWidth() -0.1 )

oReport:Line(0.9, 0.55, 2, 0.55, 2 )
oReport:Line(0.55, 0.9, 0.55, 2, 2 )
oReport:SayBitmap(3,2,"CONFIDEN.BMP",4,4)

RETURN NIL


you must create this CONFIDEN.BMP gray effect and rotate it
and you can create the effect watermark
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Otto » Thu Nov 29, 2007 12:46 pm

Thank you, Silvio. But this way you have the bmp on the original and on the copy.
What I would like is only on the copy.
Regards,
Otto
User avatar
Otto
 
Posts: 6033
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Thu Nov 29, 2007 1:40 pm

Otto,

You could paint the watermark and before ending the page, print the metafile on top of it. I haven't tried it myself, but maybe it works
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41344
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Otto » Thu Nov 29, 2007 3:22 pm

Hello Antonio,

I found this description on google.

But I think this is by fare to complicated.

What I saw by searching our forum (http://fivetechsoft.com/forums/viewtopi ... t=metafile)is a thread where you show the import and export to clipboard from metafiles.
Do you think one could export a metafile to clipboard and then save as bmp to memory add a transparent bmp – but how? - and re-import the bmp
to clipboard and then back to metafile.

Regards,
Otto

Windows GDI
Editing an Enhanced Metafile
To edit a picture stored in an enhanced metafile, an application must perform the tasks described in the following procedure.
To edit a picture stored in an enhanced metafile
1. Use hit-testing to capture the cursor coordinates and retrieve the position of the object (line, arc, rectangle, ellipse, polygon, or irregular shape) that the user wants to alter.
2. Convert these coordinates to logical (or world) units.
3. Call the EnumEnhMetaFile function and examine each metafile record.
4. Determine whether a given record corresponds to a GDI drawing function.
5. If it does, determine whether the coordinates stored in the record correspond to the line, arc, ellipse, or other graphics element that intersects the coordinates specified by the user.
6. Upon finding the record that corresponds to the output that the user wants to alter, erase the object on the screen that corresponds to the original record.
7. Delete the corresponding record from the metafile, saving a pointer to its location.
8. Permit the user to redraw or replace the object.
9. Convert the GDI functions used to draw the new object into one or more enhanced-metafile records.
10. Store these records in the enhanced metafile.
User avatar
Otto
 
Posts: 6033
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Thu Nov 29, 2007 4:15 pm

Otto,

The modification of a metafile file is very complicated task thats why we should avoid that way.

If you review Class TMetaFile Method Paint() you will see a call to PlayEnhMetaFile( ::hDC, ::hMeta, ::hWnd, .f. ). You could paint the bitmap on the ::hDC just after that function call:

PlayEnhMetaFile( ::hDC, ::hMeta, ::hWnd, .f. )
Eval( ::Cargo, ::hDC, Self ) // Use cargo or add a new DATA to the class

where ::Cargo may contain:
{ | hDC | If( lWaterMark, PalBmpDraw( hDC, nRow, nCol, oBitmap:hBitmap, oBitmap:hPalette, nWidth, nHeight ),) }
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41344
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Thu Nov 29, 2007 4:30 pm

Otto,

The same way you could search for PlayEnhMetaFile() call in source\classes\rpreview.prg and place an optional call there to paint the bitmap after that function call
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41344
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Otto » Thu Nov 29, 2007 6:22 pm

Thank you, Antonio. All works perfectly.
Here you see the preview= original and the CC made from 1 metafile.

Image
Image[/img]
User avatar
Otto
 
Posts: 6033
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Thu Nov 29, 2007 7:24 pm

Otto,

Excellent :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41344
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Otto » Thu Nov 29, 2007 8:01 pm

Antonio, what would be the syntax to send text
oPrn? but how with hDC?
Thanks in advance
Otto
User avatar
Otto
 
Posts: 6033
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Thu Nov 29, 2007 8:55 pm

Otto,

oPrn:Say( nRow, nCol, cText, oFont, nWidth, nClrText, nBkMode, nPad )

There is also a method CmSay() and InchSay()
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41344
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Otto » Thu Nov 29, 2007 10:13 pm

Thank you. If I use printer-class it does not work.
What I find out is that printer-class uses GetPrintDC( GetActiveWindow()...
but the function TextOut works.

TextOut( oDevice:hDC, 100, 100,"Does work , horizontal printing" )

Now I can do what I wanted - the real CC.
User avatar
Otto
 
Posts: 6033
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 12 guests

cron