Customize Your PDF Web Export

This section will highlight different aspects of customization provided. It is recommended to look into the previous section regarding the export first.

Branding the Viewer

If you want to provide your own company branding simply copy and edit viewer.html.

You may want to have a finer control on the generation. By providing you with a subset of the Acrobat JavaScript API, you can:

  • Register specific callbacks.

  • Access document parameters.

  • Create you own controls.

To that extent, some elements must be present in the source page:

The <head> section must reference the correct stylesheets:

<head>
   <!-- ... -->
   <link rel="stylesheet" href="css/pdf.css">
   <link rel="stylesheet" href="css/pdf_elements.css">
   <link rel="stylesheet" href="css/pdf_bom_carousels.css">
   <link rel="stylesheet" href="js/swipper/swiper.min.css">
   <link rel="stylesheet" href="css/Navigation.css">
   <!-- ... -->
</head>

The page body must declare a <div> with the corresponding attributes and immediately include the API scripts:

<body>
   <!-- ... -->
   <div id="main" class="pdfcontainer hidden"></div>
   <script src="js/Hoops.js"></script>
   <script src="js/pdfReader/all.min-obf.js"></script>
   <!-- ... -->
</body>

Viewer Options

On top of that, you may also define how the web viewer renders elements. In Acrobat, some settings are not dependent of the document being read. To reflect that, some options are available in JavaScript that must be set before loading the PDF structure file (before ['BASE64_BEGIN'] beacon in the viewer file but after ['MONOLITHICHTML_END'] beacon).

To set those, use Hoops.WebViewerOptions variable that contains everything handled. Some options are specific to the 3D annotations and can be found in ModelViewerOptions subsection.

<script>
   // 3D viewer
   Hoops.WebViewerOptions.ModelViewerOptions.General.show_back_faces = false;
   Hoops.WebViewerOptions.ModelViewerOptions.Effects.enable_ambient_occlusion = true;
   Hoops.WebViewerOptions.ModelViewerOptions.Effects.ambient_occlusion_radius = 0.03;                // only used if enable_ambient_occlusion is true.
   Hoops.WebViewerOptions.ModelViewerOptions.Axis.show_axis_triad = true;
</script>

Metadata

Inside PDF files, metadata are stored in the file information structure. By default, when exporting the PDF to web format the metadata will be stored in <meta> HTML tags with their name and content.

Though, Hoops Publish offers a way to edit them during the process of exporting to web format. When calling A3DConvertPDFToWebFormat</span>, you may fill ``A3DRWParamsExportHtmlData with additional parameters:

  • m_pOutputDocumentMetaTags: is a C array of A3DRwHtmlMetaTag elements which are composed of a name and a content string.

  • m_uiOutputDocumentMetaTagsCount: the number of A3DRwHtmlMetaTag elements in the C array.

To add a meta information, create and insert A3DRwHtmlMetaTag element in the C array. To edit an existing meta information inside the PDF, create and insert A3DRwHtmlMetaTag element with the same name of the meta information to edit but with a different content string. To remove an existing meta information inside the PDF, create and insert A3DRwHtmlMetaTag element with the same name of the meta information to remove but with a NULL content.

Title of the Web Page

Hoops Publish offers a way to entitle the web page. To do so, feed the title name to m_pcOutputDocumentTitle. If no title is given to m_pcOutputDocumentTitle, Hoops Publish looks into the metadata for one named ‘title’. If no title is given to m_pcOutputDocumentTitle and no meta data with the name ‘title’ has been found, the title will be the name of the PDF file.