chromium/chrome/services/printing/public/mojom/pdf_flattener.mojom

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module printing.mojom;

import "mojo/public/mojom/base/shared_memory.mojom";

struct FlattenPdfResult {
  mojo_base.mojom.ReadOnlySharedMemoryRegion flattened_pdf_region;
  uint32 page_count;
};

// Interface used to flatten a PDF in a printing service utility process.
// Flattening a PDF converts forms and form data to text and graphics so they
// can no longer be modified and makes most JavaScript objects useless.
interface PdfFlattener {
  // Flattens a PDF.
  // `src_pdf_region` contains the PDF needing to be flattened.
  // `result` contains the flattened PDF and the PDF's page count.
  FlattenPdf(mojo_base.mojom.ReadOnlySharedMemoryRegion src_pdf_region)
      => (FlattenPdfResult? result);

  // Sets the status for enterprise policy `kPdfUseSkiaRendererEnabled`. It
  // should be called immediately once `mojom::PdfFlattener` remote is
  // bound to the printing service and only when the enterprise policy is
  // managed.
  SetUseSkiaRendererPolicy(bool use_skia);
};