Results 1 to 6 of 6

Thread: print .pdfs programmatically

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Norwich, UK
    Posts
    405

    print .pdfs programmatically

    Just started a new porject that will involve automating the print of .pdf files

    I've just tried using this:

    NET USE LPT3: "\\box\printername"
    TYPE "\\T095118.pdf" > LPT3:
    NET USE LPT3: /DELETE

    to print and it comes out with loads of gobbledgook.

    How can you (in vb or vb.net) do this? i've done a bit of googling and there seems to be a lot of components out there that cost loads of money. are there any free/open source ones?

    Any help or pointers ill be much appreciated.

  2. #2
    Frenzied Member litlewiki's Avatar
    Join Date
    Dec 2005
    Location
    Zeta Reticuli Distro:Ubuntu Fiesty
    Posts
    1,162

    Re: print .pdfs programmatically

    goto www.neevia.com they have a good collection of pdf conversion tools and also sample codes in all major languages

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: print .pdfs programmatically

    Try something like this
    VB Code:
    1. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _
    2. ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, _
    3. ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    4.  
    5. Private Sub Command1_Click()
    6. Dim PrintIt As Long
    7. PrintIt = ShellExecute(Me.hwnd, "PRINT", "C:\My Documents\TimeSheet.pdf", "", "", -1)
    8. End Sub

  4. #4
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729
    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


  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Norwich, UK
    Posts
    405

    Re: print .pdfs programmatically

    Thanks a lot for the replies.

    Hack, how would i go about rewriting your approach for vb.net?

    also should it work if i want to print multiple pdf's as i tried adding a second shellexecute line in and it only printed the first doc.

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: print .pdfs programmatically

    Quote Originally Posted by sagey
    Hack, how would i go about rewriting your approach for vb.net?
    Don't know
    Quote Originally Posted by sagey
    also should it work if i want to print multiple pdf's as i tried adding a second shellexecute line in and it only printed the first doc.
    Load all the file names into something like a listbox, and just loop through feeding the listbox entires to the ShellExecute API.

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