PDF to HTML - embeded CSS

I am converting PDF to HTML.

after convertion I get external CSS file.
Do I have option to get the CSS inside the output html ?

Thanks.

Hi Yehuday,


Thanks for contacting support.

MHT is a format where Images/Fonts/CSS etc are embedded inside the HTML. I am afraid Aspose.Pdf for .NET does not support the feature to convert PDF file to MHT format. For the sake of correction, we already have logged this requirement as PDFNEWNET36340 in our issue tracking system. The development team will further look into the details of this requirement and will keep you posted on the status of correction.

We are sorry for this inconvenience.

my purpose was not to convert to MHT.

my question was if I have option to get the CSS values by In-page Style Tags or inline style attribute
in the html file instead of external css file ( )

Tיק Desired result:









yehuday:
my purpose was not to convert to MHT.
my question was if I have option to get the CSS values by In-page Style Tags or inline style attribute
in the html file instead of external css file ( )

Tיק Desired result:



....



....

Hi Yehuday,

Thanks for sharing the details.

I am afraid the above stated requirement is not supported. However for the sake of implementation, I have logged this requirement as PDFNEWNET-36608 in our issue tracking system under New Features list. The development team will further look into the details of this problem and will keep you updated on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

The issues you have found earlier (filed as PDFNEWNET-36608) have been fixed in Aspose.Pdf for .NET 9.6.0.

Hi Yehuday,

Thanks for your patience.

To accomplish your requirement, you can use the following code snippet:

[C#]

Document doc = new Document(@"F:\ExternalTestsData\36608.pdf");

// Instantiate HTML Save options object
HtmlSaveOptions newOptions = new HtmlSaveOptions();

// Set parts embedding mode
newOptions.PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedCssOnly;

// Set letters positioning method for optimization in IE
newOptions.LettersPositioningMethod = HtmlSaveOptions.LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss;

// Set raster images saving mode
newOptions.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;

// Set font saving mode
newOptions.FontSavingMode = HtmlSaveOptions.FontSavingModes.SaveInAllFormats;

// Output file path
string outHtmlFile = @"F:\ExternalTestsData\36340.html";

doc.Save(outHtmlFile, newOptions);