FAQ
Q: How to convert HTML document to PDF?
A: It is very simple. You can do this literally with a single line of code!
1// @md products/html/en/java/faq/_index.md
2// Convert HTML to PDF
3Converter.convertHTML($i("document.html"), new PdfSaveOptions(), $o("output.pdf"));
1// @java java/com/aspose/html/examples/Examples_Java_Conversion_HtmlToPdf_1.java
2 Converter.convertHTML(
3 "document.html",
4 new PdfSaveOptions(),
5 "output.pdf"
6 );
For more examples, please visit Converting Between Formats guides.
Q: What formats does Aspose.HTML support?
A: Out-of-the-box we support XHTML, SVG, EPUB, MHTML and Markdown documents. As a part of mentioned documents we also support CSS, JavaScript, XPath and HTML5 Canvas specifications. For more details, please visit Features List page.
Q: Can I use HTMLDocument to load EPUB file format?
A: In order to load EPUB, MHTML, SVG or other supported formats, we prepared specialized end-points and described it in the Create Document guide. The HTMLDocument class is designed only to work with HTML files.
Q: Can I use Aspose.HTML to extract information from a document?
A: Sure, we have a powerful API to inspect the content of HTML documents. It is described in HTML navigation article.
Q: Do you support XPath syntax?
A: Yes.
Moreover, we support CSS Selectors and the native navigation mechanism that is called Document/Element Traversal. You can find the usage examples here.
Q: Is it possible to save a few HTML documents at once?
A: Yes, if you have HTML files which are linked to each other, you can use MaxHandlingDepth parameter to save them as a set of files.
Q: Is it possible to disable JavaScript for a Document?
A: Yes. You should use sandboxing flags to disable potentially untrusted resources.
Q: How to use the MemoryStream object to store the rendering result instead of the file system?
A: You can implement Aspose.Html.IO.ICreateStreamProvider interface to handle the output streams, as it’s described here.
Q: How to check the list of resources that are loaded along with an HTML document?
A: We have a specialized Network Service that gives you full control over the all request/response messages. You can use it to trace the requests, create a custom cache, substitute the content of response messages and much more.
Q: How to override the document style?
A: There is a User Style Sheet property that can be useful exactly for this purpose.
Q: My document does not parse properly, I see black-squares instead of letters! How can I fix it?
A: We parse a document headers to detect the character-set (encoding) of the document. If the encoding is not defined we use UTF-8, which is defined as a default for HTML5 specification. If you know that encoding is different from the default UTF-8, please specify it directly as it described here.
Q: I want to see page numbers at the bottom of the document, how to do this?
A: Since CSS is used to describe the visual layout of the document, we designed specialized CSS Extensions that can be used to write information on page margins.