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. Image for the cookie policy date
close icon

HttpReadType

Hello, How do I resolve this error?

Error 34 The type 'Syncfusion.Pdf.HttpReadType' exists in both
'C:\Windows\assembly\GAC_MSIL\Syncfusion.Pdf.Base\9.103.0.20__3d67ed1f87d44c89\Syncfusion.Pdf.Base.dll' and

'D:\Perforce\Current\Portal\WebGui\ASPX\Bin\syncfusion.pdf.base.dll'

D:\Perforce\Current\Portal\WebGui\ASPX\ExportQueue.aspx.cs 293 76 D:\...\ASPX\

And is there anyway to pass cookies to HTML to PDF from String conversion?



3 Replies

GM Geetha M Syncfusion Team March 8, 2011 07:23 AM UTC

Hi Travis,

Thank you for your interest in Syncfusion products.

1. To solve the Error:
You can avoid the error by removing the assemblies from the local folder (Bin).

2. HTML To PDF:
It is possible to convert a HTML string to PDF. You may use the HTML string from the cookies as in the code given below.

PdfDocument pdf = new PdfDocument();
PdfPage page = pdf.Pages.Add();
int width = (int)page.GetClientSize().Width;

string html = Request.Cookies["Name"].Value;

using (HtmlConverter converter = new HtmlConverter())
{
converter.EnableHyperlinks = true;
converter.EnableJavaScript = true;

using (HtmlToPdfResult result = converter.Convert(html, ImageType.Metafile, width, -1, AspectRatio.KeepWidth))
{
PdfMetafileLayoutFormat format = new PdfMetafileLayoutFormat();
format.Layout = PdfLayoutType.Paginate;

result.Render(page, format);
}
}

pdf.Save("Sample.pdf", Response, HttpReadType.Save);
pdf.Close(true);

Please try this and let us know if you have any questions.

Regards,
Geetha



TP Travis Powell March 8, 2011 06:34 PM UTC

Hi Geetha,

Thank you so much for the update. I'm wondering if it's possible to submit cookies to the converter as well. I haven't found any methods that allow me to send cookies, but I'm sure there must be a way.

Thanks!

Travis



GM Geetha M Syncfusion Team March 9, 2011 09:03 AM UTC

Hi Travis,

Sorry for the confusion.

With the current implementation of HtmlConverter, it is not possible to access the webbrowser’s properties to and it does not have the support to add the cookies to the target response.

Please let us know if you have any other questions.

Regards,
Geetha


Loader.
Live Chat Icon For mobile
Up arrow icon