We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

HTML in PDF

Thread ID:

Created:

Updated:

Platform:

Replies:

44853 Jun 5,2006 03:40 PM Mar 16,2007 05:49 PM Windows Forms 18
loading
Tags: PDF
Michelle Cutchins
Asked On June 5, 2006 03:40 PM

When I put the following code in a Web form as part of a sample provided by you, Syncfusion, HTMLToDoc sample... HTMLToDLS convertor = new HTMLToDLS(); convertor.Convert( document , "This is normal text" ); I receive the following error: bounds Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentException: bounds line 168 -> document.Save( "Sample.pdf", Response , Syncfusion.Pdf.HttpReadType.Save); The only part I changed was hardcoding the HTML string instead of using the default text from the provided textbox. Is there something I am doing incorrectly to receive this error? That is the only line of code I changed within the sample project. Also, does the HTML have to be included as part of an HTML page? It can''t take a piece of HTML and add it to the PDF file? For example, does the HTML string have to be "< html >< body >< H1 > Hello < / H1> < / body> < / html >" or can I simply pass in " < h1 > Hello < / h1 >"? Thanks for the help!

Ajish [Syncfusion]
Replied On June 6, 2006 05:09 AM

Hi Michelle, The code that you use is correct, you can convert normal text or part of html page and convert it to pdf. Here is a asp.net sample which does the same: HTMLToDoc.zip Please take a look at this sample and let me if you have any other questions. Thanks, Ajish.

Michelle Cutchins
Replied On June 6, 2006 04:55 PM

Is there a reason why when I try to add a section/paragraph above or below the HTML conversion in the sample, I receive an error? Code: //Add a section in the PDF document. IPDFSection section = document.AddSection(); //Adding a paragraph to the section. IPDFParagraph paragraph = section.AddParagraph(); paragraph.AppendText("Hello World!"); HTMLToDLS convertor = new HTMLToDLS(); convertor.Convert(document, "

Hello

"); section = document.AddSection(); //Adding a paragraph to the section. paragraph = section.AddParagraph(); //Adding text to the paragraph. paragraph.AppendText("Hello World!"); document.Save( "Sample.pdf", Response , Syncfusion.Pdf.HttpReadType.Save); I was trying to add text above and below the HTML section but get a "bounds" error message. "Exception Details: System.ArgumentException: bounds" Thanks!

Ajish [Syncfusion]
Replied On June 7, 2006 02:20 AM

Hi Michelle, I am afraid I was unable to reprodue problem. Here is sample which does exactly the same as you do: HTMLToDoc.zip Could you please try this one and let me know if the problem still exists, if so can you send me with more details the stack trace of the error modify the existing sample to reproduce the error so that I can further investigate on this issue. Thanks, Ajish.

Michelle Cutchins
Replied On June 7, 2006 11:55 AM

I am attaching my project, that contains the code from your sample, and I still receive an error message. Thanks! Michelle

HTMLToDoc.zip

Jason Jensen
Replied On October 9, 2006 12:05 PM

I am having this error too. Did anyone ever receive an answer?

>I am attaching my project, that contains the code from your sample, and I still receive an error message.
>
>Thanks!
>Michelle

HTMLToDoc.zip

Jason Jensen
Replied On October 9, 2006 12:05 PM

I am having this error too. Did anyone ever receive an answer?

>I am attaching my project, that contains the code from your sample, and I still receive an error message.
>
>Thanks!
>Michelle

HTMLToDoc.zip

Jason Jensen
Replied On October 9, 2006 12:11 PM

What was the solution to this problem? I am having a similar issue.

Dhivya K [Syncfusion]
Replied On October 10, 2006 01:21 PM

Hi Jason,

I tried testing this issue. I am afraid.I am unable to reproduce the issue.

Html text can be added in PDF in two ways using flow model:

1) Adding html text by using HTMLToDLS convertor in between the sections as in the case of previous post.

Here is a sample for your reference:
www.syncfusion.com/support/user/uploads/HTMLToDoc.zip

Could you please run this sample and let me know if the problem exist?

2) You can also add html using "InsertHTML" method, for which I shall provide you with a sample by tomorrow. This method is available from 4.3.0.30 release.

Regards,
Dhivya.

Dhivya K [Syncfusion]
Replied On October 11, 2006 03:14 AM

Hi Jason,

Here is a sample to insert HTML text between sections using InsertHTML() method.
InsertHTML.zip

Please take a look into it and let me know if you have anyother queries.
Note: InsertHTML() is included from 4.3.0.30 release.

Thanks,
Dhivya.

Jimmy Wang
Replied On October 27, 2006 03:44 PM


void menuSaveFundingMemoAsPDF_Click(object sender, EventArgs e)
{
SaveFileDialog saveFileDialog = new SaveFileDialog();

saveFileDialog.Filter = "PDF files (*.pdf)|*.pdf|All files (*.*)|*.*";
saveFileDialog.FilterIndex = 1;
saveFileDialog.RestoreDirectory = true;
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
//PDFDocument pdfDoc = new PDFDocument();
//pdfDoc.Pages.Remove(pdfDoc.Pages[0]);
PDFLogicDocument pdfDoc = new PDFLogicDocument();

Dictionary gridList = GetAllGrids(TabExcelSplit, false);
foreach (KeyValuePair kvp in gridList)
{
string sheetName = kvp.Key;
GridControl grid = kvp.Value;
if (sheetName.Trim() == "Funding Memo")
{
SettlementBlastGridBase.ImportGridDataToPDFPage(pdfDoc, grid);
break;
}
}

pdfDoc.Save(saveFileDialog.FileName);
//System.Diagnostics.Process.Start(saveFileDialog.FileName);

pdfDoc.Close();
}
}


I got the same error message from the Save function call. It was working before.

>Hi Jason,

Here is a sample to insert HTML text between sections using InsertHTML() method.
InsertHTML.zip

Please take a look into it and let me know if you have anyother queries.
Note: InsertHTML() is included from 4.3.0.30 release.

Thanks,
Dhivya.

Dhivya K [Syncfusion]
Replied On November 1, 2006 08:08 AM

Hi Jimmy,

Thanks for the code snippet.
I refered your stack trace which you have posted in following url:
http://www.syncfusion.com/support/forums/message.aspx?&MessageID=51125
Can you please provide me with the details regarding your system configuration,.Net framework version and Essential studio version.This will help me investigating further on this issue.

Thanks,
Dhivya.

Marc Ziss
Replied On December 18, 2006 11:50 AM

Dhivya,
I want to convert an entire HTML doc (not just some text) to a pdf; Is the InsertHTML() the best way to do this? I'm having problems (it hangs) with saving it after reading the entire html document in.
Thanks for your help,
Marc

>Hi Jason,

Here is a sample to insert HTML text between sections using InsertHTML() method.
InsertHTML.zip

Please take a look into it and let me know if you have anyother queries.
Note: InsertHTML() is included from 4.3.0.30 release.

Thanks,
Dhivya.

Dhivya K [Syncfusion]
Replied On December 22, 2006 01:53 AM

Hi Marc,

Thank you for your interest in Essential PDF.

InsertHTML can handle only simple html strings. However, we do have option to convert a html page into image[bitmap or metafile] and render that image into the PDF document.

Converting to Bitmap image will have lower resolution, but it will be fast.

Converting to Metafile will have high resolution and the text will be searchable,but it will be slow.

You can find the sample at the following url:
C:\Program Files\Syncfusion\Essential Studio\4.4.0.51\Windows\Pdf.Windows\Samples\Grid Model\HTMLToPDF

Please let me know if you have any queries.

Regards,
Dhivya.

Florin
Replied On January 19, 2007 01:42 PM

Hi,

I've been running the C:\Program Files\Syncfusion\Essential Studio\4.4.0.51\Windows\Pdf.Windows\Samples\Grid Model\HTMLToPDF sample and I noticed with metafile options checked the image for http://www.syncfusion.com is not correct. In the left side the text "The Syncfusion Grid is atleast 3 times " overlaps with the next line.
When generating an image (uncheck the metafile option) the result is correct. Why is happening this?

Then I tried to generate a PDF with an image that spans on many pages but I couldn't find a way to insert page number in the bottom without to have the image overlapping with the footer. Do you have any sample for this?

Regards,
Florin


>Hi Marc,

Thank you for your interest in Essential PDF.

InsertHTML can handle only simple html strings. However, we do have option to convert a html page into image[bitmap or metafile] and render that image into the PDF document.

Converting to Bitmap image will have lower resolution, but it will be fast.

Converting to Metafile will have high resolution and the text will be searchable,but it will be slow.

You can find the sample at the following url:
C:\Program Files\Syncfusion\Essential Studio\4.4.0.51\Windows\Pdf.Windows\Samples\Grid Model\HTMLToPDF

Please let me know if you have any queries.

Regards,
Dhivya.

Dhivya K [Syncfusion]
Replied On January 22, 2007 08:30 AM

Hi Florin,

Thank you for your interest in Essential PDF.

I tried testing this issue with overlapping text with metafile option. I am afraid. I am unable to reproduce the issue.
Here is a sample PDF generated.
http://www.syncfusion.com/Support/user/uploads/sample_adb1db78.pdf

As said in my previous post,Converting to Bitmap image will have lower resolution, but it will be fast.
Converting to Metafile will have high resolution and the text will be searchable,but it will be slow.

Regarding rendering the image without overlapping the footer,add the footer before you render the image into PDF.
Here is a sample for your reference:
HTML_to_PDF.zip

Please take a look into the sample and let me know if you have any other queries.

Regards,
Dhivya.

Jimmy Wang
Replied On March 15, 2007 02:54 PM

It happens when trying to export a grid to a PDF file. Following is the call stack:

Stack Trace : at Syncfusion.Layouting.LayoutArea.TopSubtract(RectangleF bounds)
at Syncfusion.Layouting.LCLineContainer.CommitForClosed(LCBase childContext)
at Syncfusion.Layouting.LCContainer.CommitChildContext(LCBase childContext)
at Syncfusion.Layouting.LCContainer.Layout(RectangleF rect)
at Syncfusion.Layouting.LCContainer.DoLayoutChild(LCBase childContext)
at Syncfusion.Layouting.LCContainer.Layout(RectangleF rect)
at Syncfusion.Layouting.LCContainer.DoLayoutChild(LCBase childContext)
at Syncfusion.Layouting.LCContainer.Layout(RectangleF rect)
at Syncfusion.Layouting.Layouter.Layout(IWidgetContainer wtContainer, ILayoutProcessHandler lpHandler, CustomGraphics cg)
at Syncfusion.DLS.Rendering.DocumentLayouter.LayoutPages()
at Syncfusion.DLS.Rendering.DocumentLayouter.Layout(IDocument doc, CustomGraphics cg)
at Syncfusion.Pdf.DLS.PDFLogicDocument.DrawToInnerDocument()
at Syncfusion.Pdf.DLS.PDFLogicDocument.Save(String fileName)

It does not happen when starting my app to debug.

Administrator [Syncfusion]
Replied On March 16, 2007 05:48 PM

Hi Jimmy,

Thank you for your continued interest in Syncfusion products.

Can you please provide us with some detailed information on this issue. Also can you please proivde us the details regarding your system configuration, .Net Framework version and Essential studio version you are working with.

Please let me know if you face any issues.

Thanks,
Dhivya.

Administrator [Syncfusion]
Replied On March 16, 2007 05:49 PM

Hi Jimmy,

Thank you for your continued interest in Syncfusion products.

Can you please provide us with some detailed information on this issue. Also can you please proivde us the details regarding your system configuration, .Net Framework version and Essential studio version you are working with.

Please let me know if you face any issues.

Regards,
Sarath

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;