|
@@ -15,28 +15,10 @@
|
|
|
#include <LibPDF/Encryption.h>
|
|
|
#include <LibPDF/Error.h>
|
|
|
#include <LibPDF/ObjectDerivatives.h>
|
|
|
+#include <LibPDF/Page.h>
|
|
|
|
|
|
namespace PDF {
|
|
|
|
|
|
-struct Rectangle {
|
|
|
- float lower_left_x;
|
|
|
- float lower_left_y;
|
|
|
- float upper_right_x;
|
|
|
- float upper_right_y;
|
|
|
-
|
|
|
- float width() const { return upper_right_x - lower_left_x; }
|
|
|
- float height() const { return upper_right_y - lower_left_y; }
|
|
|
-};
|
|
|
-
|
|
|
-struct Page {
|
|
|
- NonnullRefPtr<DictObject> resources;
|
|
|
- RefPtr<Object> contents;
|
|
|
- Rectangle media_box;
|
|
|
- Rectangle crop_box;
|
|
|
- float user_unit;
|
|
|
- int rotate;
|
|
|
-};
|
|
|
-
|
|
|
struct Destination {
|
|
|
enum class Type {
|
|
|
XYZ,
|
|
@@ -204,34 +186,6 @@ private:
|
|
|
|
|
|
namespace AK {
|
|
|
|
|
|
-template<>
|
|
|
-struct Formatter<PDF::Rectangle> : Formatter<FormatString> {
|
|
|
- ErrorOr<void> format(FormatBuilder& builder, PDF::Rectangle const& rectangle)
|
|
|
- {
|
|
|
- return Formatter<FormatString>::format(builder,
|
|
|
- "Rectangle {{ ll=({}, {}), ur=({}, {}) }}"sv,
|
|
|
- rectangle.lower_left_x,
|
|
|
- rectangle.lower_left_y,
|
|
|
- rectangle.upper_right_x,
|
|
|
- rectangle.upper_right_y);
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-template<>
|
|
|
-struct Formatter<PDF::Page> : Formatter<FormatString> {
|
|
|
- ErrorOr<void> format(FormatBuilder& builder, PDF::Page const& page)
|
|
|
- {
|
|
|
- return Formatter<FormatString>::format(builder,
|
|
|
- "Page {{\n resources={}\n contents={}\n media_box={}\n crop_box={}\n user_unit={}\n rotate={}\n}}"sv,
|
|
|
- page.resources->to_deprecated_string(1),
|
|
|
- page.contents->to_deprecated_string(1),
|
|
|
- page.media_box,
|
|
|
- page.crop_box,
|
|
|
- page.user_unit,
|
|
|
- page.rotate);
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
template<>
|
|
|
struct Formatter<PDF::Destination> : Formatter<FormatString> {
|
|
|
ErrorOr<void> format(FormatBuilder& builder, PDF::Destination const& destination)
|