|
Here is the code, thanks for any help.
Public Sub CreateDoc() Dim PDFLibrary As QuickPDFAX0723.PDFLibrary PDFLibrary = CType(CreateObject("QuickPDFAX0723.PDFLibrary"), QuickPDFAX0723.PDFLibrary) If PDFLibrary.UnlockKey("Unlock Key") = 1 Then PDFLibrary.AddImageFromFile(Application.StartupPath & "\Images\1.jpg", 0) PDFLibrary = WriteHeader(PDFLibrary) Dim Content As String = PDFLibrary.DrawHTMLTextBox(40, 635, 540, 570, Text(PDFLibrary)) Dim LastPgContent As String = Content Dim hTBWidth As Double = PDFLibrary.GetHTMLTextWidth(540, Text(PDFLibrary)) Dim hTBLineCount As Long = PDFLibrary.GetHTMLTextLineCount(hTBWidth, Text(PDFLibrary)) Dim TextHeight As Double = PDFLibrary.GetHTMLTextHeight(540, Text(PDFLibrary)) Dim MultiPg As Boolean = False PDFLibrary = WriteFooter(PDFLibrary) Do Until Content = "" PDFLibrary.NewPage() PDFLibrary = WriteHeader(PDFLibrary) If PDFLibrary.GetHTMLTextLineCount(540, Content) < 49 Then LastPgContent = Content End If Content = PDFLibrary.DrawHTMLTextBox(40, 635, 540, 570, Content) PDFLibrary = WriteFooter(PDFLibrary) MultiPg = True Loop If MultiPg Then hTBWidth = PDFLibrary.GetHTMLTextWidth(540, LastPgContent) hTBLineCount = PDFLibrary.GetHTMLTextLineCount(hTBWidth, LastPgContent) TextHeight = PDFLibrary.GetHTMLTextHeight(540, LastPgContent) End If Dim y As Double = 1 y = hTBLineCount * (TextHeight / hTBLineCount) PDFLibrary = WriteSig(PDFLibrary, y, 40) For i = 1 To PDFLibrary.PageCount PDFLibrary.SelectPage(i) PDFLibrary.DrawHTMLText(480, 775, 250, "<font size=""3""><b>Page " & i & " of " & PDFLibrary.PageCount & "</b></font>") Next #If DEBUG Then PDFLibrary.SaveToFile("C:\Docs\Doc.pdf") 'Dim PrintOp As Integer = PDFLibrary.PrintOptions(0, 0, "Doc") 'PDFLibrary.PrintDocument("myPrinter", 1, PDFLibrary.PageCount, PrintOp) #Else 'Send file to server #End If End If PDFLibrary = Nothing End Sub Function Text(ByVal myPdfLib As QuickPDFAX0723.PDFLibrary) As String Dim sText As String = "Some Strings" Return sText End Function Private Function WriteSig(ByVal oPDF As QuickPDFAX0723.PDFLibrary, ByVal y As Double, Optional ByVal left As Integer = 210) As QuickPDFAX0723.PDFLibrary Dim Last As String = "Last" If Last = "LastName" Or Last = "Other Lastname" Then oPDF.AddImageFromFile(Application.StartupPath & "\Images\Sig.jpg", 0) oPDF.DrawImage(left, (725 - y), 150, 45) Dim Sig As String = "" Sig = "Name<br>Title" oPDF.DrawHTMLTextBox(left, (725 - y) - 50, 375, 75, Sig) End If
Return oPDF End Function Private Function WriteHeader(ByVal oPDF As QuickPDFAX0723.PDFLibrary) As QuickPDFAX0723.PDFLibrary oPDF.DrawImage(450, 750, 126, 94) oPDF.DrawLine(32, 760, 580, 760) oPDF.DrawLine(32, 645, 580, 645) oPDF.DrawHTMLText(480, 640, 250, "<font size=""6""><b>Title</b></font>") Return oPDF End Function Private Function WriteFooter(ByVal oPDF As QuickPDFAX0723.PDFLibrary) As QuickPDFAX0723.PDFLibrary oPDF.DrawLine(32, 45, 580, 45) Dim sFooter As String = "Address" oPDF.DrawHTMLText(32, 35, 548, "<p align=""center"">" & sFooter & "</Align>") Return oPDF End Function
|