Jump to content

  • Log In with Google      Sign In   
  • Create Account

How to download a website as ms word with the pictures inside


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Brainx7   Members   -  Reputation: 124

Like
0Likes
Like

Posted 26 June 2014 - 02:38 PM

So I have a form in php that has some pics in it. when the user submits, it takes them to a confirmation page which is also php, in this confirmation page I have a button that downloads the page as ms word, when I open the document the pictures are not visible because they are not in the same directory, could there be a way to download everything at the same time or something or idk have the picture be a part of the website without using image src , the code is quite long ,I attached both files so you can see,


Edited by Brainx7, 18 July 2014 - 07:35 AM.


Sponsor:

#2 Ectara   Crossbones+   -  Reputation: 3058

Like
0Likes
Like

Posted 26 June 2014 - 03:41 PM

I have entirely no experience with generating Word documents, so I'm just guessing, but have you tried using a data URI instead of a URL to the file for the images?



#3 SimonForsman   Crossbones+   -  Reputation: 6305

Like
1Likes
Like

Posted 26 June 2014 - 10:43 PM

You should probably be aware that a html document that you give a .doc extension is still a html document, not a word document and thus it can't include images (it can link to images but those images will have to be downloaded separatly) (Other office suites might also have trouble opening those files as they won't be in the expected format)

 

A far better solution is to actually generate a word document using for example: http://phpword.codeplex.com/ (It is very easy to use)

 

 

If you absolutely insist on using renamed html documents you will have to make an archive (zip for example) containing all the required files (images, stylesheets, etc) or to use data uris (<img src="data::image/png;base64,{base64encodedimagedata}"/>) but i don't know if word supports those. (it might work in newer versions of word (Microsoft added partial support for it in IE8 and made it semi decent in IE9)


Edited by SimonForsman, 26 June 2014 - 11:09 PM.

I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#4 aregee   Members   -  Reputation: 1026

Like
0Likes
Like

Posted 27 June 2014 - 05:34 AM

I worked on something in the past, I think it was called "Microsoft Office SDK" or "Word SDK" or something like that, that I used to generate Word documents on the fly (programmatically).  I tried to find it again for another question here recently with a similar question, but I couldn't find any references to that any more.  Maybe it is included in the "Platform SDK" now, like you do with "Direct X"?  Unless Microsoft has discontinued that SDK, there should exist something to generate Word documents 'on the fly'.

 

Other than that, I remember copying and pasting a whole webpage into Word, would give a good representation of the web page as a word document.

 

Same goes if you are opening HTML documents in Word.  Just remember to save the document as a Word document, and not HTML.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS