BBjForm::savePDF

Description

In BBj 26.0 and higher, these methods save the current BBjForm as a PDF file. They save the form content directly to a PDF document based on the form’s state at the time the method is executed.

These methods support creating either a standard PDF file or a password-protected PDF file. When security is applied, the generated PDF can include passwords that control access to the document, such as requiring a password to open the file or restricting editing permissions. This allows applications to generate PDF output from a form and optionally apply access restrictions to the resulting document. See: getBBjPDFForm

Syntax

void Method
void savePDF(string p_pdf)
void savePDF(string p_pdf, string p_editPassword, string p_openPassword)

Parameter

Variable Description
p_pdf The path and file name of the PDF file to create from the current BBjForm.
p_editPassword The path and file name of the PDF file to create from the current BBjForm.
p_openPassword The user password required to open the generated PDF file.

Return Value

None.

Remarks

A BBjException is thrown if the PDF file cannot be created or written to the specified file path.

Example

rem Set the PDF file path

pdfFile$ = dir("") + "Sample.pdf"

rem Erase the PDF file if it exists

erase pdfFile$,err=*next

rem Get the default server printer

defaultPrinter! = BBjAPI().getBBjPrinter(0)

rem Get a form from the printer

form! = defaultPrinter!.getForm(0)

rem Create a page

page! = form!.createPage()

rem Create a paragraph 

paragraph! = page!.newParagraph()

rem Set the paragraph text

paragraph!.setText("Sample text")

rem Add the paragraph to the page

page!.add(paragraph!)

rem Save the PDF

form!.savePDF(pdfFile$)

print "Saved PDF: " + pdfFile$

See Also

BBjAPI

BBj Object Variables

BBj Object Creation and Assignment

BBj Object Error Handling

BBj Object Operators

Advantage Article: Dishing up Forms

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.