Skip to content

Documentation Request: Using [customPdfViewer] #2853

@anaceurenssup

Description

@anaceurenssup

Documentation Request: Using [customPdfViewer] and Resolving pdf-dummy-components Import

I'm trying to add an interactive layer (grid/list of buttons) on top of a PDF using customPdfViewer input but I'm struggling to make the default PDF viewer (ngx-extended-pdf-viewer.component.html: <ng-template #defaultPdfViewer> ...) template work as custom one (so i can add my layer)!

<ngx-extended-pdf-viewer #pdfViewer [src]="'pdf.pdf'"
  [customPdfViewer]="customViewer"></ngx-extended-pdf-viewer>
  
<ng-template #customViewer>
  <div class="zoom" #root>
    <div class="html">
      <div class="body">
        <div id="outerContainer">
          <div id="mainContainer">
            <pdf-dummy-components></pdf-dummy-components>
            <div class="editorParamsToolbar hidden doorHangerRight" id="editorHighlightParamsToolbar">
              <div id="highlightParamsToolbarContainer" class="editorParamsToolbarContainer">
                <div id="editorHighlightColorPicker" class="colorPicker">
                  <span id="highlightColorPickerLabel" class="editorParamsLabel"
                    data-l10n-id="pdfjs-editor-highlight-colorpicker-label">Highlight color</span>
                </div>
                <div id="editorHighlightThickness">
                  <label for="editorFreeHighlightThickness" class="editorParamsLabel"
                    data-l10n-id="pdfjs-editor-free-highlight-thickness-input">Thickness</label>
                  <div class="thicknessPicker">
                    <input type="range" id="editorFreeHighlightThickness" class="editorParamsSlider"
                      data-l10n-id="pdfjs-editor-free-highlight-thickness-title" value="12" min="8" max="24" step="1" />
                  </div>
                </div>
                <div id="editorHighlightVisibility">
                  <div class="divider"></div>
                  <div class="toggler">
                    <label for="editorHighlightShowAll" class="editorParamsLabel"
                      data-l10n-id="pdfjs-editor-highlight-show-all-button-label">Show all</label>
                    <button id="editorHighlightShowAll" class="toggle-button"
                      data-l10n-id="pdfjs-editor-highlight-show-all-button" aria-pressed="true"></button>
                  </div>
                </div>
              </div>
            </div>

            <div class="editorParamsToolbar hidden doorHangerRight" id="editorFreeTextParamsToolbar">
              <div class="editorParamsToolbarContainer">
                <div class="editorParamsSetter">
                  <label for="editorFreeTextColor" class="editorParamsLabel"
                    data-l10n-id="pdfjs-editor-free-text-color-input">Font Color</label>
                  <input type="color" id="editorFreeTextColor" class="editorParamsColor" />
                </div>
                <div class="editorParamsSetter">
                  <label for="editorFreeTextFontSize" class="editorParamsLabel"
                    data-l10n-id="pdfjs-editor-free-text-size-input">Font Size</label>
                  <input type="range" id="editorFreeTextFontSize" class="editorParamsSlider" value="10" min="5"
                    max="100" step="1" />
                </div>
              </div>
            </div>
    
            <div class="editorParamsToolbar hidden doorHangerRight" id="editorStampParamsToolbar">
              <div class="editorParamsToolbarContainer">
                <button id="editorStampAddImage" class="secondaryToolbarButton" title="Add image"
                  data-l10n-id="pdfjs-editor-stamp-add-image-button">
                  <svg aria-hidden="true" focusable="false" width="16" height="16" viewBox="0 0 16 16" fill="none"
                    xmlns="http://www.w3.org/2000/svg" class="align-image-to-text">
                    <path
                      d="M7.00488 9.75V14C7.00488 14.1658 7.07073 14.3247 7.18794 14.4419C7.30515 14.5592 7.46412 14.625 7.62988 14.625C7.79564 14.625 7.95461 14.5592 8.07183 14.4419C8.18904 14.3247 8.25488 14.1658 8.25488 14V9.75L8.75488 9.25H13.0049C13.1706 9.25 13.3296 9.18415 13.4468 9.06694C13.564 8.94973 13.6299 8.79076 13.6299 8.625C13.6299 8.45924 13.564 8.30027 13.4468 8.18306C13.3296 8.06585 13.1706 8 13.0049 8H8.75488L8.25488 7.5V3.25C8.25488 3.08424 8.18904 2.92527 8.07183 2.80806C7.95461 2.69085 7.79564 2.625 7.62988 2.625C7.46412 2.625 7.30515 2.69085 7.18794 2.80806C7.07073 2.92527 7.00488 3.08424 7.00488 3.25V7.5L6.50488 8H2.25488C2.08912 8 1.93015 8.06585 1.81294 8.18306C1.69573 8.30027 1.62988 8.45924 1.62988 8.625C1.62988 8.79076 1.69573 8.94973 1.81294 9.06694C1.93015 9.18415 2.08912 9.25 2.25488 9.25H6.39188L7.00488 9.75Z"
                      fill="black" />
                  </svg>
                  <span data-l10n-id="pdfjs-editor-stamp-add-image-button-label">Add image</span>
                </button>
              </div>
            </div>
    
            <div class="editorParamsToolbar hidden doorHangerRight" id="editorInkParamsToolbar">
              <div class="editorParamsToolbarContainer">
                <div class="editorParamsSetter">
                  <label for="editorInkColor" class="editorParamsLabel"
                    data-l10n-id="pdfjs-editor-ink-color-input">Color</label>
                  <input type="color" id="editorInkColor" class="editorParamsColor" />
                </div>
                <div class="editorParamsSetter">
                  <label for="editorInkThickness" class="editorParamsLabel"
                    data-l10n-id="pdfjs-editor-ink-thickness-input">Thickness</label>
                  <input type="range" id="editorInkThickness" class="editorParamsSlider" value="1" min="1" max="20"
                    step="1" />
                </div>
                <div class="editorParamsSetter">
                  <label for="editorInkOpacity" class="editorParamsLabel"
                    data-l10n-id="pdfjs-editor-ink-opacity-input">Opacity</label>
                  <input type="range" id="editorInkOpacity" class="editorParamsSlider" value="1" min="0.05" max="1"
                    step="0.05" />
                </div>
              </div>
            </div>




            <pdf-context-menu></pdf-context-menu>
    
            <div id="viewerContainer">
    
              <div id="viewer" class="pdfViewer"></div>
            </div>
            <pdf-error-message></pdf-error-message>
          </div>
          <!-- mainContainer -->
    
          <div id="dialogContainer">
            <pdf-password-dialog></pdf-password-dialog>
            <pdf-document-properties-dialog></pdf-document-properties-dialog>
            <pdf-alt-text-dialog></pdf-alt-text-dialog>
            <pdf-alt-text-settings-dialog></pdf-alt-text-settings-dialog>
            <pdf-prepare-printing-dialog></pdf-prepare-printing-dialog>
          </div>
          <!-- dialogContainer -->
        </div>
    
        <!-- outerContainer -->
      </div>
    </div>
  </div>

</ng-template>

(when trying to use , the component was not exported (created a custom module that manually declares/imports pdf-dummy-components, but uncertain if this is the correct approach)

(i just removed all of the properties/parts ('minHeight', <pdf-sidebar #pdfsidebar [sidebarVisible]="sidebarVisible || false", ...) to figure why it does not want to work / I don't know best approach to have this properties and parts by default like using inheritance from ngx-extended-pdf-viewer.component)

Could you please provide documentation/examples for the proper usage of [customPdfViewer] property? or a quick fix or any recommended way to implement interactive overlays)

Thank you

Metadata

Metadata

Assignees

Labels

documentationuser supportYou've got a question, or a misconfiguration, or simply need a hint how to get things up and running

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions