Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Publisher / Programming / August 2006

Tip: Looking for answers? Try searching our database.

Command-Line Printing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kelly M - 07 Aug 2006 16:17 GMT
We accept Publisher files uploaded via the web for printing, and we convert
.pub files to PDF on the fly. We're adjusting our workflow to print to a PDF
print driver, in order to keep CMYK colors, but we're having problems running
the files programmatically.

We've tried running a command line, and if you execute it as a user, it
works fine:
"C:\Program Files\Microsoft Office\OFFICE11\mspub.exe" /p "C:\Documents and
Settings\kelly\Desktop\hr2006.pub"

However, running it through a web server (PHP/Apache) launches Publisher,
but it hangs and eventually errors out without printing.

First, is there a better method of programmatically printing a .pub document
to PDF? Second, if not, anybody have any clues why it would hang? Third, I
recall seeing a Publisher list of command-line switches, but I can't find
that any more, does anyone have a link?

Thanks for any clues in pointing me in the right direction.

- Kelly
Ed Bennett - 07 Aug 2006 17:39 GMT
> First, is there a better method of programmatically printing a .pub document
> to PDF?

Does PHP support COM? If it does, you can use Publisher (2002 or later)
as a COM server, and programmatically open the files (you can even use a
single instance if you prefer rather than opening and closing a load).

You'll probably need to reference the Microsoft Office object library
and the Microsoft Publisher object library. Then create an instance of a
Publisher object.

> Second, if not, anybody have any clues why it would hang?

No idea, sorry. I wasn't even aware of the command-line switch until you
posted!

> Third, I
> recall seeing a Publisher list of command-line switches, but I can't find
> that any more, does anyone have a link?

Nope. If you find one, can you post it here - I'll add it to my list o'
links at the website below.

Signature

Ed Bennett - MVP Microsoft Publisher
http://ed.mvps.org

Kelly M - 09 Aug 2006 17:13 GMT
I think I've found the answer, or set of answers. As I'd thought, it had to
do with permissions. Not only do all Office files need to have their
permissions set so the IUSR_<accountname> guest account for IIS can access
them, Publisher needs to have a specific "Launch Permissions" flag set. I
found the specifics in this MS KB article:
http://support.microsoft.com/kb/288366/

Also, I needed to log in as the IUSR_<accountname> account to set up a user
profile for Publisher in that account. That was also tricky, but the above
article had info on how to do that.

Once all that was done, PHP was able to successfully launch Publisher and
print a file to a PDF print driver.

- Kelly

> > First, is there a better method of programmatically printing a .pub document
> > to PDF?
>
> Does PHP support COM? If it does, you can use Publisher (2002 or later)
> as a COM server, and programmatically open the files (you can even use a
> single instance if you prefer rather than opening and closing a load).

> You'll probably need to reference the Microsoft Office object library
> and the Microsoft Publisher object library. Then create an instance of a
> Publisher object.

Yes, I've tried to instantiate a COM object through PHP, but it had the same
issue.

> > Second, if not, anybody have any clues why it would hang?
>
[quoted text clipped - 7 lines]
> Nope. If you find one, can you post it here - I'll add it to my list o'
> links at the website below.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.