Angular html page convert to pdf not work

angular html page convert into pdf file not work, blank pdf will be generate, let me know the root cause or correct me if do anything wrong
used ref link doc :https://docs.aspose.com/pdf/net/convert-html-to-pdf/#convert-html-to-pdf

used follwing java code :

URL oracleURL = new URL("http://localhost:4200/export/test?id=1237");
// Get web page as input stream
InputStream is = oracleURL.openStream();
// Initialize HTML load options
HtmlLoadOptions htmloptions = new HtmlLoadOptions();
// Load stream into Document object
Document pdfDocument = new Document(is, htmloptions);
// Save output as PDF format
pdfDocument.save("HTML-to-PDF.pdf");

@kalpeshAspose1997 Could you please attach your input HTML and output PDF here for testing? We will check the issue and provide you more information.

yes @alexey.noskov ,
for input it’s angular page it’s looking perfect on web browser
output pdf file : HTML-to-PDF.pdf (1.5 KB)

@kalpeshAspose1997 Could you please attach the HTML that is passes as an input to Aspose.Words?

it’s not html page it’s website url. I can’t share it with you but for your reference you take any website url like https://www.aspose.com

@kalpeshAspose1997 In your code Aspose.Words accepts as an input HTML document returned by oracleURL.openStream(). Unfortunately, it is difficult to say what the problem is without actual input document. Please make sure the stream returned by oracleURL.openStream() is not empty.

Yes @alexey.noskov, How to Angular html page convert to pdf?, you can only reproduce the issue using the angular project setup

@kalpeshAspose1997 Please note, Aspose.Words does not deal with angular. To convert any web page to PDF you should pass “rendered” HTML as an input to Aspose.Words an then save the document as PDF.
Aspose.Words does not run scripts on the page.

Okay, can we achieve through the Aspose.Pdf ?

@kalpeshAspose1997 Regarding Aspose.PDF it is better to ask in Aspose.PDF forum. You can also try using Aspose.HTML to achieve this:
https://docs.aspose.com/html/java/html-to-pdf-converter/

@alexey.noskov Okay, Thanks

1 Like