Converting from SVG to PNG but the size is not correct

I am getting always an Null reference Exception

What I want is to convert the code of the svg to the jpg, I can not convert every single svg to an Html page and this to image.

@Abdul_Sawas

We need to investigate in details whether your above requirements are feasible to achieve using the API or not. For the purpose, we will log an investigation ticket in our issue tracking system. However, could you please share an expected output HTML (where all SVG images are replaced with JPG or PNG images). Please try to share the sample output file with respect to the source file that you have already shared in this forum thread.

Hallo Asad,

could you please give an example how to convert PDF to HTML - Avoid Saving Images in SVG Format.

I want to achievethis using c#

image.png (59.5 KB)

Hello Asad,

in the attachment you could see my code in which I am trying to convert the pdf to html, but I am getting always exception.

Please tell me which Namespace should I include from NugetManager.

I am waiting for your response

@Abdul_Sawas

You only need to install Aspose.PDF for .NET from NuGet Package Manager in order to convert a PDF into HTML while avoiding saving images as SVG. The code snippet that you are already using (as shown in the shared image) is correct and should produce the output without any issue.

We also tested this code snippet with one of our sample PDFs and did not notice any issue. The issue you are facing could be related to some specific type of PDF document. Would you please share it with us so that we can also try to observe it at our end and address it accordingly.

Uploading: AsposePdfToHtml.zip…
Hello Asad,

the code works fine only if I pass an orginal pdf, but my method is : Word --> pdf --> Html
when I am trying to convert the pdf which I convert from word document I get always the Error.

image.png (298.1 KB)

Could you please tell me why I am getting the error in such scenario

I just want to tell you that the source Word Document was generated from DevExpress.XtraRichEdit.RichEditControl this control let you to load a word doument and then save it to word document again

teamviewer_-_firma_idl_gmbh_mitte_beitreten.zip (212.7 KB)
image.png (312.2 KB)

Hello Asad,
in the Attachment you could find the Word Document which I get from The Devexpress.RichEditControl and you could alse see my code sample. I get a nullreference Expection but I get after the exception the html file. Could you please test the reason and then give afeed back. Thanks a lot

@Abdul_Sawas

The exception was occurring because you were not converting Word to PDF correctly. Please use following code snippet in order to carry out the complete operation:

Aspose.Words.Document doc = new Aspose.Words.Document(dataDir + "teamviewer_-_firma_idl_gmbh_mitte_beitreten.docx");
doc.Save(dataDir + "output.pdf", Aspose.Words.SaveFormat.Pdf);

Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(dataDir + "output.pdf");
Aspose.Pdf.HtmlSaveOptions saveOptions = new Aspose.Pdf.HtmlSaveOptions();
saveOptions.PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml;
saveOptions.LettersPositioningMethod = HtmlSaveOptions.LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss;
saveOptions.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
saveOptions.FontSavingMode = HtmlSaveOptions.FontSavingModes.SaveInAllFormats;

pdf.Save(dataDir + "output.html", saveOptions);

PDFandHTML.zip (1.5 MB)

Attached are the output files for your reference.

Hallo Asad,

the pdf file consist of 30 page, but aspose.pdf gives me always 10 pages or even 5 pages.
Is that because Licence ?

Please tell me if you have a licence for 2 Month just to test your product correctly

@Abdul_Sawas

Yes, this may be due to the evaluation version of the API. We offer 30-days free temporary license in order to evaluate the API in its full capacity. Furthermore, you can post a request in our Purchase forum for extension once it is expired.

could you please write me the email of the correct person who could give me a 30 days free licence

@Abdul_Sawas

You need to follow the wizard given over the link shared in our previous response. However, if you are facing any issue while applying for the license, please contact our sales team in Purchase forum category where you will be assisted accordingly.