473,507 Members | 2,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I convert word file to jpg image using com and php

1 New Member
I want to make a php script when I insert doc file or pdf file in database.

At a time it generate very first image of word file or pdf.

I have seen an example related about it like:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // starting word
  3. $word = new COM("word.application") or die("Unable to instantiate Word");
  4. echo "Loaded Word, version {$word->Version}\n";
  5.  
  6. //bring it to front
  7. $word->Visible = 1;
  8.  
  9. //open an empty document
  10. $word->Documents->Add();
  11.  
  12. //do some weird stuff
  13. $word->Selection->TypeText("This is a test...");
  14. $word->Documents[1]->SaveAs("Useless test.doc");
  15.  
  16. //closing word
  17. $word->Quit();
  18.  
  19. //free the object
  20. $word = null;
  21. ?>
  22. .this example is not working well for generate  doc file to jpg... 
  23.  
  24. but 
  25.  
  26. $powerpnt = new COM("powerpoint.application") or die("Unable to instantiate Powerpoint");
  27.  
  28. $presentation = $powerpnt->Presentations->Open(realpath($file), false, false, false) or die("Unable to open presentation");
  29.  
  30. foreach($presentation->Slides as $slide)
  31.  
  32. {
  33.  
  34.     $slideName = "Slide_" . $slide->SlideNumber;
  35.  
  36.     $exportFolder = realpath($uploadsFolder);
  37.  
  38.     $slide->Export($exportFolder."\\".$slideName.".jpg", "jpg", "600", "400");
  39.  
  40. }
  41.  
  42. $powerpnt->quit();
  43.  
  44. ?>
This script can convert ppt to jpg image ..
So my question is that how to convert doc file to jpg> Like ppt to jpg image?

Please help me.

Thanks
Jan 24 '13 #1
0 2139

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3817
by: Ashutosh | last post by:
How can i convert Word file to txt file in ASP.NET using CSharp?
1
16214
by: Prasad More | last post by:
Hello, I am trying to write a text on Multi-page TIFF image using C# and .NET GDI+. I have written following code to do this. When I execute this code I get "Invalid Parameter User. at...
0
1677
by: COMantilles | last post by:
Hi, Hi created a simple function to open a word doc on server then save it to HTML, ok for the result except that i would like to save it to "filtered" HTML without office's tags (word 2002...
1
5487
by: mohan21_kumar | last post by:
Hi, How to Save images in ms word file when it is downloaded from asp.net application. I have used the following code to convert the html page into ms word file. but i'm not able to save the...
6
29426
by: PenguinPig | last post by:
Dear All Experts I would like to know how to convert a HTML into Image using C#. Or allow me contains HTML code (parsed) in Image? I also tried this way but it just display the character "<" &...
2
5601
by: Pankajmani das | last post by:
Dear sir I am trying to open a word file using Visual Basic Commad. But I am failed. So, please guid me to open a perticular word or another file. Note: I know how to open a file using common...
3
3845
by: mzmishra | last post by:
Hi, I have one application in c# .net 1.1. I like to convert word to pdf using Adobe Distiller . Can any body help me get some code samples in C# for the same?
3
1569
by: Cylix | last post by:
I find all the convertor components are thro printer drive. And all components return directly as a file/array bytes/stream are real time pdf generation. is there any direct output convertor in...
5
13660
by: prakashturkar | last post by:
Hi, I am Prakash.... I have tried to print an MS Word file using the basic print utilities provided in JAVA.But while asking for printing through my own code i am getting proble for example..."The...
1
3605
by: pankajprakash | last post by:
Hi, I have a word file which contains numbers of shapes. Each shape contain some textboxes. I am copying that file to another location and assigning some values to those textboxes of those shapes....
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7114
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7034
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5045
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.