How to convert PDF to HTML with/without CSS in VBScript and VB6 with PDF To HTML SDK - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

How to convert PDF to HTML with/without CSS in VBScript and VB6 with PDF To HTML SDK

  • Home
  • /
  • Articles
  • /
  • How to convert PDF to HTML with/without CSS in VBScript and VB6 with PDF To HTML SDK

The samples below show PDF to HTML conversion in VBScript and Visual Basic 6 using Bytescout PDF To HTML SDK.

You can select from two options:

Convert PDF to HTML (simple layout)

' Create <span data-scayt_word="Bytescout.PDF2HTML.HTMLExtractor" data-scaytid="78">Bytescout.PDF2HTML.HTMLExtractor</span> object
Set extractor = <span data-scayt_word="CreateObject" data-scaytid="97">CreateObject</span>("<span data-scayt_word="Bytescout.PDF2HTML.HTMLExtractor" data-scaytid="79">Bytescout.PDF2HTML.HTMLExtractor</span>")
<span data-scayt_word="extractor.RegistrationName" data-scaytid="80">extractor.RegistrationName</span> = "demo"
<span data-scayt_word="extractor.RegistrationKey" data-scaytid="81">extractor.RegistrationKey</span> = "demo"

' Set plain HTML extraction mode
<span data-scayt_word="extractor.ExtractionMode" data-scaytid="86">extractor.ExtractionMode</span> = 0

' Load sample PDF document
<span data-scayt_word="extractor.LoadDocumentFromFile" data-scaytid="87">extractor.LoadDocumentFromFile</span>("....<span data-scayt_word="sample2.pdf" data-scaytid="88">sample2.pdf</span>")

' Save extracted HTML to file
<span data-scayt_word="extractor.SaveHtmlToFile" data-scaytid="93">extractor.SaveHtmlToFile</span>("<span data-scayt_word="output.html" data-scaytid="94">output.html</span>")

' Open output file in default associated application
Set shell = <span data-scayt_word="CreateObject" data-scaytid="102">CreateObject</span>("<span data-scayt_word="WScript.Shell" data-scaytid="103">WScript.Shell</span>")
<span data-scayt_word="shell.Run" data-scaytid="104">shell.Run</span> "<span data-scayt_word="output.html" data-scaytid="105">output.html</span>", 1, <span data-scayt_word="false" data-scaytid="110">false</span>
Set shell = Nothing

Set extractor = Nothing

Convert PDF to HTML (with layout)

' Create <span data-scayt_word="Bytescout.PDF2HTML.HTMLExtractor" data-scaytid="115">Bytescout.PDF2HTML.HTMLExtractor</span> object
Set extractor = <span data-scayt_word="CreateObject" data-scaytid="117">CreateObject</span>("<span data-scayt_word="Bytescout.PDF2HTML.HTMLExtractor" data-scaytid="116">Bytescout.PDF2HTML.HTMLExtractor</span>")
<span data-scayt_word="extractor.RegistrationName" data-scaytid="118">extractor.RegistrationName</span> = "demo"
<span data-scayt_word="extractor.RegistrationKey" data-scaytid="119">extractor.RegistrationKey</span> = "demo"

' Set HTML with CSS extraction mode
<span data-scayt_word="extractor.ExtractionMode" data-scaytid="122">extractor.ExtractionMode</span> = 1

' Load sample PDF document
<span data-scayt_word="extractor.LoadDocumentFromFile" data-scaytid="123">extractor.LoadDocumentFromFile</span>("....<span data-scayt_word="sample2.pdf" data-scaytid="124">sample2.pdf</span>")

' Save extracted HTML to file
<span data-scayt_word="extractor.SaveHtmlToFile" data-scaytid="125">extractor.SaveHtmlToFile</span>("<span data-scayt_word="output.html" data-scaytid="126">output.html</span>")

' Open output file in default associated application
Set shell = <span data-scayt_word="CreateObject" data-scaytid="127">CreateObject</span>("<span data-scayt_word="WScript.Shell" data-scaytid="128">WScript.Shell</span>")
<span data-scayt_word="shell.Run" data-scaytid="129">shell.Run</span> "<span data-scayt_word="output.html" data-scaytid="130">output.html</span>", 1, <span data-scayt_word="false" data-scaytid="131">false</span>
Set shell = Nothing

Set extractor = Nothing

Tutorials:

prev
next