473,561 Members | 3,564 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

print a file pdf on server without to visualize it

Hi,
I have a problem.
How can I print a file pdf on server without to visualize it?

Thanks

Best regard
Nov 20 '05 #1
7 9494
Hi Enrico,

You need to use Acrobat's COM interface. For this you'll need the full
version of Acrobat - not just the reader.

The procedure is something like the following:

Imports Acrobat

Private oAcrobat As Acrobat.CAcroAp p 'That Adobe App that we all know
and love.
Private oAcrobatDoc As Acrobat.CAcroPD Doc 'The required Pdf.
Private oDocView As Acrobat.CAcroAV Doc 'The Acrobat View of the doc.

'Start up Acrobat.
oAcrobat = CreateObject ("AcroExch.App" )

'Skip the next line if you don't want Acrobat visible.
oAcrobat.Show

'Create a blank document object.
oAcrobatDoc = CreateObject ("AcroExch.PDDo c")
If oAcrobatDoc Is Nothing Then Stop

'Read in a given document.
Dim tSuccess As Boolean = oAcrobatDoc.Ope n (sDocPath & "Document.p df")
If tSuccess = False Then Stop

'Create a view onto the document.
oDocView = oAcrobatDoc.Ope nAVDoc ("Document.pdf" )
If oDocView Is Nothing Then Stop

'Print all the pages.
uiLastPage = oAcrobatDoc.Get NumPages() - 1 '(0-based)
oDocView.PrintP ages (0, uiLastPage, ?, ?, ?)

oDocView.Close (False)
oAcrobatDoc.Clo se()
oAcrobat.Exit()

oDocView = Nothing
oAcrobatDoc = Nothing
oAcrobat = Nothing

Good luck,
Fergus
Nov 20 '05 #2
Thanks for the interest.
The function printpages does not work. (oDocView.Print Pages(1, uiLastPage,
1, True, True))
The rest works why I succeed in reperire the number of the pages of the pdf.
Thanks


"Fergus Cooney" <fi******@tesco .net> ha scritto nel messaggio
news:#y******** ******@TK2MSFTN GP12.phx.gbl...
Hi Enrico,

You need to use Acrobat's COM interface. For this you'll need the full
version of Acrobat - not just the reader.

The procedure is something like the following:

Imports Acrobat

Private oAcrobat As Acrobat.CAcroAp p 'That Adobe App that we all know and love.
Private oAcrobatDoc As Acrobat.CAcroPD Doc 'The required Pdf.
Private oDocView As Acrobat.CAcroAV Doc 'The Acrobat View of the doc.
'Start up Acrobat.
oAcrobat = CreateObject ("AcroExch.App" )

'Skip the next line if you don't want Acrobat visible.
oAcrobat.Show

'Create a blank document object.
oAcrobatDoc = CreateObject ("AcroExch.PDDo c")
If oAcrobatDoc Is Nothing Then Stop

'Read in a given document.
Dim tSuccess As Boolean = oAcrobatDoc.Ope n (sDocPath & "Document.p df") If tSuccess = False Then Stop

'Create a view onto the document.
oDocView = oAcrobatDoc.Ope nAVDoc ("Document.pdf" )
If oDocView Is Nothing Then Stop

'Print all the pages.
uiLastPage = oAcrobatDoc.Get NumPages() - 1 '(0-based)
oDocView.PrintP ages (0, uiLastPage, ?, ?, ?)

oDocView.Close (False)
oAcrobatDoc.Clo se()
oAcrobat.Exit()

oDocView = Nothing
oAcrobatDoc = Nothing
oAcrobat = Nothing

Good luck,
Fergus

Nov 20 '05 #3
Hi Enrico,

|| The rest works why I succeed in reperire the number of the pages of the
pdf

?? I don't understand this.

My only idea is that the Acrobat documentation says that FirstPage is 0.
uiLastPage would therefore be NumPages - 1. But if you're setting uiLastPage
as I suggested you should get everything except the first page.

PrintPages comes back with True for success and False if there's no
document or an exception occurs.

I forgot to mention PrintPagesSilen t which is the same function but
without the Print dialogue. It sends to the default printer.

Regards,
Fergus
Nov 20 '05 #4
Hi Fergus,

the function "PrintPagesSile nt" returns false.

The document there is because the function "GetNumPage s()" returns the
number of pages of the pdf.

What I can still make?

I have forgotten that printer is not connected to the server but is in LAN.

Printer default of the server is that in LAN.

Sorry for my english. I'am Italian.

Best regards

Enrico

"Fergus Cooney" <fi******@tesco .net> ha scritto nel messaggio
news:ub******** ******@tk2msftn gp13.phx.gbl...
Hi Enrico,

|| The rest works why I succeed in reperire the number of the pages of the pdf

?? I don't understand this.

