hi
in my app im printing the content of a RichEdit
i didnt understand how can i PrintPreview it using the nxPreview component
thanks
nxPreview
Started by emailaya, Feb 22 2008 07:28 PM
6 replies to this topic
#1
Posted 22 February 2008 - 07:28 PM
#2
Posted 22 February 2008 - 11:04 PM
Hello Emailaya,
I first recommend reading next tutorial:
http://www.bergsoft....;page=nxpreview
I am not sure that you will be able to do this automatically, but you probably may somehow transfer Canvas of RichEdit to the Canvas of NxPreview.
Best regards
I first recommend reading next tutorial:
http://www.bergsoft....;page=nxpreview
I am not sure that you will be able to do this automatically, but you probably may somehow transfer Canvas of RichEdit to the Canvas of NxPreview.
Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#3
Posted 22 February 2008 - 11:37 PM
i used this: http://www.delphifaq.../faq/f399.shtml
to generate a canvas out of the richedit
but when i did:
nxPrintPreview.MetaCanvas.Assign(Can.Canvas);
i got an error: cannot assign TBitmapCanvas to a TnxMetaFileCanvas.
so how can i do the "translation" between the 2 canvas types?
to generate a canvas out of the richedit
but when i did:
nxPrintPreview.MetaCanvas.Assign(Can.Canvas);
i got an error: cannot assign TBitmapCanvas to a TnxMetaFileCanvas.
so how can i do the "translation" between the 2 canvas types?
#4
Posted 22 February 2008 - 11:57 PM
Hello Emailaya,
I am not sure do you receive compile error or run-time error, but try to use typecasts.
You may also try to use CopyRect procedure of TCanvas to copy one rect from one canvas to the other canvas.
Best regards
I am not sure do you receive compile error or run-time error, but try to use typecasts.
You may also try to use CopyRect procedure of TCanvas to copy one rect from one canvas to the other canvas.
Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#5
Posted 25 February 2008 - 12:02 PM
Hi
basically you need to draw ontop the MetaCanvas, not assign it.
So simply try the following in the OnRender event:
You need to changed the Self.PixelsPerInch to the resolution of the resolution of the MetaCanvas.
You could also try to modify the RichEditToCanvas so it renders directly onto the NxPreview's MetaCanvas.
basically you need to draw ontop the MetaCanvas, not assign it.
So simply try the following in the OnRender event:
CODE
NxPreview1.BeginDoc;
RichEditToCanvas(RichEdit1, Image1.Canvas, Self.PixelsPerInch);
NxPreview1.MetaCanvas.Draw(NxPreview1.Body.Left, NxPreview1.Body.Top, Image1.Picture.Graphic);
NxPreview1.EndDoc;
RichEditToCanvas(RichEdit1, Image1.Canvas, Self.PixelsPerInch);
NxPreview1.MetaCanvas.Draw(NxPreview1.Body.Left, NxPreview1.Body.Top, Image1.Picture.Graphic);
NxPreview1.EndDoc;
You need to changed the Self.PixelsPerInch to the resolution of the resolution of the MetaCanvas.
You could also try to modify the RichEditToCanvas so it renders directly onto the NxPreview's MetaCanvas.
G.W. van der Vegt
#6
Posted 25 February 2008 - 01:26 PM
hi
thank you for your suggestions
2 things:
1) apparently, richedittocanvas always gave me a blank (white) result
2) soon i will use a different text editor
so i decided to leave it for now and handle it with the new text editor that might be easier to handle
thank you for your suggestions
2 things:
1) apparently, richedittocanvas always gave me a blank (white) result
2) soon i will use a different text editor
so i decided to leave it for now and handle it with the new text editor that might be easier to handle
#7
Posted 25 February 2008 - 03:24 PM
[Hi
Did some further testing and if i combine all and draw directly onto the metacanvas i only see the first line of the RichEdit. Perhaps if you see a white blank bitmap it's because you don't have a non-blank first line.
Did some further testing and if i combine all and draw directly onto the metacanvas i only see the first line of the RichEdit. Perhaps if you see a white blank bitmap it's because you don't have a non-blank first line.
G.W. van der Vegt
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users