1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  * This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 #ifndef MOZILLA_GFX_PRINTTARGETPDF_H
7 #define MOZILLA_GFX_PRINTTARGETPDF_H
8 
9 #include "nsCOMPtr.h"
10 #include "nsIOutputStream.h"
11 #include "PrintTarget.h"
12 
13 namespace mozilla {
14 namespace gfx {
15 
16 /**
17  * PDF printing target.
18  */
19 class PrintTargetPDF final : public PrintTarget
20 {
21 public:
22   static already_AddRefed<PrintTargetPDF>
23   CreateOrNull(nsIOutputStream *aStream,
24                const IntSize& aSizeInPoints);
25 
26   virtual nsresult EndPage() override;
27   virtual void Finish() override;
28 
29 private:
30   PrintTargetPDF(cairo_surface_t* aCairoSurface,
31                  const IntSize& aSize,
32                  nsIOutputStream *aStream);
33   virtual ~PrintTargetPDF();
34 
35   nsCOMPtr<nsIOutputStream> mStream;
36 };
37 
38 } // namespace gfx
39 } // namespace mozilla
40 
41 #endif /* MOZILLA_GFX_PRINTTARGETPDF_H */
42