We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Pdf to Html CSS Prefix Problem

Hi,

I’m currently building something on the aspose.pdf convert to html functionality.

I’m using (among others) CssClassNamesPrefix on the HtmlSaveOptions object.
almost every css class is now automatically prefixed… except one: .view.
and precisely that one is interfering with the Html/CSS framework in which I’m showing the output-html (I’m also using HtmlMarkupGenerationModes.WriteOnlyBodyContent and adding the Html in some other page with existing html/css, hence the issue)

Is this a bug? Could this be fixed? Is there a workaround to change this during export?
Hope to hear from you.

Martin

Hi Martin,


Thanks for your inquiry. I have tested the scenario with a sample PDF using Aspose.Pdf for .NET 10.3.0 but unable to replicate the issue. We will appreciate it if you please share your sample code and document here. We will look into it and guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,

Hi Tilal,
Thanks for the quick reply. My code is as follows:

// Source PDF file
var doc = new Aspose.Pdf.Document(@“C:\path\to\file.pdf”);


// Create HtmlSaveOption with tested feature
var saveOptions = new Aspose.Pdf.HtmlSaveOptions(HtmlDocumentType.Html5, true)
{
SplitIntoPages = false,
RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground,
LettersPositioningMethod = HtmlSaveOptions.LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss,
CssClassNamesPrefix = “prefixedcssclass_”,
HtmlMarkupGenerationMode = HtmlSaveOptions.HtmlMarkupGenerationModes.WriteAllHtml,
PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml,

};

var outFile = @“C:\path\to\file.html”;

// Save the output in HTML format
doc.Save(outFile, saveOptions);

If you open the Html exported it will show all the css classes prefixed with ‘prefixedcssclass_’ Except "view"

Note: It doesn’t matter if I embed the css or not.

Martin

By the way: I installed Aspose.pdf through Nuget Package manager. Version 10.1.0

Just for testing purposes I now downloaded 10.3 and installed that.

It doesn’t make a difference.

Hi Martin,

Thanks for sharing your source code. I have tested the scenario with Aspose.Pdf for .NET 10.3.0 and managed to observe the reported issue. For further investigation, I have logged an issue in our issue tracking system as PDFNEWNET-38611 and also linked your request to it. We will keep you updated via this thread regarding the issue status.

Please feel free to contact us for any further assistance.

<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif”;mso-fareast-font-family:
Calibri;color:#333333;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA”>Best Regards

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.