Generally, all documents that are sent to the Web Browser will be checked for their MIME/Type. If the browser recognizes the type of the document, it will attempt to open it with an appropriate application available on the machine. If you have a PDF document that you would like the Web users to view in their Web Browser, you must first read the PDF document into a blob. You must then send the blob containing the PDF file to the browser using the SEND HTML BLOB command.
Note: The Web browser will use the Acrobat Reader locally. Therefore, the Acrobat Reader must be installed on the Client machine.
IMPORTANT: You must specify the correct MIME/TYPE in the SEND HTML BLOB command to allow the Web browser to recognize the file type and the application tneeded to open it.
For example: Here we have a simple HTML page that contains one submit button.
When the user clicks on the button, the request is sent to the HTTP engine of 4D/4D Server and the SendPDF method is executed.
` Project Method: SendPDF
` Description: Reads a PDF document into a blob and
` sends it to the Web
` Author: Add Komoncharoensiri
C_BLOB(blb)
C_TEXT(web_PDF)
If (web_PDF#"")
DOCUMENT TO BLOB(":WebFolder:"+web_PDF;blb)
SEND HTML BLOB(blb;"application/PDF")
End if