Hi Team,
In our project, we perform a snapshot operation on Word document which means we load an entire word document into Aspose document and split the doc with each paragraph convert the content into stream and then literally into string Base64.This Base 64 is converted to image in the server side (Angular/ HTML). Here the string Base64 contains lot of empty spaces. Please see below for detailed information
Code to convert doc to string Base 64:
var tempSourceDoc = new Document(Source Doc folder);
var tempTargetDoc = new Document(Temp Doc folder);
DocumentBuilder tempSourceDocBuilder = new DocumentBuilder(tempSourceDoc);
DocumentBuilder tempTargetDocBuilder = new DocumentBuilder(tempTargetDoc);
tempSourceDocBuilder.Writeln("Source Para 1");
tempTargetDocBuilder.Writeln("target Para 1");
tempSourceDoc.UpdateFields();
tempTargetDoc.UpdateFields();
tempSourceDoc.Compare(tempTargetDoc, "automated", DateTime.Now);
MemoryStream imageStream = new MemoryStream();
tempSourceDoc.Save(imageStream, Aspose.Words.SaveFormat.Jpeg);
byte[] contentsOfPdf = imageStream.ToArray();
var imageContent = Convert.ToBase64String(contentsOfPdf);
image Content looks like,
SampleImage.GetJpegPageRange.jpeg (73.1 KB)
In the above image you can see for a single para entire page is allocated. I am sure if this is feasible but is it possible to capture the snapshot (string base 64) of only the para content without the space? if yes please guide with the code.
Thanks,
Karthikeyan