#####################
HOOPS Publish 2023 U1
#####################

PDF Web export to JSON
======================

In addition to the support of exporting PDF to XML, we now provide JSON export.

This support comes with two new fields in :cpp:struct:`A3DRWParamsExportHtmlData`:

* :cpp:member:`~A3DRWParamsExportHtmlData::m_ePdfOutputFormat` is an :cpp:enum:`enumeration value <A3DWebOutPdfFormat>` that can be either:

    * :cpp:enumerator:`kA3DWebOutPdfFormatXml` for an XML export (default) and
    * :cpp:enumerator:`kA3DWebOutPdfFormatJson` for a JSON export. 

* :cpp:member:`~A3DRWParamsExportHtmlData::m_i3dOutputFormat` is a flag specifying the type of export.
  This field was previously present as a parameter in :cpp:func:`A3DPDFDocumentExportToWebFormat` and :cpp:func:`A3DConvertPDFToWebFormat`.
  The default is  ``kA3DWebOutFormatHtml``.

.. rubric:: Migration Guide

The change of the export flag from a parameter to a field structure is **code compatibility breaking**.
To migrate from the previous to the new syntax, move the last parameter of any call to :cpp:func:`A3DPDFDocumentExportToWebFormat` and :cpp:func:`A3DConvertPDFToWebFormat` in :cpp:member:`A3DRWParamsExportHtmlData::m_i3dOutputFormat`.

.. code-block:: c
   :caption: Before HP 2023 U1

   A3DRWParamsExportHtmlData paramsExportData;
   A3D_INITIALIZE_DATA(A3DRWParamsExportHtmlData, paramsExportData);

   A3DStatus status = A3DConvertPDFToWebFormat(pcFileName, &paramsExportData, pcOutputDirectory, pcOutputName, kA3DWebOutFormatHtml);

.. code-block:: c
   :caption: HP 2023 U1
   :emphasize-lines: 5,7

   A3DRWParamsExportHtmlData paramsExportData;
   A3D_INITIALIZE_DATA(A3DRWParamsExportHtmlData, paramsExportData);

   // Configure paramsExportData...
   paramsExportData.m_i3dOutputFormat = kA3DWebOutFormatHtml;

   A3DStatus status = A3DConvertPDFToWebFormat(pcFileName, &paramsExportData, pcOutputDirectory, pcOutputName);

.. rubric:: See Also

* :ref:`toc_pdf_export_function`

URL Query String Changes
========================

.. rubric:: New Query String Parameter

Following the addition of JSON export, :ref:`a new query string parameter <toc_output_online>` is available, ``format=``, which can be either ``json`` or ``xml``.

When the export contains both JSON and XML, the ``format=`` parameter allows you to specify which one to load.
If the parameter is missing, the web viewer tries to load the XML export first, then the JSON.

.. rubric:: Query String Parameter Change

In the context of a :ref:`client/server environment <toc_output_online>`, we changed :ref:`the way we load the exported files <toc_output_online>`.
Instead of using ``sample=`` in the url query, you should now use ``file=``:

.. code-block:: text

   localhost:11180/viewer.html?file=sample_DemoDataModel&format=json

.. rubric:: See also

* :doc:`/guide/export/viewpdf`

Fixed Bugs
==========

The list of fixed bugs can be found on :doc:`the fixed bugs page </fixed_bugs>`.

