PDF Generator is commercial, and the pinned SurveyJS service never calls setLicenseKey(), so its PDFs carry the SurveyJS alert banner even when you set a licence key.
- Claim #1 · dana.reyes@example.com
- Claim #2 · li.wei@example.com
- Claim #3 · sam.osei@example.com
Source on GitHub
Definition: shared/definitions/relational-storage.v1.json
Commercial licence: without SURVEYJS_LICENSE_KEY the component shows a licence banner
shared/client/server-pdf.js · sjs:server-pdf.client
View on GitHub
// Ask your server for the filled form as a PDF
async function openPdf(id) {
const tab = window.open("", "_blank"); // open the tab in the click itself: after an await, browsers block pop-ups
const res = await fetch(`/api/claims/${id}/pdf`);
if (!res.ok) {
tab.close();
throw new Error((await res.json()).error);
}
tab.location = URL.createObjectURL(await res.blob());
}
routes/examples/server-pdf.php · sjs:server-pdf.server
View on GitHub
// GET /api/claims/{id}/pdf — ask the SurveyJS service for the filled form and pass the PDF through
Route::get('/api/claims/{id}/pdf', function (string $id) {
$data = DB::table('responses')->where('form_id', 'claim')->where('id', $id)->value('data') ?? abort(404, 'Unknown claim');
$definition = DB::table('forms')->where('key', 'claim')->value('json');
$pdf = SurveyJsService::post('/pdf', ['schema' => json_decode($definition), 'response' => json_decode($data)], timeout: 60);
if ($pdf->status() !== 200 || ! str_starts_with($pdf->header('Content-Type'), 'application/pdf')) { // fail closed
SurveyJsService::unexpected('/pdf', $pdf);
}
return response($pdf->body(), 200, [
'Content-Type' => 'application/pdf',
'Content-Disposition' => "inline; filename=\"claim-{$id}.pdf\"",
]);
});