Hi,
I have a requirment, where I want to convert an .aspx page into PDF.
Is it possiable using Aspose.Pdf?
Actually I am trying some thing like this
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindHTMLFromUrl("http://www.google.com");
pdf.Save(Server.MapPath("~") + @"\Temp\ImagePDF.pdf");
The resultant PDF(ImagePDF.pdf) contain some garbage text, it won't contain images.
Can you please tell me, how can I exactly covert website or an .aspx page[ AS IT IS] into PDF
Please find the attached output
Thanks
Siraj
Hello Siraj,
Thanks for considering Aspose.
Please visit the following link and check the section Convert Aspx to PDF (end of the page) for information on how to convert .aspx pages into PDF format. Converting Html or Aspx to PDF (Beta version & only .Net Supports)
In case you need to convert an HTML file containing images into PDF format, then please specify the location where the images are located using ImgUrl property of HtmlInfo class.
Please take a look over the following code and the resultant PDF that I've generated is also in attachment, please take a look.
[C#]
// create an instance of PDF class
Pdf pdf = new Aspose.Pdf.Pdf();
WebClient webClient = new WebClient();
byte[] myDataBuffer = webClient.DownloadData(http://www.google.com);
MemoryStream postStream=new MemoryStream (myDataBuffer);
// Specify the location where images are located
pdf.HtmlInfo.ImgUrl = @"http://www.google.com";
pdf.BindHTML(postStream);
// save the resultant PDF file
pdf.Save(@"d:\pdftest\HTML_to_PDF.pdf");
In case of any further query, please feel free to contact.
NOTE: This is Beta version of Html2Pdf. Only simple HTML is supported.