Form1.frm
VERSION 5.00 Begin VB.Form Form1 Caption = "ChangeOutputPageWidth" ClientHeight = 1320 ClientLeft = 120 ClientTop = 465 ClientWidth = 4440 LinkTopic = "Form1" ScaleHeight = 1320 ScaleWidth = 4440 StartUpPosition = 3 'Windows Default Begin VB.CommandButton cmd_change_output_pdf_width Caption = "Change Output Page Width" Height = 855 Left = 480 TabIndex = 0 Top = 240 Width = 3495 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub cmd_change_output_pdf_width_Click() ' Hanlde Error On Error GoTo ErrorHandler: ' Create Bytescout.PDF2HTML.HTMLExtractor object Set extractor = CreateObject("Bytescout.PDF2HTML.HTMLExtractor") extractor.RegistrationName = "demo" extractor.RegistrationKey = "demo" ' Set HTML with CSS extraction mode extractor.ExtractionMode = 1 ' set output width to 200 pixels extractor.OutputPageWidth = 200 ' Load sample PDF document extractor.LoadDocumentFromFile ("sample2.pdf") ' Save extracted HTML to file extractor.SaveHtmlToFile_2 "output.html" MsgBox "PDF file successfully saved as 'output.html'.", vbInformation, "Success" ' Open output file in default associated application CreateObject("WScript.Shell").Run "output.html", 1, False ' Close form Unload Me ErrorHandler: If Err.Number <> 0 Then MsgBox Err.Description, vbInformation, "Error" End If End Sub