Lasso Soft Inc. > Home

[PDF_Serve]

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.

  • Syntax
  • Parameters
[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.
Examples

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.

(Add: $Text);
$MyFile->Close;
PDF_Serve: $MyFile, -File='MyFile.pdf';
?>
Tag Link [PDF_Serve] Category PDF
Type Process Data Source Any
Support Preferred Version 6.0
Output Type None Security File
Implementation LDML Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft