Export form to JPG file at run-time with VB6 
Author Message
 Export form to JPG file at run-time with VB6

Hi there,

I'm using VB6 and I would like to dynamically create personalised
certificates (JPG file) for my users. These certificates should all
have the same background, logos, text, ... except for some labels:
name, address, date of birth of user.

My idea was to have a form with a form (background) picture, images,
fixed labels and a couple of labels which I update with current user
data (Label1.Caption = ...).
Then, I want to export the entire form (form picture, images, labels)
to a JPG file. Does anyone have an idea how I can do that?

Any help will be appreciated very much.
Thanks in advance.

Kind regards,
Tommy Dhondt



Tue, 15 Feb 2005 15:42:10 GMT  
 Export form to JPG file at run-time with VB6

Quote:
> I'm using VB6 and I would like to dynamically create personalised
> certificates (JPG file) for my users. These certificates should all
> have the same background, logos, text, ... except for some labels:
> name, address, date of birth of user.

> My idea was to have a form with a form (background) picture, images,
> fixed labels and a couple of labels which I update with current user
> data (Label1.Caption = ...).
> Then, I want to export the entire form (form picture, images, labels)
> to a JPG file. Does anyone have an idea how I can do that?

Rather than using the controls simply use the Win32 API drawing routines (Or
even the basic VB drawing methods) and draw onto a picture box control.  The
basic introduction to graphics programming in VB tutorial on my site will
get you up to speed with anything you need to know there, also the APIDraw
library will simplify drawing for you.
Once you have the image you can save it out to a .BMP file using the
SavePicture() method and converting to a JPG afterwards in a third party
application or you can have a go yourself by using one of the JPEG libraries
about such as Intel's IPP or the IJG dll.
Hope this helps,

    Mike

 -- EDais --

 - Microsoft Visual Basic MVP -
WWW: Http://EDais.earlsoft.co.uk/




Tue, 15 Feb 2005 16:00:31 GMT  
 Export form to JPG file at run-time with VB6


Quote:
>Then, I want to export the entire form (form picture, images, labels)
>to a JPG file. Does anyone have an idea how I can do that?

See my post in winapi.graphics.

--
Richard Mason



Tue, 15 Feb 2005 19:41:04 GMT  
 Export form to JPG file at run-time with VB6
Hi Richard,

I've looked for your post (regarding form export to JPG) in
"microsoft.public.vb.winapi.graphics", but I haven't found it.

Can you please tell me where I can find it / what the subject is?
Thanks.

Best regards,
Tommy

Quote:



> >Then, I want to export the entire form (form picture, images, labels)
> >to a JPG file. Does anyone have an idea how I can do that?

> See my post in winapi.graphics.



Sat, 19 Feb 2005 14:31:42 GMT  
 Export form to JPG file at run-time with VB6


Quote:
>I've looked for your post (regarding form export to JPG) in
>"microsoft.public.vb.winapi.graphics", but I haven't found it.

Got my knickers in a twist there. Think I meant the "Scale down a jpg"
in .discussion

To go to your question there is an MS Article Q161299
"HOWTO: Capture and Print the Screen, a Form, or any Window" that shows
how to capture an image of Form to a PictureBox. Strip out stuff you
don't need, and you wouldn't need the PictureBox:

So for the line:
  Set Picture1.Picture = CaptureForm(...) 'Your form name

You could use
 Dim MyFormPicture As stdPicture
 Set MyFormPicture = CaptureForm(...)
 PrintPictureToFitPage Printer, MyFormPicture
 Printer.EndDoc

For saving to jpeg the options are:

1.
The free Intel jpeg library has been withdrawn and Intel now sell the
IPP package (Integrated Performance Primitives) but if you already have
the Intel jpeg library there is nothing that I see in the license that
prevents one from continuing to use it.

2.
There is a FreeImage app. If you go to www.6ixsoft.com and follow the
links you'll get to a page where somebody has already done all the work
required to call the FreeImage dll from VB.

3.
Use GDIPlus. Enormous learning curve so not really practical.

4.
Bite the bullet and buy a 3rd part tool.

--
Richard Mason



Sat, 19 Feb 2005 17:32:27 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Open files .bmp, .jpg, .dwg with vb during run time

2. Converting bmp file to gif/jpg at run time

3. how do draw vb6 type graphics on a form (design time not runtime)

4. Exporting a FORM to a PDF or JPG ?

5. VB6 Run Times Files

6. Required Files: Required Run-time libraries for VB6

7. Export Visio pages to Jpg files

8. Run-time error '31037': Error load form file

9. Creating forms at run time, not design time.

10. CR Export crashes VB app at run-time

11. Export problem at run-time

12. Problems exporting a report with textboxes set at run-time

 

 
Powered by phpBB® Forum Software