Question Setup to use PdfDistiller?

pctechtv

New member
Joined
Oct 12, 2016
Messages
2
Programming Experience
5-10
I know very little about Visual Basic. I know a few things about Visual Studio because I have learned C programing in it and used it for Typescript and PHP development. Right now, I have a need to use this guide to automate PDF Creation. I have experience with Visual Basic to set up some things in other programs that use it as a scripting language. I am trying to figure out the best way to use the command here on page 5
VB.NET:
Dim pdf As PdfDistiller
pdf.FileToPdf "My Test File.ps", "", ""
to automate *.htm to *.pdf creation. Can someone start me off in setting up the project in Visual Studio? My goal is to run the command with variables from the command line. Alternatively, any suggested way. I say command line because it is the way I can automate it from FileMaker.
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,481
Location
Sydney, Australia
Programming Experience
10+
You could start by creating a VB Console Application project. Here's some code that demonstrates accessing a commandline argument:
Module Module1

    Sub Main(args As String)
        If args.Length > 1 Then
            Dim filePath = args(1)

            Console.WriteLine(filePath)
        End If

        Console.ReadLine()
    End Sub

End Module
In your case, you could pass that file path to your FileToPdf class. Note that the code you posted is not VB.NET. You must always use parentheses when calling a method with arguments in VB.NET:
Dim pdf As New PdfDistiller
pdf.FileToPdf("My Test File.ps", "", "")
Also note the New keyword to create an instance of the class.
 

pctechtv

New member
Joined
Oct 12, 2016
Messages
2
Programming Experience
5-10
Thank you so much. This is extremely helpful. I think with what you give and some reading and studying I should be on my way. I hope to take a full-fledged Visual Basic training course some day. Thanks!:)
 
Top Bottom