PdfGenerate Method

Build 1501 on 14/Nov/2017  This topic last edited on: 23/Mar/2016, at 12:12

Description

Generates PDF.

Available in Fred and Ted.

Syntax

Dim errorcode as Short = object.PDFGenerate(obj.XML)

object

Ted or Fred

obj

Required. Object name, returned by GetPDFOptions.

Remarks

Error code return values are:

errCanNotLoadOpt  =1 (PDF options are not loaded)

errNoDocToPrint   =2 (no document to print)

errNoOutput       =3 (XML file and/or printer are defined as empty)

errSendOutput     =4 (XML is generated, but it's not possible to send it to printer)

errInvalidPrintOpt=5 (boundingbox/mediabox parameters are wrong, in Ted)

Example

Call in FRED4MAINADDIN.VB

  Public Sub PDFGenerate()

    Utils.PDFGenerate(Fred)

  End Sub

Call in PAGEDESIGNERADDIN.VB

  Public Sub PreflightPrint()

    Dim res = Page.PageTest(2, -1, 0, 0, False)

    If (res = 0) Then

      Utils.PDFGenerate(m_Fred)

    End If

  End Sub

Called sub in UTILS.VB

  Public Shared Sub PDFGenerate(ByVal fredApp As IFredApp)

    Dim opt = fredApp.GetPDFOptions("")

    If Not opt Is Nothing Then

      Dim res As Short

      If opt.ShowDlg(0, 0, fredApp.GetQualifier = 1) Then

        'opt.File = "c:\temp\print\fred.xml"

        res = fredApp.PDFGenerate(opt)

        If res > 0 Then

          MsgBox("PDF Error: " & res)

        End If

      End If

    End If

  End Sub

 

In TED4MAINADDIN.VB

  Public Sub PDFGenerate()

    Dim opt As PDFOptions

    opt = m_Ted.GetPDFOptions("")

    If Not opt Is Nothing Then

      Dim res As Short

      'opt.spotlist = App.getspotlist      

      If opt.ShowDlg(0, 0, m_Ted.GetQualifier = 1) Then

        'opt.File = "c:\temp\print\ted.xml"

        res = m_Ted.PDFGenerate(opt)

        If res > 0 Then

          MsgBox("PDF Error: " & res)

        End If

      End If

    End If

Context

Main application common dispatcher commands