<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: asposewords</title>
    <description>The latest articles on Forem by asposewords (@asposewords).</description>
    <link>https://forem.com/asposewords</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F114580%2F440b52f6-6fd7-4f54-b0ba-c8ca7b78f41b.jpg</url>
      <title>Forem: asposewords</title>
      <link>https://forem.com/asposewords</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/asposewords"/>
    <language>en</language>
    <item>
      <title>Extracting images from a document using Aspose.Words Cloud API (C# / .NET)</title>
      <dc:creator>asposewords</dc:creator>
      <pubDate>Sat, 17 Nov 2018 21:42:27 +0000</pubDate>
      <link>https://forem.com/asposewords/extracting-images-from-a-document-using-asposewords-cloud-api-c--net-12jm</link>
      <guid>https://forem.com/asposewords/extracting-images-from-a-document-using-asposewords-cloud-api-c--net-12jm</guid>
      <description>&lt;p&gt;The sample code below discusses a few methods for extracting existing images from a DOCX, or other document file, using the &lt;a href="https://products.aspose.cloud/words" rel="noopener noreferrer"&gt;Aspose.Words Cloud API&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can connect directly and use the &lt;a href="https://apireference.aspose.cloud/words/" rel="noopener noreferrer"&gt;Aspose.Words REST API&lt;/a&gt; but to make the code simpler we are looking at the &lt;a href="https://github.com/aspose-words-cloud/aspose-words-cloud-dotnet" rel="noopener noreferrer"&gt;Aspose.Words Cloud SDK for .NET&lt;/a&gt;.  There are also SDKs for other languages.&lt;/p&gt;

&lt;p&gt;Before we can extract image data from a document file file using the Cloud API the file needs to be available in the Cloud Storage.  The sample code below assumes the document has been uploaded.  See &lt;a href="https://dev.to/asposewords/uploading-a-document-to-asposewords-cloud-storage-c--net-3e3f"&gt;Uploading a document to Cloud Storage (C# / .NET)&lt;/a&gt;.  &lt;/p&gt;

&lt;p&gt;The sample code relies on having the Storage and Words SDKs both downloaded (either as code or DLLs) and referenced via the C# project.&lt;/p&gt;

&lt;p&gt;My solution in Visual Studio looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F28273h3qmxzekx5cpdeh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F28273h3qmxzekx5cpdeh.jpg" alt="Solution" width="237" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The code below shows a sample ExtractImages method.&lt;/p&gt;

&lt;p&gt;1) Sets up a connection to the WordsApi by passing in your AppSid and AppKey obtained from the &lt;a href="https://dashboard.aspose.cloud/#/" rel="noopener noreferrer"&gt;Cloud Dashboard&lt;/a&gt;.  &lt;/p&gt;

&lt;p&gt;2) In the next step I have created a GetDocumentRequest and called the GetDocument method to just verify that the file exists in Storage and can be opened by the API.  &lt;/p&gt;

&lt;p&gt;The Console.WriteLine call that follows just shows accessing properties of the document … SourceFormat in this case.&lt;/p&gt;

&lt;p&gt;The simple example below just has a for / next loop to grab each image based on an index.  A better approach might be to call the GetDocumentDrawingObjects method to retrieve a list of drawing objects in the document if you need to retrieve other information related to the image.  &lt;/p&gt;

&lt;p&gt;3) Creates a GetDocumentDrawingObjectImageDataRequest object with the details of the image we want (based on index) and then &lt;/p&gt;

&lt;p&gt;4) We call GetDocumentDrawingObjectImageData to open a Stream to the object&lt;/p&gt;

&lt;p&gt;5) Saves the Stream to a file (with a unique name based on the index).&lt;/p&gt;

&lt;p&gt;It then loops back to 3) to grab the next image.&lt;/p&gt;

&lt;p&gt;The code will save image data as PNG files.   &lt;/p&gt;

&lt;p&gt;In the sample DOCX file that I used there is a SmartArt object that can be seen by the GetDocumentDrawingObjectImageData call but which is not an image … and so generates an error and is skipped by this sample code.&lt;/p&gt;

&lt;p&gt;As an alternative to the above call you can use GetDocumentDrawingObjectByIndex to specify the format of the returned image.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


</description>
      <category>csharp</category>
      <category>aspose</category>
      <category>docx</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Uploading a document to Aspose.Words Cloud Storage (C# / .NET)</title>
      <dc:creator>asposewords</dc:creator>
      <pubDate>Sat, 17 Nov 2018 21:42:03 +0000</pubDate>
      <link>https://forem.com/asposewords/uploading-a-document-to-asposewords-cloud-storage-c--net-3e3f</link>
      <guid>https://forem.com/asposewords/uploading-a-document-to-asposewords-cloud-storage-c--net-3e3f</guid>
      <description>&lt;p&gt;Before you can use the &lt;a href="https://products.aspose.cloud/words" rel="noopener noreferrer"&gt;Aspose.Words Cloud API&lt;/a&gt; (or other &lt;a href="https://products.aspose.cloud/" rel="noopener noreferrer"&gt;Aspose Cloud APIs&lt;/a&gt;) to read and update existing documents the files will need to be loaded into the Storage in the cloud.&lt;/p&gt;

&lt;p&gt;The Aspose.Storage Cloud API can be directly accessed via the &lt;a href="https://apireference.aspose.cloud/storage/" rel="noopener noreferrer"&gt;REST API&lt;/a&gt; but this sample will use the &lt;a href="https://github.com/aspose-storage-cloud/aspose-storage-cloud-dotnet" rel="noopener noreferrer"&gt;Cloud SDK for .NET&lt;/a&gt; to make the code simpler.&lt;/p&gt;

&lt;p&gt;To begin you will need the SDK downloaded (either the DLL or the source code) and to sign up for a set of credentials by creating an account and requesting a set of API keys.  See &lt;a href="https://dashboard.aspose.cloud/" rel="noopener noreferrer"&gt;https://dashboard.aspose.cloud/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The sample code below shows a simple function to upload a file to Storage by supplying your API keys, local file name and where you want to store the file on Storage.&lt;/p&gt;

&lt;p&gt;The essential steps are to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the StorageApi using your app keys&lt;/li&gt;
&lt;li&gt;Create a PutCreateRequest and pass in details of the file&lt;/li&gt;
&lt;li&gt;Call the PutCreate method &lt;/li&gt;
&lt;li&gt;Check the result&lt;/li&gt;
&lt;/ol&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


</description>
      <category>csharp</category>
      <category>aspose</category>
      <category>docx</category>
      <category>cloud</category>
    </item>
  </channel>
</rss>
