// Copyright 2018 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";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "url/mojom/url.mojom";
// Used by the browser process to perform N-up PDF conversion in a separate
// sandboxed service process, as the PDF data is untrusted user input.
interface PdfNupConverter {
// The status of PDF conversion execution.
enum Status {
SUCCESS = 0,
CONVERSION_FAILURE = 1,
HANDLE_MAP_ERROR = 2,
};
// Converts a list of PDF pages to a N-up PDF.
// `pages_per_sheet` is the number of pages to put on a single sheet.
// `page_size` is the output page size, measured in PDF "user space" units.
// `printable_area` is the printable area of the output page, measured in
// PDF "user space" units.
// `pdf_page_regions` is a list of pdf pages to be converted to a N-up page.
// The number of items in `pdf_page_regions` can be different from N. It
// will return a N-up PDF document of
// Math.ceil(size of `pdf_page_regions` / N) pages in it.
NupPageConvert(
uint32 pages_per_sheet,
gfx.mojom.Size page_size,
gfx.mojom.Rect printable_area,
array<mojo_base.mojom.ReadOnlySharedMemoryRegion> pdf_page_regions)
=> (Status status, mojo_base.mojom.ReadOnlySharedMemoryRegion? pdf_region);
// Converts a PDF document to a N-up PDF document.
// `pages_per_sheet` is the number of pages to put on a single sheet.
// `page_size` is the output page size, measured in PDF "user space" units.
// `printable_area` is the printable area of the output page, measured in
// PDF "user space" units.
NupDocumentConvert(uint32 pages_per_sheet,
gfx.mojom.Size page_size,
gfx.mojom.Rect printable_area,
mojo_base.mojom.ReadOnlySharedMemoryRegion src_pdf_region)
=> (Status status, mojo_base.mojom.ReadOnlySharedMemoryRegion? pdf_region);
// 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 `mojom::NupPageConvert` remote is
// created and only when the enterprise policy is managed.
SetUseSkiaRendererPolicy(bool use_skia);
};