I am converting attached docx document to html fixed which retain all the formating and styling.
Hi Raju,
No resolution yet !!!
I am still waiting for my query to be answered !!!
Hi Raju,
You can use the code from to upload the images and then use uploaded images. FileFormatUtil.ImageTypeToExtension(shape.ImageData.ImageType) will give you the types of the images.
Following code can be used to save any shape as image.
ShapeRenderer r = shape.GetShapeRenderer();
<?xml:namespace prefix = "o" ns = "urn:schemas-microsoft-com:office:office" />
// Define custom options which control how the image is rendered. Render the shape to the JPEG raster format.
ImageSaveOptions imageOptions = new ImageSaveOptions(SaveFormat.Emf)
{
Scale = 1.5f
};
// Save the rendered image to disk.
r.Save(dataDir + "TestFile.RenderToDisk Out.emf", imageOptions);
Best Regards,
This doesn’t solve any of the problem. Did you tried using the attached document ?
Hi Raju,
We are working on the example using your document and will share it with you soon. Sorry for the inconvenience.
Best Regards,
Any update ??
Hi Raju,
We will share the example with you today. Sorry for the inconvenience.
Best Regards,
Hi Raju,
Sorry for the delay. There are some limitations if you use Aspose.Words for .NET to convert to HtmlFixed format and it does not support CurrentShape property in ResourceSavingArgs and SVG to raster image during Word to HtmlFixed. We need these features to accomplish the task using Aspose.Words only.
Two new issues to support above mentioned features have been logged into our issue tracking system as WORDSNET-11693 and WORDSNET-11694 respectively. We will keep you updated on these issues in this thread.
However one solution is available if you use Aspose.Words and Aspose.Pdf. Aspose.Words can be used to convert Word to PDF and then Aspose.Pdf can be used to convert PDF to HTML . Following code can be used to convert PDF to HtmlFixed and save SVGs as raster images during conversion.
Document pdf = new Document("c:/pdftest/out.pdf");
string outHtmlFile = @"c:\pdftest\Out_FileConverted.html";
// Create HtmlSaveOption with tested feature
HtmlSaveOptions saveOptions = new HtmlSaveOptions();
saveOptions.FixedLayout = true;
saveOptions.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
pdf.Save(outHtmlFile, saveOptions);
You can check all topics related to PDF to HTML conversion , specially http://www.aspose.com/docs/display/pdfnet/PDF+to+HTML+Save+Output+to+a+Stream+Object and http://www.aspose.com/docs/display/pdfnet/PDF+to+HTML+Specify+Prefix+for+Images to save images to remote server and update image URLs.
Best Regards,
You may use my code for further fixing :
Hi Raju,
Thanks for the code. We will use it to confirm if the issues have been fixed.
Best Regards,
Hi Raju,
You can use the following code to upload all or specific resources to cloud storage and update resource URI according to new location while saving to HtmlFixed format. HtmFixedSaveOptions.ExportEmbeddedSvg can be set to false to capture IResourceSavingCallback.ResourceSaving method for all shapes (which are rendered as SVG).
var fileName = @"E:\Aspose\Defects\11694\Aspose test document.docx";
var outFileName = @"E:\Aspose\Defects\11694\out.html";
Document doc = new Document(fileName);
var so = new HtmlFixedSaveOptions();
so.ExportEmbeddedSvg = false;
var callback = new ResourceSavingCallback();
so.ResourceSavingCallback = callback;
doc.Save(outFileName, so);
callback.UploadImagesToServer();
<?xml:namespace prefix = "o" ns = "urn:schemas-microsoft-com:office:office" />
internal class ResourceSavingCallback : IResourceSavingCallback
{
private readonly Dictionary<string, Stream> mImages;
public ResourceSavingCallback()
{
mImages = new Dictionary<string, Stream>();
}
public void ResourceSaving(ResourceSavingArgs args)
{
if (args.ResourceFileName.EndsWith(".png") || args.ResourceFileName.EndsWith(".jpeg")) // TODO any other image types
{
args.ResourceFileUri = "wwww.myserver.com/" + args.ResourceFileName;
var stream = new MemoryStream();
args.ResourceStream = stream;
args.KeepResourceStreamOpen = true;
mImages.Add(args.ResourceFileName, stream);
}
}
public void UploadImagesToServer()
{
foreach (var pair in mImages)
{
// TODO upload images
Debug.WriteLine(pair.Key);
Debug.WriteLine(pair.Value.Length);
}
}
}
Best Regards,
The issues you have found earlier (filed as WORDSNET-11693) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.
The issues you have found earlier (filed as WORDSNET-11694) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.