Jump to content


Photo

nxPreview


  • Please log in to reply
6 replies to this topic

#1 emailaya

emailaya

    Master Member

  • Members
  • PipPipPipPipPip
  • 984 posts

Posted 22 February 2008 - 07:28 PM

hi

in my app im printing the content of a RichEdit
i didnt understand how can i PrintPreview it using the nxPreview component
thanks

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,835 posts
  • Gender:Male

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
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.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 emailaya

emailaya

    Master Member

  • Members
  • PipPipPipPipPip
  • 984 posts

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?

#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,835 posts
  • Gender:Male

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
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.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 wvd_vegt

wvd_vegt

    Master Member

  • Honorable Members
  • PipPipPipPipPip
  • 710 posts
  • Gender:Male
  • Location:the Netherlands

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:

CODE
  NxPreview1.BeginDoc;
  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 emailaya

emailaya

    Master Member

  • Members
  • PipPipPipPipPip
  • 984 posts

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

#7 wvd_vegt

wvd_vegt

    Master Member

  • Honorable Members
  • PipPipPipPipPip
  • 710 posts
  • Gender:Male
  • Location:the Netherlands

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.
G.W. van der Vegt




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users