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

Free Support Forum - aspose.com

Aspose PDF java : taking longer to convert URL in PDF

I am using Aspose PDF 19.2 (java). I want to convert URL in my website into PDF. I referred to this thread: Html page URL to PDF file

I am able to create PDF but it takes long time (~ 2 Minutes). Page is very short so it should not take this much time in creating PDF.
URL : https://www.questionpro.com/a/TakeSurvey?tt=3wSCbiBWK%2Bg%3D

Below is my code:
import com.aspose.pdf.Document;
import com.aspose.pdf.HtmlLoadOptions;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Date;

public class Run {
public static void main(String args[]) {
HtmlLoadOptions load = new HtmlLoadOptions(“Try”);
URL pageUrl = null;
try {
pageUrl = new URL(“https://www.questionpro.com/a/TakeSurvey?tt=3wSCbiBWK%2Bg%3D”);
URLConnection urlConnection = pageUrl.openConnection();
Document doc = new Document(urlConnection.getInputStream(),
new HtmlLoadOptions(“https://www.questionpro.com/a/TakeSurvey?tt=3wSCbiBWK%2Bg%3D”));
doc.save(“output.pdf”);
} catch (IOException e) {
e.printStackTrace();
}
}
}

One more issue is it is not generating PDF with CSS properly applied. Output PDF attached.
output.pdf (102.6 KB)

Please look into this issue and suggest some solution. Thanks in advance.

@Darshan_Shah

Thanks for contacting support.

Please note that time taken by the API depends upon many factors like Internet Connection Speed, Structure and Complexity of Content, etc. Furthermore, we were able to notice that API was unable to honor the CSS Style while generating PDF.

Therefore, we have logged an issue as PDFJAVA-38524 in our issue tracking system along with all information about scenario. We will surely investigate the issue in details and keep you posted with its rectification status. Please spare us little time.

We are sorry for the inconvenience.

Thanks for the prompt reply. Regarding time issue, I have pretty fast internet connection. Complexity of the content is also basic as you can see opening the URL. Can you please confirm if it should take this much time (~ 2 mins) to convert it into PDF. Or how much time is it taking for you if you try it in ideal condition?

@Darshan_Shah

We have noticed time varied from 1-2 minutes while conversion from URL to PDF. This behavior has also been logged under the ticket ID PDFJAVA-38526 in our issue tracking system for further investigation. We will let you know as soon as we have some definite updates in this regard.

We are sorry for the inconvenience.