PDF embedded within HTML page
Many web developers are missing the fact that PDF files can be embedded within an HTML web page. Just like how QuickTime movies, Flash, MPEGs, and WAV files can be embedded into an HTML document, PDF documents can be used in the same way. That gives both, the developer and the user, many advantages and flexibility.
Nowadays, a common use of PDF through the internet is clicking on a hyperlink which directly links to a PDF file. The user can then download the PDF file or open it through the internet explorer. Embedding PDF through the web page can be flexible in some situations. For example, generating a PDF file to show dynamic data that change in time, like comments and news. In addition, embedding PDF functions like a normal PDF file opened in Adobe Reader with its numerous interface options available to be used in the web page. Youâ€™ll see more of this method features and advantages on this article as we go on.
One of the problems with embedding a PDF file is that it can strain usersâ€™ computer resources. File size is also another problem that can slow page loading.
Here is first example,
<embed src="file1.pdf" width="500" height="650"></embed>
We used the <embed> HTML tag to embed a PDF file into a web page. The property src is used to set the location and the name of the PDF file. Relative or absolute URL can be used here just like images. The width and height property sets the display width and the height of the document. You can also use pixel or percentage (e.g. 90%) here just like image sizing or tables.
If you are like me and want your code to meet the XHTML standard – Itâ€™s not like Iâ€™m OCD – then you better use the <object> tag instead. <object> also helps on downloading Acrobat Reader if it is not available on userâ€™s machine.
Just a note, <embed> is not an XHML standard, although it is supported by many browsers. It was created by Netscape as a method to embed players in browsers and then many browsers adopted it.
Here is an example on using object:
<object type="application/pdf" data="file1.pdf" width="500" height="650" ></object>
The type property – indicates the MIME type – helps identifying which program is suitable for this file. A list of some MIME types used on this property available here. The data property is the location of the file. The width and height properties are to set the width and height of the document respectively.
Between the opening and closing tags you can add anything as an alternative if the browser do not support <object> or cannot find its program. For example, you can add the link to the PDF file if it cannot be viewed in the page:
<object type="application/pdf" data="file1.pdf" width="500" height="650" >Click <a href="file1.pdf">here</a> to view the file</object>
You can use anything between the two tags to show. We used a link on the previouse example to open the file normally if it cannot be embedded. You can use a nested object (object inside object) or anything.
Thanks to adobe, they gave us the flexibility on choosing the what to display on the PDF document just by coding. By passing parameters when loading the PDF we can do that changes we want.
The most common 3 parameters are:
toolbar â€“ to show the toolbar in the embedded document. 1 = show, 0 = not show
navpane â€“ to show the navigation bar in the embedded document. 1 = show, 0 = not show
scrollbar â€“ to show the scroll bar in the embedded document. 1 = show, 0 = not show
Here is a list of all parameters
Here how to use those parameters:
You can use those parameters in any combinations and they also work in object tag.
Just donâ€™t forget the & symbol between the parameters and the # symbol at the end of the file name.
Note that in full screen mode, the PDF will display in full screen inside the defined region only, not full screen within the web browser or within the whole monitor screen.
The BSCI 642-901 test will verify that the winning candidate has significant knowledge and skills needed to use advanced IP addressing in addition to routing in applying scalability for Cisco ISR routers linked to LANs and WANs. 220-601 test format is linear format which is computer-based test. 1Y0-259 study guides offer a variety of support to help improve professional skills and knowledge. SY0-101 involves a methodical working knowledge of TCP/IP networking is entirely critical for achievement on the Security+ test. Candidates for 70-620 should have knowledge of determining issues related to network connectivity.