Use the ExecutePDF method to get the PDF version of the generated forms, instead of returning an HTML. PDFs can be prefilled with client data in the same fashion as HTML . This method receives no parametersforms (using AddFieldToForm, LoadXML, etc.). The output of the method is an object of class PrintedPDF, whose properties are described below, or null on error.
...
- On error, you can see the message in the Results property of the QuikFormsEngine instance (objQFE.Results)
- If the OutputPath property is set, the PDF will be written in disk, with the file name specified in OutputFileName property. A default value of "QuikForms.pdf" will be set if no value is present on said property. The extension '.pdf' is not needed in the property value. in the property value.
- For a fast look at the output PDF, copy and paste the returned PDF string into this free online converter
Sample Code
SOAP
...
Code Block |
---|
language | xml |
---|
title | Sample Code |
---|
|
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<AuthenticationHeader xmlns="https://websvcs.quikforms.com/quikformsenginews/">
<CustomerID>CUSTOMER ID</CustomerID>
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
</AuthenticationHeader>
</soap:Header>
<soap:Body>
<ExecutePDF xmlns="https://websvcs.quikforms.com/quikformsenginews/">
<PDFSettings>
<QuikFormID>1</QuikFormID>
<PrintEditablePDF>true</PrintEditablePDF>
<LoadXML></LoadXML>
</PDFSettings>
</ExecutePDF>
</soap:Body>
</soap:Envelope>
|
Note: In the above request, the only mandatory tag in PDFSettings is QuikFormID.
VB.NET
...
Code Block |
---|
language | vb |
---|
title | Sample Code |
---|
|
Dim objQFE As New QuikFormsEngine.QuikFormsEngine
'Enter the credentials for your Quik! account
objQFE.QuikCustID = 999999 'Your master account CustomerID
objQFE.QuikUsername = "USER" 'Your master account username
objQFE.QuikPassword = "PASS" 'Your master account password
|
...
'Configure settings to run the Quik! Forms Engine
objQFE.ErrorLogPath = "c:\TempOutput\" 'Set the location for the error log
objQFE.OutputPath = "c:\TempOutput\" 'If OutputTempFiles is TRUE, this value is ignored |
...
objQFE.OutputFileName = "myForm" 'name of the pdf file if writing to disk. |
...
'Add the FormIDs to be generated
objQFE.AddFormID(38002)
objQFE.AddFormID(25525)
objQFE.AddFormID(25524) |
...
'Add data to the form - For the sake of the example, just one entry is shown.
objQFE.AddFieldToForm(New FormField("1own.FName", "John")) |
...
...
Dim printedPdf As PrintedPDF = objQFE.ExecutePDF()
If printedPdf Is Nothing Then
'Error
Dim err = objQFE.Results.Message
Else
'Get the PDF
Dim PDFBytes As Byte() = printedPdf.PDF
End If |
C#
Code Block |
---|
language | c# |
---|
title | Sample Code |
---|
|
QuikFormsEngine.QuikFormsEngine objQFE = new QuikFormsEngine.QuikFormsEngine();
//Enter the credentials for your Quik! account
objQFE.QuikCustID = 999999;
//Your master account CustomerID
objQFE.QuikUsername = "USER";
//Your master account username
objQFE.QuikPassword = "PASS";
//Your master account password
//Configure settings to run the Quik! Forms Engine
objQFE.ErrorLogPath = "c:\\TempOutput\\";
//Set the location for the error log
objQFE.OutputPath = "c:\\TempOutput\\";
//If OutputTempFiles is TRUE, this value is ignored |
...
objQFE.OutputFileName = "myForm"; |
...
//name of the pdf file if writing to disk |
...
//Add the FormIDs to be generated
objQFE.AddFormID(38002);
objQFE.AddFormID(25525);
objQFE.AddFormID(25524);
//Add data to the form - For the sake of the example, just one entry is shown.
objQFE.AddFieldToForm(new FormField("1own.FName", "John"));
//GeneratePDF
PrintedPDF printedPdf = objQFE.ExecutePDF();
if (printedPdf == null) {
//Error
dynamic err = objQFE.Results.Message;
} else {
//Get the PDF
byte[] PDFBytes = printedPdf.PDF;
} |