Solved

saving inside of div tag to pdf or word via php?

Posted on 2009-05-13
2
2,143 Views
Last Modified: 2013-12-13
i can create and save some word, excel, pdf files via php. but i am saving data to array then post to other page and create word file and parsing data after pasting to it and saving file. but i dont want to do that way because data vary i want to copy data inside specific div tag and paste to document and save it. because inside div tag there will be image, decorated text and etc. how can i do this.

<div id="print_to_word">
Some Data
</div>
<input type="button" onclick="run function">

or

<div id="print_to_word">
Some Data
</div>
<input type="button" onclick="run function">
0
Comment
Question by:phparmy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 49

Accepted Solution

by:
Roonaan earned 500 total points
ID: 24391208
You could have a hidden form

<form name="createword" style="display:none" action="create-word.php" target="_blank" method="post">
   <input type="hidden" name="html" />
</form>

<input type="button" onclick="createWord()" />

<script type="text/javascript">
function createWord() {
  document.forms['createword'].html.value = document.getElementById('print_to_word').innerHTML;
  document.forms['createword'].submit();
}
</script>

Then you have to have your word creation script use the $_POST['html'] as its document content.
0
 

Author Comment

by:phparmy
ID: 24409178
thank you very much this solve my problem.
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question