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

// Copyright 2017 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 "chrome/services/printing/public/mojom/pdf_render_settings.mojom";
import "mojo/public/mojom/base/shared_memory.mojom";
import "url/mojom/url.mojom";

// Converts a PDF to EMF, page-by-page.
interface PdfToEmfConverter {
  // Converts the page at `page_index` in the PDF. The PdfToEmfConverterFactory
  // that created this PdfToEmfConverter returned how many pages are in PDF.
  // For the given page, returns the converted EMF data, if successful, and the
  // scale factor for that page.
  ConvertPage(uint32 page_index) =>
      (mojo_base.mojom.ReadOnlySharedMemoryRegion? emf_region,
       float scale_factor);

  // Tells the service what URL is committed in the main frame of the
  // WebContents that is printing, for use in crash diagnosis.
  SetWebContentsURL(url.mojom.Url url);

  // Sets the status for enterprise policy `kPdfUseSkiaRendererEnabled`. It
  // should be called immediately once `PdfToEmfConverter` remote is created
  // and only when the enterprise policy is managed.
  SetUseSkiaRendererPolicy(bool use_skia);
};

// Generates a PdfToEmfConverter, for converting a PDF to EMF.
interface PdfToEmfConverterFactory {
  // Sends the PDF data in `pdf_region`, along with the `render_settings` to
  // use. Returns a PdfToEmfConverter and how many pages are in the PDF.
  CreateConverter(mojo_base.mojom.ReadOnlySharedMemoryRegion pdf_region,
                  PdfRenderSettings render_settings)
      => (pending_remote<PdfToEmfConverter> converter, uint32 page_count);
};