943,944 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Jan 18th, 2005
0

Using VB Code - Silent download pdf from server and print to local printer

Expand Post »
Hi All

I have a requirement to develop a VB application to download a pdf file from a server using an example URL
http://xxxxxxxxxxxxx/pdffiles/yyyyy.pdf.

I need to perform a silent download and print the same to the local printer. As this is going to be a scheduled task, I need to perform a silent download and print.

Please help me if any pointers to the above.

Thanks in advance
Praveen
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pepsoft239 is offline Offline
5 posts
since Jan 2005
Jan 18th, 2005
0

Re: Using VB Code - Silent download pdf from server and print to local printer

Use the Microsoft Internet Transfer control.... You Pass it the URL, and tell it what you want to do with it, and it will do it. You can then save the information to a file, of the same name, or with a temporary name, and then do your printing. HOW exactly to print the PDF file from a VB App is going to be the hard part. The only method I know of, is really (Really) Tacky.
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
Jan 19th, 2005
0

Re: Using VB Code - Silent download pdf from server and print to local printer

Hi Comatose

Thanks for the reply.

I was able to obtain some VB code for printing a PDF file to default printer using a local VB application.

My hard part is for downloading the PDF file from Server. If you can give me more details on getting this done with Internet Transfer Protocol, it would be really great.

Can you give me some pointers on how to do the same? If possible, some hyperlinks etc?

Thanks a lot for the response.
Praveen
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pepsoft239 is offline Offline
5 posts
since Jan 2005
Jan 19th, 2005
0

Re: Using VB Code - Silent download pdf from server and print to local printer

Well,

It would go a little something like this:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim strURL As String
  2. Dim bData() As Byte ' Data variable
  3.  
  4. Dim intFile As Integer ' FreeFile variable
  5. strURL = "http://yourserver.com/yourpdf.pdf"
  6.  
  7. intFile = FreeFile() ' Set intFile to an unused
  8. ' file.
  9. ' The result of the OpenURL method goes into the Byte
  10. ' array, and the Byte array is then saved to disk.
  11.  
  12. bData() = Inet1.OpenURL(strURL, icByteArray)
  13.  
  14. Open "C:\Temp\yourpdf.pdf" For Binary Access Write As #intFile
  15. Put #intFile, , bData()
  16. Close #intFile
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
Jan 20th, 2005
0

Re: Using VB Code - Silent download pdf from server and print to local printer

Hi Comatose

I really appreciate all your help.

I was able to tweak around with your code and got the code working. I am now able to download a PDF silently using VB Code.

Thanks once again
Praveen
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pepsoft239 is offline Offline
5 posts
since Jan 2005
Jan 20th, 2005
0

Re: Using VB Code - Silent download pdf from server and print to local printer

The Pleasure is Mine.
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
Jan 21st, 2005
0

Re: Using VB Code - Silent download pdf from server and print to local printer

Hi Comatose

I have raised one more thread on PHP. Can you please let me know if you have any idea on the same too?

Thanks
Praveen
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pepsoft239 is offline Offline
5 posts
since Jan 2005
Jan 21st, 2005
0

Re: Using VB Code - Silent download pdf from server and print to local printer

I'm sorry,

I don't use PHP as a general rule, and therefore, I have no idea how to go about using sockets, and LWP and the like. If you needed it in perl, that would be no problem, however, There are others more proficient in PHP that can give you help.
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
Feb 7th, 2005
0

Re: Using VB Code - Silent download pdf from server and print to local printer

Hi,

Does anybody know how to automate printing of PDF files using VB or C++. I have to print 100 pdf files at a time and trying to find someting like .Print to do it.

Thank you in advance.

Alex
Reputation Points: 10
Solved Threads: 1
Newbie Poster
alexjp is offline Offline
2 posts
since Feb 2005
Feb 7th, 2005
0

Re: Using VB Code - Silent download pdf from server and print to local printer

Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: invalid data source
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: calculate total





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC