Php doc to png

Convert DOC to PNG via Free App or PHP

GroupDocs.Conversion Cloud is a cloud-based document conversion service which allows developers to convert various document formats to and from over 153 different file formats, including but not limited to DOC, PNG, PDF, DOCX, XLSX, PPTX, HTML, EPUB, and more.

GroupDocs.Conversion Cloud provides Free Apps and REST APIs that can be integrated into web and mobile applications, allowing developers to easily incorporate document conversion functionality into their applications without having to install any software locally. The service supports conversion of DOC, documents, spreadsheets, presentations, images, PNG, and other types of files, and provides advanced options such as setting conversion options, specifying output file formats, applying watermarks, and more.

With GroupDocs Cloud Conversion, developers can implement document conversion features in their applications to automate tasks such as converting documents for archival purposes, generating reports, extracting text and images from documents, and integrating document conversion capabilities into their workflow. The service offers high-quality and accurate document conversion capabilities that can help businesses streamline their document processing workflows and improve productivity.

How to convert DOC to PNG

  • Select the file by clicking the DOC to PNG App or simply drag & drop a DOC file.
  • Click the Convert button to upload DOC and convert it to a PNG file.
  • Click on the Save button when it appears after successful DOC to PNG format conversion.
  • That is all! You can use your converted PNG document as needed.

Frequently Asked Questions (FAQ)

I want to create my own app that can convert DOC to PNG?

Check our SDKs at GitHub if you are looking for the source code to convert DOC file format to PNG in the Cloud.

Can I try DOC to PNG conversion for free?

GroupDocs.Conversion Cloud App is completely free. You can convert as many DOC files to PNG as you may like. If you are a developer and want to integrate this feature in your own app, you can try GroupDocs.Conversion Low-Code APIs without any limitations.

I do not want to upload my confidential DOC or PNG files anywhere? What are my options?

GroupDocs.Conversion Cloud is also available as Docker image which can be used to self-host the service. Or you may build your own services using GroupDocs.Conversion High-code APIs which currently drive both DOC and PNG Free Conversion App and REST APIs.

Читайте также:  Python заменить все вхождения подстроки

Источник

DOC to PNG PHP API

Convert DOC files to PNG images using our PHP DOC to PNG API.

Why PSPDFKit API?

SOC 2 Compliant

Build the workflows you need without worrying about security. We don’t store any document data, and our API endpoints are served through encrypted connections.

Easy Integration

Get up and running in hours, not weeks. Access well-documented APIs and code samples that make integrating with your existing workflows a snap.

One Document, Endless Actions

With access to more than 30 tools, you can process one document in multiple ways by combining API actions. Convert, OCR, rotate, and watermark with one API call.

Simple and Transparent Pricing

Pay only for the number of documents you process. You won’t need to consider file size, datasets being merged, or different API actions being called.

Try It Out

This example will convert your uploaded DOC file to a PNG image.

Use Your Free API Calls

Sign up to process 100 documents per month for free, or log in to automatically add your API key to sample code.

Add a File

Add a DOC file named document.doc to your project folder. You can also use our sample file.

The file name is case sensitive. Make sure the file name matches the file name in the sample code. The file name is case sensitive. Make sure the file name matches the file name in the sample code.

Run the Code

Copy the code and run it from the same folder you added the files to. For more information, see our language-specific getting started guides.

View the Results

Open image.png in your project folder to view the results.

curl -X POST https://api.pspdfkit.com/build \ -H "Authorization: Bearer your_api_key_here" \ -o image.png \ --fail \ -F document=@document.doc \ -F instructions=' < "parts": [ < "file": "document" >], "output": < "type": "image", "format": "png", "dpi": 500 >>' 
curl -X POST https://api.pspdfkit.com/build ^ -H "Authorization: Bearer your_api_key_here" ^ -o image.png ^ --fail ^ -F document=@document.doc ^ -F instructions="], \"output\": >" 
package com.example.pspdfkit; import java.io.File; import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.StandardCopyOption; import org.json.JSONArray; import org.json.JSONObject; import okhttp3.MediaType; import okhttp3.MultipartBody; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; public final class PspdfkitApiExample < public static void main(final String[] args) throws IOException < final RequestBody body = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart( "document", "document.doc", RequestBody.create( new File("document.doc"), MediaType.parse("application/msword") ) ) .addFormDataPart( "instructions", new JSONObject() .put("parts", new JSONArray() .put(new JSONObject() .put("file", "document") ) ) .put("output", new JSONObject() .put("type", "image") .put("format", "png") .put("dpi", 500) ).toString() ) .build(); final Request request = new Request.Builder() .url("https://api.pspdfkit.com/build") .method("POST", body) .addHeader("Authorization", "Bearer your_api_key_here") .build(); final OkHttpClient client = new OkHttpClient() .newBuilder() .build(); final Response response = client.newCall(request).execute(); if (response.isSuccessful()) < Files.copy( response.body().byteStream(), FileSystems.getDefault().getPath("image.png"), StandardCopyOption.REPLACE_EXISTING ); >else < // Handle the error throw new IOException(response.body().string()); >> > 
using System; using System.IO; using System.Net; using RestSharp; namespace PspdfkitApiDemo < class Program < static void Main(string[] args) < var client = new RestClient("https://api.pspdfkit.com/build"); var request = new RestRequest(Method.POST) .AddHeader("Authorization", "Bearer your_api_key_here") .AddFile("document", "document.doc") .AddParameter("instructions", new JsonObject < ["parts"] = new JsonArray < new JsonObject < ["file"] = "document" >>, ["output"] = new JsonObject < ["type"] = "image", ["format"] = "png", ["dpi"] = 500 >>.ToString()); request.AdvancedResponseWriter = (responseStream, response) => < if (response.StatusCode == HttpStatusCode.OK) < using (responseStream) < using var outputFileWriter = File.OpenWrite("image.png"); responseStream.CopyTo(outputFileWriter); >> else < var responseStreamReader = new StreamReader(responseStream); Console.Write(responseStreamReader.ReadToEnd()); >>; client.Execute(request); > > > 
// This code requires Node.js. Do not run this code directly in a web browser. const axios = require('axios') const FormData = require('form-data') const fs = require('fs') const formData = new FormData() formData.append('instructions', JSON.stringify( < parts: [ < file: "document" >], output: < type: "image", format: "png", dpi: 500 >>)) formData.append('document', fs.createReadStream('document.doc')) ;(async () => < try < const response = await axios.post('https://api.pspdfkit.com/build', formData, < headers: formData.getHeaders(< 'Authorization': 'Bearer your_api_key_here' >), responseType: "stream" >) response.data.pipe(fs.createWriteStream("image.png")) > catch (e) < const errorString = await streamToString(e.response.data) console.log(errorString) >>)() function streamToString(stream) < const chunks = [] return new Promise((resolve, reject) => < stream.on("data", (chunk) =>chunks.push(Buffer.from(chunk))) stream.on("error", (err) => reject(err)) stream.on("end", () => resolve(Buffer.concat(chunks).toString("utf8"))) >) > 
import requests import json instructions = < 'parts': [ < 'file': 'document' >], 'output': < 'type': 'image', 'format': 'png', 'dpi': 500 >> response = requests.request( 'POST', 'https://api.pspdfkit.com/build', headers = < 'Authorization': 'Bearer your_api_key_here' >, files = < 'document': open('document.doc', 'rb') >, data = < 'instructions': json.dumps(instructions) >, stream = True ) if response.ok: with open('image.png', 'wb') as fd: for chunk in response.iter_content(chunk_size=8096): fd.write(chunk) else: print(response.text) exit() 
 ], "output": < "type": "image", "format": "png", "dpi": 500 >>'; curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.pspdfkit.com/build', CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_POSTFIELDS => array( 'instructions' => $instructions, 'document' => new CURLFILE('document.doc') ), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer your_api_key_here' ), CURLOPT_FILE => $FileHandle, )); $response = curl_exec($curl); curl_close($curl); fclose($FileHandle); 

Using Postman? Download our official collection and start using the API with a single click. Read more →

Читайте также:  Java retry on error

Your API Key

Get access to your API key when you create an account. Once your account has been created, you’ll be able to process 100 documents per month for free using any of our API tools.

Your API key has automatically been inserted into the API example code. Run the sample code in your terminal to execute the API call.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Programatically Convert Microsoft Word Documents to Image — PHP

License

msword2image/msword2image-php

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

Читайте также:  Использование прокси сервера python

README.md

This library allows you to quickly convert Microsoft Word documents to image through msword2image.com using PHP for free!

Example conversion: From demo.docx to output.png.

Note that you can try this out by visting msword2image.com and clicking «Want to convert just one?»

You can simply download this github repo as a zip file. Extract contents and include MsWordToImageConvert.php

require_once 'lib/MsWordToImageConvert.php';

Note: Please make sure cURL is enabled with your PHP installation

1. Convert from Word document URL to JPEG file

$convert = new MsWordToImageConvert($apiUser, $apiKey); $convert->fromURL('http://mswordtoimage.com/docs/demo.doc'); $convert->toFile('demo.jpeg'); // Please make sure output file is writable by your PHP process.

2. Convert from Word document URL to base 64 JPEG string

$convert = new MsWordToImageConvert($apiUser, $apiKey); $convert->fromURL('http://mswordtoimage.com/docs/demo.doc'); $base64String = $convert->toBase46EncodedString(); echo "";

3. Convert from Word file to JPEG file

$convert = new MsWordToImageConvert($apiUser, $apiKey); $convert->fromFile('demo.doc'); $convert->toFile('demo.jpeg'); // Please make sure output file is writable and input file is readable by your PHP process.

4. Convert from Word file to base 64 encoded JPEG string

$convert = new MsWordToImageConvert($apiUser, $apiKey); $convert->fromFile('demo.doc'); $base64String = $convert->toBase46EncodedString(); echo ""; // Please make sure input file is readable by your PHP process.

5. Convert from Word file to base 64 encoded GIF string

$convert = new MsWordToImageConvert($apiUser, $apiKey); $convert->fromFile('demo.doc'); $base64String = $convert->toBase46EncodedString(\MsWordToImageConvert\OutputImageFormat::GIF); echo ""; // Please make sure input file is readable by your PHP process.

6. Convert from Word file to base 64 encoded PNG string

$convert = new MsWordToImageConvert($apiUser, $apiKey); $convert->fromFile('demo.doc'); $base64String = $convert->toBase46EncodedString(\MsWordToImageConvert\OutputImageFormat::JPEG); echo ""; // Please make sure input file is readable by your PHP process.

7. Get the page count of a given Word file

$convert = new MsWordToImageConvert($apiUser, $apiKey); $convert->fromFile('demo2.doc'); $toPageCount = $convert->toPageCount(); // $toPageCount will be integer representing the page count in the word file // Please make sure input file is readable by your PHP process.

8. Get the page count of a given Word file URL

$convert = new MsWordToImageConvert($apiUser, $apiKey); $convert->fromFile('http://msword2image.com/docs/demo2.doc'); $toPageCount = $convert->toPageCount(); // $toPageCount should be 5 // Please make sure input file is readable by your PHP process.

9. Get the specific page of a Word document as image

$convert = new MsWordToImageConvert($apiUser, $apiKey); $convert->fromFile('demo2.doc'); $base64String = $convert->toBase46EncodedString( \MsWordToImageConvert\OutputImageFormat::JPEG, 2 ); echo ""; // Note that pages are 0-indexed. Above code will print the third page of word document // Please make sure input file is readable by your PHP process.

Источник

Оцените статью