Hi Team,
Could you please advise on how to convert webpage to static html file?
Thanks
Hi Team,
Could you please advise on how to convert webpage to static html file?
Thanks
Would you please share on which platform are you working e.g. .NET or Java? Furthermore, please check the following code snippet that downloads webpage content and saves it as HTML.
URL oracleURL = new URL("https://www.google.com/");
// Get web page as input stream
InputStream is = oracleURL.openStream();
// Initialize HTML load options
HtmlLoadOptions htmloptions = new HtmlLoadOptions("https://www.google.com/");
htmloptions.getPageInfo().setMargin(new MarginInfo(0,0,0,0));
htmloptions.isRenderToSinglePage();
// Load stream into Document object
Document pdfDocument = new Document(is, htmloptions);
HtmlSaveOptions newOptions = new HtmlSaveOptions();
newOptions.PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml;
// this is just optimozation for IE and can be omitted
newOptions.LettersPositioningMethod = LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss;
newOptions.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
newOptions.FontSavingMode = HtmlSaveOptions.FontSavingModes.SaveInAllFormats;
newOptions.RemoveEmptyAreasOnTopAndBottom = true;
// Save output as PDF format
pdfDocument.save(dataDir+ "HTML.html", newOptions);
Thanks. It is java platform.
Will it be downloaded with CSS and javascripts along with HTML code?
The shared sample is in Java too. Unfortunately, I am unable to understand your second part of question. Can you please explain what actually you meant by that?
If HTML has LOGO and CSS,images.Can we able to download the entire HTML file?