Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 21st, 2007, 02:35 PM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Create PDF from Javascript

I am working on an web page that runs on my companies intranet. I want to create a javascript to create a PDF file from an MS Word file on the users network that will not promt for the user for a location or file name. Bascially the user will tell the code which word file needs to be converted and the program will convert the file and save it to a specific location on the network.

Can anybody tell me the best way to do this, and any recommendations on writing software?

Thanks!!

Reply With Quote
  #2 (permalink)  
Old April 21st, 2007, 04:56 PM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

When you say using JavaScript do you mean creating the PDF on the client or the server?

I have done this on the server by installing a special server-side version of Adobe PDFCreator which allows you to drop a file into a folder and pick up the PDF from a different folder. The client uploaded a Word file in the usual manner and the server-side script dropped it in the folder. The client was then shown a link to grab the PDF.

If you want to transform on the client you'll need each client to install a Word to PDF add-in. These usually involve printing to a special print driver that actually transforms the printing instructions to a PDF. For this you'll need to automate Word using client-side script and have low security settings in the browser to allow opening and saving files from the client's hard drive.

--

Joe (Microsoft MVP - XML)
Reply With Quote
  #3 (permalink)  
Old April 22nd, 2007, 03:17 PM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ya know I would love to be allowed to do this on the server side, but unfortunately that is not an option. So I am referring to creating the PDF on the client side. The Word to PDF add-in is the type of thing I am looking for. I have been playing with several of the free PDF writers out there (since I have to install this thing on several users machines I need to keep the cost low) and I wrote a javascript code that is able to 'print' the word document to the PDF writer but I keep running into problems because either a 'save-as' dialog box appears and the user doesn't know what to do with it or PDF doesn't get created completely before the javascript places it in the correct network folder.

Would you have any suggestions on what 'Word to PDF' add in and associated javascript I should use? Using ActiveXObject is fine.

Thanks!!

Reply With Quote
  #4 (permalink)  
Old April 22nd, 2007, 03:33 PM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I seem to remember I used PDF995 (955?) but I also ran into problems automating Word. You could set the default output folder and specify the PDF name programatically but there were a number of issues. If background printing was on then there could be a delay. So I turned that off, and re-enabled afterwards if needed. I also used to poll the output folder for the file and only show the user the link when it was available. You also need to try/catch everything because if Word pops up a dialogue error box and it's invisible the user has had it. It worked okay but was too unreliable in the long run that's why we moved to the server-side alternative.

Basically you just have to explain this to the powers that be, if you want a client-side solution you are going to have to put up with a few helpdesk calls.

--

Joe (Microsoft MVP - XML)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
to create PDF from word file sunilbedre Excel VBA 0 November 29th, 2007 06:39 AM
VBA to create PDF from webpage ncarty97 Excel VBA 0 September 25th, 2006 02:48 PM
create pdf file aytacakin J2EE 1 September 5th, 2005 11:59 PM
Create a PDF with VB.NET medwar76 Pro VB.NET 2002/2003 5 October 29th, 2003 01:16 PM
Create a PDF with VB.NET medwar76 VS.NET 2002/2003 0 September 4th, 2003 02:38 PM



All times are GMT -4. The time now is 04:34 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.