LassoScript Utility
Basics Browse Detail


Tag Link [PDF_Serve] Category PDF
Type Process Source Available Yes
Support Preferred Version 6.0
Change Unchanged Data Source Any
Output Type None Security File
Implementation LDML Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0


The [PDF_Serve] tag serves a PDF file which is stored in a variable in place of the current Lasso format file. The name of the PDF file can be specified and, in supported browsers, the PDF file will be written to disk using that name and/or automatically opened in the visitor's PDF reader.

None of the contents of the current format file will be served. [PDF_Serve] completely rewrites the HTTP headers and contents of the served response. [PDF_Serve] also performs an [Abort] so no tags after [PDF_Serve] will be executed.

The first parameter to the tag should be a variable which contains the PDF file to be served. An optional -File parameter allows the name of the PDF file to be specified. An optional -Type parameter allows the MIME type of the served file (default 'application/pdf') to be overridden.


[PDF_Serve: 'PDF Data']

[PDF_Serve: 'PDF Data', -File='Example.PDF']

[Variable: 'myPDF' = (PDF_Doc: ...)]
[PDF_Serve: $myPDF, -File='Example.PDF']

[PDF_Serve: (File_Read: 'Example.PDF'), -File='Example.PDF']


Required Parameters
'File Data' The first parameter to the tag should be the PDF file data that will be served.
Optional Parameters
-File The -File parameter specifies the name of the PDF file. In supported browsers the downloaded PDF file will be given this name.
-Type The -Type parameter specifies the MIME type of the file. Defaults to application/pdf.
-Disposition The disposition can be set to 'Inline' to force most browsers to display the served file in the browser rather than saving it to disk.


To serve a PDF file without writing To file:

PDF files may be served to the client browser without ever writing them to file on the local server. This is done using the [PDF_Doc] tag without the -File parameter. This allows a PDF file to be created in the system memory, but does not the save the file to a hard drive location. The resulting file can saved by the end user to a location on the end user's hard drive.

Var:'MyFile'=(PDF_Doc: -Size='A4', -NoCompress);
Var:'Text'=(PDF_Text: 'Hello World');
$MyFile->(Add: $Text);
PDF_Serve: $MyFile, -File='MyFile.pdf';

Related Tags