Rendering PDF document
(From 5.0.7) PDF files are rendered using client-side rendering technology starting with Daeja ViewONE.
About this task
Client-side rendering is the default option and that provides the following advantages:
- Reduces network traffic - The viewer retrieves the rendered page image from the rendering engine on the client, which removes the need to fetch these images from the server and reduces the network traffic.
- Processing load on the server is reduced - Frees up resources for other tasks.
- Users can navigate to pages in the pdf quickly - Performance is less impacted by server load because the server is only responsible for the initial delivery of the entire document to the client. This improved performance is especially critical when the network is slow.
- Reduces server disk access and usage - Rendered pages are no longer generated and cached on the server
- The document is rendered at a higher fidelity – This is especially apparent when the pages are zoomed in.
- Enables additional features, including ability to open hyperlinks - Links can be clicked which will open the targeted website in a new browser tab.
While client-side rendering has many advantages, there are some situations where retrieving the entire document to the browser has disadvantages. This is especially important with very large PDF files. To address this challenge, two additional rendering options were introduced in Daeja ViewONE 5.0.12. Configuring these rendering options is accomplished using the HTML parameter pdfFetchType. There are three modes to fetch and render the PDF documents:
- fullDocument: This is the by default option. Rendering in the browser starts after fetching the entire document to the browser. This is recommended for scenarios when most documents are less than 15 pages and when you want to see the entire document quickly as they are navigating to different pages.
- progressive: When the document is opened, the rendering starts to happen as soon as the page is available. This makes rendering of the first page faster. Rendering the other pages is not stopped until the whole document is fetched.
- ondemand: In this option, rendering happens for the page that is requested (initially page 1). You can request a particular page, either by typing the page number or by scrolling to a particular page. After the you request a page, that page is fetched from the server. This option is best if the whole document frequently does not need to be rendered. This option also improves resource utilization on the server.
- Streamed PDF documents
- Support for streamed PDF document is available starting with Daeja ViewONE 5.0.12. A streamed PDF file is a special format of a PDF file that makes viewing faster over the Internet. Streamed PDF files contains information that allow a byte-streaming server to download the PDF file one page at a time. The Progressive or OnDemand options must be set for streaming PDF files. Learn more on pdfFetchType.
- Prefetch page size using clientPreFetchSize
- Use clientPreFetchSize parameter to adjust the number of pages that are
retrieved in the background when viewing PDF documents on the client. When this parameter is set to
any value greater than zero, the specified number of pages before and after the current page are
read-ahead (prefetched). Setting to a larger value will prefetch more pages, though can have an
impact on server resources.
The valid values for this parameter are 0 to 7, where a value of 0 means that no pages are prefetched. The default setting is 7.
This parameter is available as of Daeja ViewONE 5.0.7 and only has an effect when rendering PDF documents with the HTML parameter clientPDFTileGeneration set to true, which is the default value.
- Notes on client-side rendering
-
- For PDF documents that have non-embedded fonts, the text that is rendered differs a bit in the colour and format. It depends on the operating system, browser, and fonts available on the client machine. This means there might be slight differences in the rendered image when viewed from different browsers or client machines.
- Native PDF annotations might appear slightly different.
- Printing of PDF documents are done on the server and uses the rendering engine on the server. Depending on printing options, the generated printable PDF can have slight differences to the image seen on the client.
- For faster navigation through pages, image tiles are always generated for the 7 pages before and the 7 pages after the current page.
- From Daeja ViewONE 5.0.15 ifix2 internal link interaction within PDF is supported. The viewer also provides seamless interaction between native PDF annotations and Daeja annotations. Users can create, edit and delete Daeja annotations directly on top of native PDF annotations without enabling text selection. When the Select Annotation button is activated, native PDF annotations are temporarily disabled. This ensures that Daeja annotation actions do not conflict with, existing native annotations. After the annotation task is complete, native annotations are automatically re-enabled, allowing users to continue viewing and interacting with them as usual.
Restriction:- Enhancement mode is not supported for PDF documents rendered on the client. The pages are rendered at a higher fidelity and anti-aliasing is no longer required.
- Zooming is capped at 10 times the actual size. This is rendered at high fidelity. Zooming beyond this scale stretches the image to the required size.
- Server-side rendering using clientPDFTileGeneration
- If the limitations of client side rendering are a concern, it is possible to revert to server
side rendering by setting parameter - clientPDFTileGeneration to false. The
following features are not available when using server side rendering:
- Text searching in PDF documents.
- PDF Text Selection Mode or Text Copy for rendered documents.
- Support for password protected PDF documents.
- CMAP resources for rendering language characters
- If you are rendering CJK characters in a PDF file that uses embedded CMAPs, you need to configure the ViewONE PDF libraries to render those characters correctly. Those characters require the corresponding CMAP files for mapping the CJK encoded characters to the required encoding. The integrated CMAP within viewer helps to avoid external dependency.