Skip to content

How to control PfdView printing? #900

Closed

Description

@itg-assistant

Tung Ngo asked 2017-06-16 09:03:05 UTC

Hello,

I use pdfview to show a print preview to user. PdfView has a print button for sending the content to a printer. It works fine. Now I need to run some code before printing, and some other code after.

Is it possible to implement 2 events: BeforePrinting and AfterPrinting for the PdfView?

If not, is there any other way to get the desired result?

Thank You.

Activity

  1. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2017-06-16 15:53:16 UTC

    Very hard if not impossible. The pdf viewer used depends on the browser. With Wisej you can select either the native viewer, google docs, mozilla pdf.js or your own viewer. You could clone the pdf.js viewer to your server and see if you can hook up an event in the source code.

    See also: https://stackoverflow.com/questions/1234008/detecting-browser-print-event

    The problem is that even this technique doesn't work, it fores both events immediately and only when printing the page. If you print the pdf viewer it doesn't since the viewer is an embedded object with a different dom.

    /Luca

  2. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Ser Gar answered 2017-06-16 17:37:01 UTC

    Hi
    What about afterPrint and beforePrint in viewer.js?
    https://searchcode.com/codesearch/view/86501454/

  3. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Tung Ngo answered 2017-06-17 02:14:46 UTC

    Hi, if it is hard to implement, is there anyway to call pdfView.Print by code ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GeneralQuestions, how-tos and everything else.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions