how to convert HTML page into PDF file

how to convert HTML page into PDF file

Forum member · Aug 13, 2007
hi, i want to convert my HTML page into PDF document.and i want to save Generated PDF in disk without open it.please provide me solution for it.

Re: how to convert HTML page into PDF file

Support · Aug 13, 2007
Hello, It is not possible to convert HTML files into PDF documents using our product. The reason we do not offer this conversion is because HTML and PDF are very different in nature and there is no perfect way of converting between them. For instance, HTML is flow able data that is designed specifically for viewing. It can shrink and reformat according to screen size. On the other hand there’s PDF, which is a very concrete and completely fixed document, designed specifically for quality printing. So when tying to convert from HTML to PDF formatting becomes a severe issue. There are products out there that can “convert” HTML to PDF, but the fact of the matter is that these products usually produce unsatisfactory results. In some cases, you will have to change your HTML in order to improve the look of your resulting PDF. Mostly, the products that claim to do this conversion are basically taking a snapshot of how the HTML would print and then converting that to PDF. And you know how unpredictable a printed HTML page can be. Our products are designed for high quality PDF formatting and output. Using them, you can take your data and produce runtime, dynamic PDFs with the ability to control the exact placement of every element on the page. Therefore you will know the look or structure of your PDF before creation time. If your HTML pages are based off of information from a database then you could easily create a PDF that will resemble your original HTML document, but there is no one line conversion. Our Generator for .NET would allow you to create PDFs based off of the same data used to create your HTML file. Another option would be to create a PDF template (or multiple templates) of your different reports, then using our Merger for .NET product, you could simply add your data on top of the template you have created. You can save the generated PDF documents without opening in the browser. You will have to use the Draw method of the document object which takes the file path as string to save the PDF document. Thanks, ceTe Software Support Team.

Re: how to convert HTML page into PDF file

Forum member · Aug 17, 2007
I also need HTML -> PDF convertor. Actually, DynamicPDF has everything I need except TABLE (TR,TH,TD) coverter. Because DynamicPDF did not have TABLE support, I had to use another commercial tool, that converts HTML -> RTF. I'd rather pay extra to CeTe and use one tool instead of making zoo of conponents in my web-app.

Re: how to convert HTML page into PDF file

Support · Aug 17, 2007
Hello, We will be adding support for converting HTML table to PDF in future version of our product but currently we do not have any fixed timeline on when it will be added. Thanks, ceTe Software Support Team

Re: how to convert HTML page into PDF file

Forum member · Jan 22, 2008
Is there any update on whether HTML to PDF feature is going to be added to DynamicPDF?

Re: how to convert HTML page into PDF file

Forum member · Jan 23, 2008
... as well as timeline for incorporating this feature?

Re: how to convert HTML page into PDF file

Support · Jan 23, 2008
Currently we are working on the development of a tool that would allow direct HTML to PDF conversions. This would allow you to take existing HTML documents and convert them directly to PDF. Alternatively, we will also be adding an HtmlTextArea to our object model (probably by version 6.0) that would allow you to add areas as you are building your PDF to interpret the HTML code. A timeline for either of these products is not set. The HTML to PDF converter would likely be available in the next few months, while version 6.0 would likely be around the end of this year. Neither of these times are set in stone however. Thanks, ceTe Software Support Team

Re: how to convert HTML page into PDF file

Forum member · Jan 30, 2008
I'm evaluating the Generator for .NET and I figured out how to make bullet lists with different fonts and colors on a PER BULLET level: subOrderedSubList.Font = Font.CourierOblique; subOrderedSubList.TextColor = RgbColor.Red; subOrderedSubList.Items.Add("Lime"); subOrderedSubList.Font = Font.Helvetica; subOrderedSubList.TextColor = RgbColor.RosyBrown; subOrderedSubList.Items.Add("Orange"); However, I am not sure that this is possible inside a single bullet. I'd like to make a bullet with perhaps multiple paragraphs and different words of different colors or fonts. But the ListItem that makes up a bullet list does not seem to allow me to do this.

Re: how to convert HTML page into PDF file

Support · Jan 30, 2008
As you have noted you can change the formatting on a per bullet case. It is not currently possible to specify formatted text within a bullet. All the text within a bullet will be of the same formatting. I am not sure if this is something that will change in a future version but I can look into this and see if there are any future plans to enhance this. Thanks, ceTe Software Support Team

Re: how to convert HTML page into PDF file

Forum member · Feb 4, 2008
If I make a FormattedTextArea with a default font face of Helvetica, and I give it this text: "<font face='Times'>Hello</font>" it will display the word "Hello" in the Times font. My question is whether I can do this with a custom font. I tried creating a new font: FontFamily comic = new FontFamily("Comic Sans", new TrueTypeFont("Comic.ttf")) And then making a FormattedTextArea with this text: "<font face='comic'>Hello</font>" and also this text: "<font face='Comic Sans'>Hello</font>" and neither displayed text in the comic sans font.

Re: how to convert HTML page into PDF file

Forum member · Feb 4, 2008
Also tried fta.FontFaces.Add(comic) but this didn't seem to work either.

Re: how to convert HTML page into PDF file

Support · Feb 4, 2008
Hello, You can add the font faces to the FormattedTextArea without any problem. You can display the text in different fonts using the true type or type1 fonts. You will have to create a FontFamily object using the true type font and add it to the font faces of the formatted text area. Following is some sample code. //Create the document Document doc = new Document(); Page page = new Page(); String strText = "<font face=Times>times font</font> <font>default font</font> <font face=tahoma>tahoma font</font>"; //Create the true type font object TrueTypeFont ttf = new TrueTypeFont(@"C:\Temp\tahoma.ttf"); //Create the font family using the ttf object FontFamily family = new FontFamily("tahoma", ttf); FormattedTextArea fTextArea = new FormattedTextArea(strText, 67, 20, 420, 20, FontFamily.Courier, 16, true); //add the font family to the formatted textarea fTextArea.FontFaces.Add(family); fTextArea.Height = fTextArea.GetRequiredHeight(); page.Elements.Add(fTextArea); doc.Pages.Add(page); doc.DrawToWeb(); Thanks, ceTe Software Support Team.

Re: how to convert HTML page into PDF file

Forum member · Feb 4, 2008
Oh, ok thanks I got it to work! It only works if you call GetRequiredHeight after you call FontFaces.Add.

Re: how to convert HTML page into PDF file

Support · Feb 4, 2008
Hello, No, you do not have to call the GetRequiredHeight method in order to set the font faces. This method is to get the height required by the formatted textarea. Following code is important to add the font faces. //Create a ttf object TrueTypeFont ttf = new TrueTypeFont(@"C:\Temp\tahoma.ttf"); //Create a font family using the ttf object FontFamily family = new FontFamily("tahoma", ttf); FormattedTextArea fTextArea = new FormattedTextArea(strText, 67, 20, 420, 50, FontFamily.Courier, 16, true); //Add the font family to the formattedtextarea. fTextArea.FontFaces.Add(family); Whenever you want to use this font for the text you will have to use the following font tag in the formattedtextarea's string. <font face=tahoma>tahoma font</font> Thanks, ceTe Software Support Team.

Re: how to convert HTML page into PDF file

Forum member · Feb 4, 2008
Right. Testing it again it looks like if I leave out this call: fta.Height = fta.GetRequiredHeight(); it works, and if I make that call after the FontFaces.Add call it works, but if I do this: fta.Height = fta.GetRequiredHeight(); fta.FontFaces.Add(family); then the text is displayed in the default font instead of the newly added one.

Re: how to convert HTML page into PDF file

Support · Feb 4, 2008
Hello, I will have the developers look into this and post a reply as soon as I have further updates. As a workaround, if you do not need to reset the height of the FormattedTextArea then you can remove the line fta.Height = fta.GetRequiredHeight(); from your code and that will solve the problem for you. Thanks, ceTe Software Support Team

Re: how to convert HTML page into PDF file

Forum member · Feb 5, 2008
We would love to see the HtmlTextArea in version 5.0 instead. 6.0 will be too late for us. Is there any chance it will be moved up? Thanks!!!

Re: how to convert HTML page into PDF file

Support · Feb 6, 2008
Hello, We do have developers already working on this feature. We cannot guarantee if this feature will be available in v5.0 of the product. Please send an email to our [^a|mailto:support@cete.com|Support Team^] so that they can add you to the list of beta testers and notify you when this feature is available for beta testing. Thanks, ceTe Software Support Team