qpdf_ruby 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,68 +0,0 @@
1
- // x_object_finder.hpp
2
- #pragma once
3
-
4
- #define POINTERHOLDER_TRANSITION 1
5
-
6
- #include <qpdf/QPDF.hh>
7
- #include <qpdf/QPDFPageDocumentHelper.hh>
8
- #include <qpdf/QPDFPageObjectHelper.hh>
9
- #include <qpdf/QPDFObjectHandle.hh>
10
- #include <qpdf/QIntC.hh>
11
- #include <qpdf/QPDFExc.hh>
12
- #include <qpdf/QTC.hh>
13
- #include <qpdf/QUtil.hh>
14
- #include <qpdf/BufferInputSource.hh>
15
- #include <qpdf/QPDFTokenizer.hh>
16
- #include <qpdf/Buffer.hh>
17
-
18
- #include <string>
19
- #include <vector>
20
- #include <iostream>
21
- #include <map>
22
- #include <stack>
23
- #include <regex>
24
- #include <sstream>
25
- #include <deque>
26
-
27
- struct ImageInfo {
28
- int mcid;
29
- double width;
30
- double height;
31
- std::array<double, 6> cm_matrix; // stores the transformation matrix values
32
- std::array<double, 4> bbox = {0, 0, 0, 0}; // user-space bounding box [llx, lly, urx, ury]
33
-
34
- ImageInfo() : mcid(-1), width(0), height(0), cm_matrix{0, 0, 0, 0, 0, 0} {}
35
-
36
- ImageInfo(int m, double w, double h, const std::array<double, 6>& cm) : mcid(m), width(w), height(h), cm_matrix(cm) {}
37
-
38
- std::string to_string() const {
39
- std::ostringstream oss;
40
- oss << "ImageInfo(mcid=" << mcid << ", width=" << width << ", height=" << height << ", cm_matrix=[";
41
- for (size_t i = 0; i < cm_matrix.size(); ++i) {
42
- oss << cm_matrix[i];
43
- if (i != cm_matrix.size() - 1) oss << ", ";
44
- }
45
- oss << "])";
46
- return oss.str();
47
- }
48
- };
49
-
50
- class PDFImageMapper {
51
- public:
52
- explicit PDFImageMapper(int target_mcid);
53
-
54
- void find(QPDF& pdf);
55
- // Parses the page's content stream to find the XObject name for the MCID
56
- void find(QPDFPageObjectHelper& page);
57
-
58
- void push_cm(double value);
59
-
60
- // Expose internal map for external use
61
- const std::map<std::string, ImageInfo>& getImageMap() const { return image_to_mcid; }
62
-
63
- private:
64
- int target_mcid;
65
- bool in_target_mcid;
66
- std::map<std::string, ImageInfo> image_to_mcid;
67
- std::deque<double> cm_fixed_size_queue;
68
- };