Exporting to PDF via WebRequest and Stream

Hi,

I would like to export a webpage as image in PDF. Tried this from webresponse via stream. I use AsposePDF 9.1. I use Import() of Aspose PDF Generator. I am not getting the stream added to the final output PDF.

Please let me know the cause and ways to fix this issue.

Code

Pdf pdf = new Pdf();
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://www.google.com");
myRequest.Method = "GET";
WebResponse myResponse = myRequest.GetResponse();
StreamReader sr = new StreamReader(myResponse.GetResponseStream());
pdf.Import(sr);
sr.Close();
pdf.Save("C:/AsposePDFTest/WebPageOutput.pdf");

Thanks

Hi Omnath,


Thanks for contacting support.

In order to convert HTML contents to PDF format, please follow the instructions specified over Convert HTML to PDF Format.

If your requirement is to place HTML contents as image, you may first convert the HTML to PDF format, save the output in Image format and then convert the image back to PDF format. For further details, please visit

Hi,


Thanks for the update. My request was for a webpage to PDF via Webresponse and Stream.
I am trying the same functionality with some more changes in my previous code. I will check and get back.

Thanks.

Hi Nayyer,


I did some more changes in the code and tried the webpage to PDF conversion via Webresponse and Stream. But I did not get the output as expected. I even tried with Aspose Tech article example @ http://www.aspose.com/docs/display/pdfnet/Convert+HTML+to+PDF+Format (Section: Convert Web page to PDF). Issue observed is that pdf output contents is not appearing as in url passed. I see a complete mis-alignment in the pdf content when tried for a sample url (google.com).

Please provide your input.

Thanks,
Omnath

omnath:
Thanks for the update. My request was for a webpage to PDF via Webresponse and Stream.
I am trying the same functionality with some more changes in my previous code. I will check and get back.
Hi Omnath,

Please note that this forum is intended to cater the requests/queries regarding Aspose.Pdf product family and in case you have queries related to API's other than Aspose, you may consider posting them in other public forums.
omnath:
I did some more changes in the code and tried the webpage to PDF conversion via Webresponse and Stream. But I did not get the output as expected. I even tried with Aspose Tech article example @ http://www.aspose.com/docs/display/pdfnet/Convert+HTML+to+PDF+Format (Section: Convert Web page to PDF). Issue observed is that pdf output contents is not appearing as in url passed. I see a complete mis-alignment in the pdf content when tried for a sample url (google.com).
Hi Omnath,

Thanks for using our API's.

The HTML to PDF conversion is a complex feature and with every new release, we are working on making this feature robust enough so that it can cater most of HTML standards/tags etc. I have also observed the formatting issues when converting www.google.com to PDF format. However, if you are facing an issue while converting any of your HTML files to PDF format, please share the resource file so that we can further look into this matter. We are sorry for this inconvenience.

Hi Nayyer,


Thanks. Can you please tell the workaround for fixing this issues in webpage (like www.google.com) conversion to pdf? Will there be a new version of Aspose PDF which can fix this if no workaround is available at this point.

Thanks,
Omnath

I was referring the code related to Aspose PDF API only. Thanks

Hi Omnath,


Thanks for sharing the details.

For the sake of correction, I have logged this problem
as PDFNEWNET-36833 in our issue tracking system. We will further
look into the details of this problem and will keep you updated on the status
of correction. Please be patient and spare us little time. We are sorry for
this inconvenience.

Hi Nayyer,

Thanks for logging. Could you please provide the ETA for this issue fix? If the issue is fixed, it would help a lot in easy conversion of my application webpage to pdf.

Thanks,
Omnath

Hi Omnath,


As we
just have been able to notice this issue, so development team requires
little time to investigate and figure out the reasons of this problem.
Nevertheless, as soon as we have made some definite progress towards
its resolution, we would be more than happy to update you with the status of
correction.
<o:p></o:p>

My humble request is to please be patient and spare us little time.

Hi Nayyer,

Thanks for the update. Can you please update your tech articles & help links with note or known issues accordingly. Just noticed another tech help page with a code on webpage to pdf (

http://www.aspose.com/docs/display/pdfnet/How+to+convert+HTML+to+PDF+using+InLineHTML+approach

) which is also not working. I get a 0 byte pdf output. Please comment.

Thanks,

Omnath

Hi Omnath,


Thanks for sharing the feedback. As per suggestion, we have indicated the limitation on above stated page.


Hi Nayyer,

Thanks for updating page. Can you please update the note also @ http://www.aspose.com/docs/display/pdfnet/Convert+HTML+to+PDF+Format (Section: Convert Web page to PDF) (Page that was initially quoted by me).

Thanks,

Omnath

omnath:

Hi Nayyer,

Thanks for updating page. Can you please update the note also @ http://www.aspose.com/docs/display/pdfnet/Convert+HTML+to+PDF+Format (Section: Convert Web page to PDF) (Page that was initially quoted by me).

Thanks,

Omnath

Hi Omnath,

Thanks for the intimation. I have added the information on respective product page.

Hi Omnath,


Thanks for your patience.

Sure. As soon as we have some further updates regarding the resolution of PDFNEWNET-36833, we will let you know.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan