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

searchable pdf from Html

Hi,

In your release notes http://www.syncfusion.com/support/releasenotes/4.3.0.30/windows/pdf.aspx
mentioned that Syncfusion support convertion Html to PDF and PDF document remains searchable. How to do it? Thank you for quick response.

Anatoliy

5 Replies

MW Melba Winshia Syncfusion Team June 27, 2007 12:25 PM UTC

Hi Anatoliy,

Yes, We provide support for converting html web page to PDF file. While converting HTML web page to PDF, it converts the web page into image [Bitmap image or metafile] using HtmlConverter and renders that image into PDF.

* Bitmap image will have low resolution but the conversion will be fast. Metafile will be slow, but will have high resolution and text in it is readable.

* The HTMLConverter uses the MSHTML rendering library to render HTML documents. The MSHTML library is the engine that is used to drive the Internet Explorer.

Steps to convert the HTML page to PDF
--------------------------------------

Using HtmlConverter, we can convert as follows:

i) The HTML page is first converted to a bitmap image or a Metafile.
Image bmp = html.ConvertToImage("Sample.html"),ImageType.Bitmap)

ii) Then the image is drawn into the PDF document.
doc.LastPage.Graphics.DrawImage(PointF.Empty, bmp, dest, properties);

Samples:
--------

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

Herewith I have attached the sample for your reference:
http://websamples.syncfusion.com/samples/PDF.Windows/P33790//main.htm

Here is a PDF generated with bitmap option:
HTML to PDF-BMP.zip

Kindly let me know if you have any other questions.

Thanks,
Melba


AK Anatoliy Krysan June 27, 2007 12:38 PM UTC

Hi Melba,

But after converting PDF to bitmap and bitmap to PDF the resulting PDF is not searchable. It is like normal image. I can't select some text and copy to buffer. I can't press Ctl+F and find some word. Does Syncfusion allow convert Html to SEARCHABLE PDF?

Anatoliy


MW Melba Winshia Syncfusion Team June 27, 2007 01:24 PM UTC

Hi Anatoliy,

If you convert to metafile instead of bitmap you can search the text. Please refer the following code snippet to achieve this:

[C#]

Image bmp = html.ConvertToImage("Sample.html"),ImageType.Metafile)

Kindly let me know if you have any other questions.

Thanks,
Melba


AK Anatoliy Krysan June 27, 2007 01:58 PM UTC

Hi Melba,

I was try to make PDF how you recommend but it's doesn't help. Please find attached ZIP file. Sync_Input.png - input details
htmltopdf.pdf - result PDF.
What I did wrong because PDF still not searchable.

Anatoliy

Sync13.zip


MW Melba Winshia Syncfusion Team June 28, 2007 11:57 AM UTC

Hi Anatoliy,

Could you please open a new direct – trac incident with subject line as Forum 63042 - searchable pdf from Html? So that it would be possible for us to provide more details regarding this issue.

Thanks,
Melba



Loader.
Live Chat Icon For mobile
Up arrow icon