My only idea is that the Acrobat documentation says that FirstPage is 0. uiLastPage would therefore be NumPages - 1. But if you're setting uiLastPage as I suggested you should get everything except the first page.

PrintPages comes back with True for success and False if there's no
document or an exception occurs.

I forgot to mention PrintPagesSilen t which is the same function but
without the Print dialogue. It sends to the default printer.

Regards,
Fergus

Nov 20 '05 #5
Hi Enrico,

I'm not great when it comes to printers!!

The question is whether it's a problem with Acrobat or whether it's the
printing itself.

You could try setting up your printer to print to a file. Then see if you
can get this file to go to the LAN printer manually.

You could set up the Acrobat PdfWriter printer driver and see if you can
print to that. This should simply make a copy of your document.

You could borrow a printer from someone and hook it up to your machine and
see if that prints.

If any or all of these work, then Acrobat is fine.

But how to get a LAN printer working ?? I've no ideas, I'm afraid. :-(

Good luck,
Fergus
Nov 20 '05 #6
Hi Enrico,

I just spotted the following code in another newsgroup:

Process.Start(" C:\Program Files\Adobe\Acr obat
5.0\Reader\Acro Rd32.exe", "/p /h ""C:\Progra m Files\Adobe\Acr obat
5.0\Help\ENU\AC ROBAT.PDF""")

Using the command line may be a better approach than using automation.

And maybe not :-)

Regards,
Fergus
Nov 20 '05 #7
Hi Fergus,
I have forgotten that I am using a WEB ASP.NET
Regards, Enrico
"Fergus Cooney" <fi******@tesco .net> ha scritto nel messaggio
news:OD******** ******@TK2MSFTN GP09.phx.gbl...
Hi Enrico,

I just spotted the following code in another newsgroup:

Process.Start(" C:\Program Files\Adobe\Acr obat
5.0\Reader\Acro Rd32.exe", "/p /h ""C:\Progra m Files\Adobe\Acr obat
5.0\Help\ENU\AC ROBAT.PDF""")

Using the command line may be a better approach than using automation.

And maybe not :-)

Regards,
Fergus

Nov 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
5594
by: Mike | last post by:
Sites using thumbnail preview for world wide web file navigation and searching. Below are list of sites that are either researching or providing thumbnail preview images for online web documents. Thumbnail previews are useful for web site navigation particularly in search engines and directories such as Google, Altavista and Yahoo. The...
5
3641
by: Alan | last post by:
While not rs.eof <td><%=rs("InvoiceNo")%></td> <td><%=rs("Name")%></td> <td><a href="InvoicePrint.asp?WInv=<%=rs("InvoiceNo")%>"></a></td> <td>Print this invoice</td> rs.MoveNext Wend Now user needs to click the link to open the invoice, and then select File--Print from the menu to print it out, and then return back to print
2
2405
by: Kitkat | last post by:
Hi, i hope my english is good enough to explain my problem. Okay, I have a html-file with a image. But i don't want to save or print the html-file with the image. I want to save or print a pdf-file (in this pdf-file is the image, too) without open the pdf-file. It should only open the "save as"-window or the "print"-window when I push a...
2
4831
by: billiejoex | last post by:
Hi all. I'm using pcapy module to sniff some ICMP packets. I would like to modify this source: http://www.google.it/search?hl=it&q=pcapy&btnG=Cerca+con+Google&meta= and visualize only the DATA filed of the sniffed packets instead of all fields that are generally visualized (for example: ip src, ip dest, packet type...) For example in this...
6
1825
by: Catalin Porancea | last post by:
Hello, How do I print a web form as soon as it is displayed, without any user intervention? Thank you, Catalin
4
2721
by: ESPN Lover | last post by:
Below is two snippets of code from MSDN showing how to read a file. Is one way preferred over the other and why? Thanks. using System; using System.IO; class Test { public static void Main()
7
6861
by: Robert Adkison | last post by:
I need to print a web page. It is my preference that my users just do a File/Print from explorer. That way my users will get the print dialog that will allow them to select the fax printer. The only problem with doing this is that a header (name of the page and Page x of x) and footer (actual page filename the date) are included. I am...
9
2999
by: TC | last post by:
Like a lot of database developers, I often choose Jet for the back- end. I'm starting to worry about what will happen when Jet is deprecated. Ostensibly, Jet users like me must switch to SQL Server (or MSDE / SQL Express), but there's something I just don't understand. Without Jet, how will we create file server database applications? In...
0
1721
by: =?Utf-8?B?Sm9obg==?= | last post by:
If I'm posting in the wrong group please let me know. We've been experiencing issues with the print spooler service on our print server running Windows Server 2003 SP2. Occasionally the service will fail without any specific errors. In the event viewer there will be the following error, event ID 7031 "The Print Spooler service terminated...
0
8088
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7618
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7930
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6210
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5472
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5187
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3600
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2068
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
896
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.