Free Support Forum - aspose.com

Issues with web page to PDF

Issues while converting web page to PDF

Hi Sandeep,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.Pdf.

Please share the details regarding the issue you are facing and provide us your sample code and template file to generate the issue, so we can check your issue and reply you accordingly.

Thank You & Best Regards,

Hello

I am priniting data in Table format on web page (using dot net 1.1) which is dynamic. It is coming up well on web page but what I want is to create the PDF page instead of displaying on web page. So do you have any method/function which transfers out put from xxxx.aspx.vb & crates PDF file instead of displaying on web page.

Hi Sandeep,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for the details

Yes, Aspose.Pdf for .NET provides the feature to convert xxxx.aspx.vb to PDF file. Please see the following documentation link regarding HTML to PDF conversion with sample code. You can check the section which explains converting a web page hosted over some web server.

How to – Convert HTML to PDF using InLineHTML approach

Please feel free to contact support in case you have any further queries.

Thank You & Best Regards,

Thanks for quick turn around.The link provided looks useful for me but I still have few questions 1) As discribed, we want to convert the output of a xxxx.aspx.vb page not a web page hosted on the same server. Do you think the same code snippet can be applied to solve the issue. 2) We do not want to save the PDF on the local drive, When user generates the report, we want to open it in the PDF. 3) Also let me know which dll has to be added in the referance?

Please suggest.

thnx
-Sandeep

Hi Sandeep,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for the feedback.

Sandeep8727:
As discribed, we want to convert the output of a xxxx.aspx.vb page not a web page hosted on the same server. Do you think the same code snippet can be applied to solve the issue.

Well, Aspose.Pdf for .NET will require the generated HTML to convert it to PDF file. So, if you can get the HTML of xxxx.aspx.vb page, you can convert it to PDF. It does not matter if it is hosted on the same server or some different server. In case your requirement is different from my understanding, please do share the details about your scenario.

Sandeep8727:
2) We do not want to save the PDF on the local drive, When user generates the report, we want to open it in the PDF.

You can use the HttpResponse Object and SaveType.OpenInAcrobat to open the file in Adobe Acrobat. Please see the following code to get the idea regarding how to achieve your desired results:

// Instantiate an object PDF class

Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();

// add the section to PDF document sections collection

Aspose.Pdf.Generator.Section section = pdf.Sections.Add();

// Read the contents of HTML file into StreamReader object

StreamReader r = File.OpenText(@"D:/pdftest/HTML2pdf.html");

//Create text paragraphs containing HTML text

Aspose.Pdf.Generator.Text text2 = new Aspose.Pdf.Generator.Text(section, r.ReadToEnd());

// enable the property to display HTML contents within their own formatting

text2.IsHtmlTagSupported = true;

//Add the text paragraphs containing HTML text to the section

section.Paragraphs.Add(text2);

// Specify the URL which serves as images database

pdf.HtmlInfo.ImgUrl = "D:/pdftest/MemoryStream/";

Response.ClearContent();

Response.ClearHeaders();

Response.ContentType = "application/pdf";

pdf.Save("headings.pdf", Aspose.Pdf.Generator.SaveType.OpenInAcrobat, Response);

Response.End();

Sandeep8727:
3) Also let me know which dll has to be added in the referance?

Please see the following documentation link for details regarding installing and referencing the DLLs of Aspose.Pdf for .NET in your application.

Installation

Reference Aspose.Pdf from a .NET project

Please feel free to contact support in case you need any further assistance.

Thank You & Best Regards,

Thanks for the response. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I tried to work on the code you suggested above. Looks this will help us. But we have 1 more issue here.

After adding Aspose.Pdf reference in our dot net 1.1 project, we realized that we cannot instantiate Aspose.Pdf.Generator.Pdf method in our project. We are using version 5.2.1.0. Any idea why it is not showing up? If this method is available in new version, Do we need to buy the updated version even if we have the license copy of all ASPOSE component? If yes then How much is the cost? Please get back to me ASAP as we have to implement this soon.

If you got a question/want to talk to me directly, reach me at 210-543-4468 (8:30AM - 5.00PM CST)..

Thanks in advance.

Hi Sandeep,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for the feedback.

Aspose.Pdf.Generator namespace is introduced after Aspose.Pdf for .NET v6.0 (after merging of Aspose.Pdf for .NET and Aspose.Pdf.Kit for .NET). We would suggest you to upgrade you license and try the latest version of Aspose.Pdf for .NET v7.4. You can see the following link for details regarding how to upgrade the code from pre Aspose.Pdf for .NET v6.0 to latest versions.

Migration from earlier versions of Aspose.Pdf for .NET

Also, you may get a 30 days free temporary license for testing purpose. For that, please use the below link to acquire a temporary license (choose “Get a Temporary License” option).

http://www.aspose.com/purchase/default.aspx

Regarding your sales related queries, please contact our sales team using Aspose.Purchase Forum using the following link.

http://www.aspose.com/community/forums/aspose.purchase/220/showforum.aspx

Please feel free to contact support in case you need any further assistance.

Thank You & Best Regards,

My requirement is, To generate the PDF from a web page which is dynamically generated. I am generating a string which has data in Table format & then I am printing it on using Response.Write option which generates the report. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

String is generating like :
strHTML = "

TEST 1 TEST 2
"

like this there are lot of HTML tags generateds ferom web page (xxxx.vb.aspx)

My output to Web Page is generating the report as per the requirement but Currently I am facing an issue while converting the same web page in to PDF report (dot net 1.1).

What we want is once user clicks on the Report button, It generates the web page report, but they wants to put all that data into PDF so that they can print on legal page or save.

Hi Sandeep,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Well, you can pass your HTML string to the above code I shared at 421550 in the following line and it should work fine as per your scenario to generate the PDF file.

//Create text paragraphs containing HTML text

Aspose.Pdf.Generator.Text text2 = newAspose.Pdf.Generator.Text(section, r.ReadToEnd());

In case you are facing any issue in PDF generation, please share your code with complete HTML and we will check it and get back to you soon.

Sorry for the inconvenience,