[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How do I Print a picture on a form to a PDF file?

Posted on 1999-01-05
8
Medium Priority
?
283 Views
Last Modified: 2010-05-03
I have several graphs on a form.  This form needs to be saved as a PDF (Adobe Acrobat) file.  There are several such forms.  I can print using the printform command but it prompts to save each form under a different name.  Therefore, this is not a viable option.

Any help greatly appreciated!!
0
Comment
Question by:Chess
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 4

Expert Comment

by:chabaud
ID: 1454054
Using PrintForm, when printing is complete, PrintForm calls the EndDoc method to clear the printer.
So you have a print job for each form.

So you have to use the Printer Object.

You can use the Printer.PaintPicture function which only print bmp, wmf, or ico FILES.

Or you can use Printer.hDC and API functions.

Just a question: what do you call graphs on forms ? Do you use MsGraph, PictureBox, form background or any other OCX ?
0
 

Expert Comment

by:DPickering
ID: 1454055
I'm pretty sure you can't just create PDF files without having the proper Acrobat application to do this. I've heard that this Acrobat app will convert Office files (ie Powerpoint, Word, etc) plus numerous other DTP/Graphic files to PDF files, but I don't know whether you can just print a VB Form to a PDF. I'd suggest going to
http://www.adobe.com/prodindex/acrobat/prodinfo.html
for more info. This option is going to cost you however :)

Cheers
Dave
0
 
LVL 4

Expert Comment

by:chabaud
ID: 1454056
I suppose that you are using the PDFwriter printer driver...
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Expert Comment

by:fujicast
ID: 1454057
I've an experience on it.

1. Create a postscript printer driver. Make the target destination port into file.
2. Make sure you've install Adobe Acrobat with Adobe Acrobat Distriller and it's active.
3. Use whatever code you want to print into that POSTSCRIPT Printer.
4. The step no. 3 will generate a postscript file. Use name statement to rename it to whatever.ps
5. Once you've got the postscript file, use Windows API WinOpenFile to open it. (Execute whatever.ps)
6. The step no. 5 will activate the Adobe Distiller and generate PDF file.

I think this is just an automatization of the steps that what we're doing if we want to print something to PDF.

If I've a time, I'll create a sample for you.

Regards,
Fuji
0
 
LVL 1

Author Comment

by:Chess
ID: 1454058
The graphs have been created using First Impression, a third party product. And yes, I am using the PDFWriter Printer Driver.

I take a snapshot of the form and put the contents into a Picture Box Control (which is invisible).  Exporting its contents to a PDF file (given that I have over 100 such forms and need to export them to one file) is challenging.
0
 
LVL 4

Accepted Solution

by:
chabaud earned 400 total points
ID: 1454059
If you already have your pictures in a PictureBox, you can use the function Printer.PaintPicture to print them all in one PDF.
Try this sample. I have put in a form one commandbutton and two picturebox.

Option Explicit

Private Sub Command1_Click()

    'Select the PdfWriter...
    Dim p As Printer
    For Each p In Printers
        If Left(p.DeviceName, 17) = "Acrobat PDFWriter" Then
            Set Printer = p
            Exit For
        End If
    Next

    'Load pictures
    Picture1.Picture = LoadPicture("myphoto.jpg")
    Picture2.Picture = LoadPicture("mysister.jpg")

    'Start to print the picture box content

    Printer.PaintPicture Picture1.Picture, 0, 0
    Printer.NewPage
    Printer.PaintPicture Picture2.Picture, 0, 0
    Printer.EndDoc
   
End Sub

0
 
LVL 1

Author Comment

by:Chess
ID: 1454060
You are good!  I got it to work on the first shot.  Many, many thanks.

Chess
0
 
LVL 14

Expert Comment

by:waty
ID: 2331804

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question