Solved

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

Posted on 2009-05-13
2
2,072 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
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa‚Ķ
This article discusses four methods for overlaying images in a container on a web page
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now