naiveproxy/chrome/services/printing/public/mojom/pdf_nup_converter.mojom
2018-12-09 21:59:24 -05:00

57 lines
2.2 KiB
Plaintext

// Copyright 2018 The Chromium Authors. All rights reserved.
// 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/mojo/geometry.mojom";
import "url/mojom/url.mojom";
// This set of interfaces is used to do Nup PDF conversion.
// Usage:
// - generate a PdfNupConverter.
//
// - call PdfNupConverter.NupPageConvert() to import N PDF pages into one N-up
// PDF page.
//
// - call PdfNupConverter.NupDocumentConvert() to convert a PDF document to a
// N-up PDF document.
//
// - call PdfNupConverter.SetWebContentsURL() to set the URL that is committed
// in the main frame of the WebContents for crash diagnosis.
interface PdfNupConverter {
// The status of PDF conversion execution.
enum Status {
SUCCESS = 0,
CONVERSION_FAILURE = 1,
HANDLE_MAP_ERROR = 2,
};
// Convert 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.
// |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,
array<mojo_base.mojom.ReadOnlySharedMemoryRegion> pdf_page_regions)
=> (Status status, mojo_base.mojom.ReadOnlySharedMemoryRegion? pdf_region);
// Convert 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.
NupDocumentConvert(uint32 pages_per_sheet,
gfx.mojom.Size page_size,
mojo_base.mojom.ReadOnlySharedMemoryRegion src_pdf_region)
=> (Status status, mojo_base.mojom.ReadOnlySharedMemoryRegion? pdf_region);
// Sets the URL which is committed in the main frame of the WebContents,
// for use in crash diagnosis.
SetWebContentsURL(url.mojom.Url url);
};