Results 1 to 9 of 9

Thread: Print 1st page of PDF

  1. #1

    Thread Starter
    Hyperactive Member johnweidauer's Avatar
    Join Date
    Sep 2002
    Location
    SLC, UT
    Posts
    314

    Resolved Print 1st page of PDF

    How do I Print the 1st page of a PDF? I currently use:
    VB Code:
    1. ShellExecute(hDesktop, "Print", "somefilename.pdf", vbNullString, "C:\",0)
    but it prints it all when I just want the first page.

    thanks

    ---edit---

    the program used Crystal Report Application server, so i just used the export feature to word and used the word application object to print page 1, but thanks for all of the interest.
    Last edited by johnweidauer; Jan 27th, 2006 at 02:55 AM. Reason: not enough description
    To the world you may just be one person, but to this one person, you just might be the world.

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Print 1st page of PDF

    If you have the Acrobat Reader then you could use the Acrobat Control for ActiveX. Put it on a Form and then call the LoadFile method followed by the PrintPages method.

  3. #3
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Print 1st page of PDF

    From some Google searches I've found that, Adobe doesn't support/approve using Acrobat Reader OCX in our projects.
    It is there only to display pdf in IE.

    Make sure it is leagal, if it is a commercial project or you want to distribute your project (even for free).
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Print 1st page of PDF

    Try PDFCreator. It is programmable for saving files. It might be good at printing files as well.

  5. #5
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Print 1st page of PDF

    Quote Originally Posted by iPrank
    From some Google searches I've found that, Adobe doesn't support/approve using Acrobat Reader OCX in our projects.
    It is there only to display pdf in IE.
    That was the most stupid thing I ever heard. In that case it would be legal to display it using the webbrowser control.

  6. #6
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Print 1st page of PDF

    Yep. That would be legal, but we'll need extra work.

    Anyway, I found some needed info in PowerBasic forum. But for some reason the original poster has deleted all his threads on January 7th. Here is the Google cache:

    http://72.14.203.104/search?q=cache:...n&ct=clnk&cd=1

    In that page he said,
    Quote Originally Posted by Chuck Hicks of PowerBasic Forum
    The wait is over. It's now officially legal to embed Adobe Reader
    (ver 7) in your applications. Here's the link to Adobe IAC
    reference:
    http://partners.adobe.com/public/dev...CReference.pdf

    You can use the AxAcroPDFLib.AxAcroPDF object and its methods.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  7. #7
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Print 1st page of PDF

    Something like this should work:
    VB Code:
    1. Private Sub Command1_Click()
    2.     AcroPDF1.LoadFile "C:\MyPDFFile.pdf" 'Load a file
    3.     AcroPDF1.printPages 1, 1 'Print first page
    4. End Sub
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  8. #8
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Print 1st page of PDF

    Quote Originally Posted by iPrank
    Something like this should work:
    VB Code:
    1. Private Sub Command1_Click()
    2.     AcroPDF1.LoadFile "C:\MyPDFFile.pdf" 'Load a file
    3.     AcroPDF1.printPages 1, 1 'Print first page
    4. End Sub
    Which is exactly what I suggested in my origional post

  9. #9
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Print 1st page of PDF

    Yes. That was your idea.

    Anyway, johnweidauer has sloved his problem in other way. But I have found the new lincensing info when searching for him. Thanks to both of you.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width