Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Aug 13, 2019 3:34 pm

Hello,

When i convert HTML to pdf, the pdf text is not selectable. (it is like an image)
How can i achieve that?

Code:

Private Sub HtmlToPDF()
Dim doc As PdfDocument = New PdfDocument()
Dim setting As PdfPageSettings = New PdfPageSettings()
setting.Size = New SizeF(800, 1148)
setting.Margins = New Spire.Pdf.Graphics.PdfMargins(20)
Dim htmlLayoutFormat As PdfHtmlLayoutFormat = New PdfHtmlLayoutFormat()
htmlLayoutFormat.IsWaiting = True
Dim url As String = "mijnurl"
Dim thread As Thread = New Thread(Sub()
doc.LoadFromHTML(url, True, True, True, setting, htmlLayoutFormat)

End Sub)
thread.SetApartmentState(ApartmentState.STA)
thread.Start()
thread.Join()
doc.SaveToFile("e:\tmp\tmp.pdf")
doc.Close()
System.Diagnostics.Process.Start("e:\tmp\tmp.pdf")
End Sub


Thanks!

info@garnisoft.nl
 
Posts: 2
Joined: Wed Dec 05, 2018 4:31 pm

Wed Aug 14, 2019 6:24 am

Hi,

Thanks for your inquiry. This is Amber from E-iceblue support team.
The method you used to convert html to pdf depends on IE kernel, if the IE version is IE9 or above, when you convert html to pdf, the text in the result Pdf file will not be selectable. On the other hand, if the IE version is below IE9 or you use the Plugin method to convert, the text in result file will be selectable.
Yet we have plugin method which could convert HTML to PDF with selectable text. Here is a tutorial for you: How to convert HTML to PDF with new Plugin.
If the issue still exists, please offer us your input URL and the output Pdf file for further investigation.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Wed Aug 14, 2019 6:23 pm

Thanks for the info.

Yes I have try the new plugin and it works fine with static pages.
But when I want to convert an Angular page (with js and databind stuf) to pdf I get a blank page.
Even when I change the time out to 9000.

Greetz
Chris

info@garnisoft.nl
 
Posts: 2
Joined: Wed Dec 05, 2018 4:31 pm

Thu Aug 15, 2019 8:29 am

Hi,

Thanks for your reply.
To help us investigate your issue accurately, please offer us following information.
1. Your input Html file
2. Your complete code for reproducing your issue
3. The OS and Region information, e.g. Win7 64bit, China/Chinese.
You could upload them here or send us(support@e-iceblue.com) via email.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Return to Spire.PDF