Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
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:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

914 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

18 Experts available now in Live!

Get 1:1 Help Now