diff options
author | Glenn Rice <glennricster@gmail.com> | 2012-11-27 20:18:56 -0600 |
---|---|---|
committer | Glenn Rice <glennricster@gmail.com> | 2012-11-27 20:18:56 -0600 |
commit | 820f5a7bd024625c0b72f1676c9982f2c90ba92c (patch) | |
tree | 3f4770486d38483c84167b5697414413f0b9586a |
Add existing code.0.20.1
134 files changed, 18840 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..27533bf --- /dev/null +++ b/.gitignore @@ -0,0 +1,119 @@ +*.la +*.o +.deps +.dirstamp +.libs +.stamps +Makefile +Makefile.in + +# / +/aclocal.m4 +/configure +/config.log +/config.status +/autom4te.cache +/libtool + +# /build/ +/build + +# /codegen/extradefs/ +/codegen/extradefs/generate_extra_defs + +# /doc/reference/ +/doc/reference/Doxyfile +/doc/reference/doxygen.log +/doc/reference/html +/doc/reference/poppler-glibmm-1.0.devhelp2 +/doc/reference/poppler-glibmm-1.0.tag + +# /examples/demo/ +/examples/demo/poppler-glibmm-demo + +# /poppler-glib/ +/poppler-glib/poppler-glibmmconfig.h +/poppler-glib/poppler-glibmm-1.0.pc +/poppler-glib/svn-prop.tmp +/poppler-glib/poppler-glibmm-1.0-uninstalled.pc +/poppler-glib/stamp-h2 + +# /poppler-glib/poppler-glibmm/ +/poppler-glib/poppler-glibmm/*.lo +/poppler-glib/poppler-glibmm/action.cc +/poppler-glib/poppler-glibmm/action.h +/poppler-glib/poppler-glibmm/annot.cc +/poppler-glib/poppler-glibmm/annot.h +/poppler-glib/poppler-glibmm/annot_callout_line.cc +/poppler-glib/poppler-glibmm/annot_callout_line.h +/poppler-glib/poppler-glibmm/annot_mapping.cc +/poppler-glib/poppler-glibmm/annot_mapping.h +/poppler-glib/poppler-glibmm/attachment.cc +/poppler-glib/poppler-glibmm/attachment.h +/poppler-glib/poppler-glibmm/color.cc +/poppler-glib/poppler-glibmm/color.h +/poppler-glib/poppler-glibmm/document.cc +/poppler-glib/poppler-glibmm/document.h +/poppler-glib/poppler-glibmm/error.cc +/poppler-glib/poppler-glibmm/error.h +/poppler-glib/poppler-glibmm/font_info.cc +/poppler-glib/poppler-glibmm/font_info.h +/poppler-glib/poppler-glibmm/fonts_iter.cc +/poppler-glib/poppler-glibmm/fonts_iter.h +/poppler-glib/poppler-glibmm/form_field.cc +/poppler-glib/poppler-glibmm/form_field.h +/poppler-glib/poppler-glibmm/form_field_mapping.cc +/poppler-glib/poppler-glibmm/form_field_mapping.h +/poppler-glib/poppler-glibmm/image_mapping.cc +/poppler-glib/poppler-glibmm/image_mapping.h +/poppler-glib/poppler-glibmm/index_iter.cc +/poppler-glib/poppler-glibmm/index_iter.h +/poppler-glib/poppler-glibmm/layer.cc +/poppler-glib/poppler-glibmm/layer.h +/poppler-glib/poppler-glibmm/layers_iter.cc +/poppler-glib/poppler-glibmm/layers_iter.h +/poppler-glib/poppler-glibmm/link_mapping.cc +/poppler-glib/poppler-glibmm/link_mapping.h +/poppler-glib/poppler-glibmm/media.cc +/poppler-glib/poppler-glibmm/media.h +/poppler-glib/poppler-glibmm/movie.cc +/poppler-glib/poppler-glibmm/movie.h +/poppler-glib/poppler-glibmm/page.cc +/poppler-glib/poppler-glibmm/page.h +/poppler-glib/poppler-glibmm/page_transition.cc +/poppler-glib/poppler-glibmm/page_transition.h +/poppler-glib/poppler-glibmm/ps_file.cc +/poppler-glib/poppler-glibmm/ps_file.h +/poppler-glib/poppler-glibmm/rectangle.cc +/poppler-glib/poppler-glibmm/rectangle.h +/poppler-glib/poppler-glibmm/text_attributes.cc +/poppler-glib/poppler-glibmm/text_attributes.h +/poppler-glib/poppler-glibmm/utility.cc +/poppler-glib/poppler-glibmm/utility.h + +# /poppler-glib/poppler-glibmm/private/ +/poppler-glib/poppler-glibmm/private/action_p.h +/poppler-glib/poppler-glibmm/private/annot_callout_line_p.h +/poppler-glib/poppler-glibmm/private/annot_mapping_p.h +/poppler-glib/poppler-glibmm/private/annot_p.h +/poppler-glib/poppler-glibmm/private/attachment_p.h +/poppler-glib/poppler-glibmm/private/color_p.h +/poppler-glib/poppler-glibmm/private/document_p.h +/poppler-glib/poppler-glibmm/private/error_p.h +/poppler-glib/poppler-glibmm/private/font_info_p.h +/poppler-glib/poppler-glibmm/private/fonts_iter_p.h +/poppler-glib/poppler-glibmm/private/form_field_mapping_p.h +/poppler-glib/poppler-glibmm/private/form_field_p.h +/poppler-glib/poppler-glibmm/private/image_mapping_p.h +/poppler-glib/poppler-glibmm/private/index_iter_p.h +/poppler-glib/poppler-glibmm/private/layer_p.h +/poppler-glib/poppler-glibmm/private/layers_iter_p.h +/poppler-glib/poppler-glibmm/private/link_mapping_p.h +/poppler-glib/poppler-glibmm/private/media_p.h +/poppler-glib/poppler-glibmm/private/movie_p.h +/poppler-glib/poppler-glibmm/private/page_p.h +/poppler-glib/poppler-glibmm/private/page_transition_p.h +/poppler-glib/poppler-glibmm/private/ps_file_p.h +/poppler-glib/poppler-glibmm/private/rectangle_p.h +/poppler-glib/poppler-glibmm/private/text_attributes_p.h +/poppler-glib/poppler-glibmm/private/utility_p.h @@ -0,0 +1,4 @@ +poppler-glibmm was created by + + Glenn Rice <glennricster@gmail.com> + @@ -0,0 +1,510 @@ + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations +below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it +becomes a de-facto standard. To achieve this, non-free programs must +be allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control +compilation and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at least + three years, to give the same user the materials specified in + Subsection 6a, above, for a charge no more than the cost of + performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply, and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License +may add an explicit geographical distribution limitation excluding those +countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms +of the ordinary General Public License). + + To apply these terms, attach the following notices to the library. +It is safest to attach them to the start of each source file to most +effectively convey the exclusion of warranty; and each file should +have at least the "copyright" line and a pointer to where the full +notice is found. + + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or +your school, if any, to sign a "copyright disclaimer" for the library, +if necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James + Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..08cdadb --- /dev/null +++ b/ChangeLog @@ -0,0 +1,2 @@ +The ChangeLog is auto-generated when releasing. If you +are seeing this, use 'git log' for a detailed list of changes. @@ -0,0 +1,370 @@ +Installation Instructions +************************* + +Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, +Inc. + + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. Some packages provide this +`INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + + The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package, generally using the just-built uninstalled binaries. + + 4. Type `make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the `make install' phase executed with root + privileges. + + 5. Optionally, type `make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior `make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 7. Often, you can also type `make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide `make + distcheck', which can by used by developers to test that all other + targets like `make install' and `make uninstall' work correctly. + This target is generally not run by end users. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. This +is known as a "VPATH" build. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX', where PREFIX must be an +absolute file name. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the +default for these options is expressed in terms of `${prefix}', so that +specifying just `--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to `configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +`make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, `make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +`${prefix}'. Any directories that were specified during `configure', +but not in terms of `${prefix}', must each be overridden at install +time for the entire installation to be relocated. The approach of +makefile variable overrides for each directory variable is required by +the GNU Coding Standards, and ideally causes no recompilation. +However, some platforms have known limitations with the semantics of +shared libraries that end up requiring recompilation when using this +method, particularly noticeable in packages that use GNU Libtool. + + The second method involves providing the `DESTDIR' variable. For +example, `make install DESTDIR=/alternate/directory' will prepend +`/alternate/directory' before all installation names. The approach of +`DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of `${prefix}' +at `configure' time. + +Optional Features +================= + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of `make' will be. For these packages, running `./configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with `make V=1'; while running `./configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with `make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + HP-UX `make' updates targets which have the same time stamps as +their prerequisites, which makes it generally unusable when shipped +generated files such as `configure' are involved. Use GNU `make' +instead. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `<wchar.h>' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put `/usr/ucb' early in your `PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in `/usr/bin'. So, if you need `/usr/ucb' +in your `PATH', put it _after_ `/usr/bin'. + + On Haiku, software installed for all users goes in `/boot/common', +not `/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..76b812c --- /dev/null +++ b/Makefile.am @@ -0,0 +1,45 @@ +## Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> +## +## This file is part of poppler-glibmm. +## +## poppler-glibmm is free software: you can redistribute it and/or modify it +## under the terms of the GNU Lesser General Public License as published +## by the Free Software Foundation, either version 2.1 of the License, +## or (at your option) any later version. +## +## poppler-glibmm is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +## See the GNU Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public License +## along with this program. If not, see <http://www.gnu.org/licenses/>. + +ACLOCAL_AMFLAGS = -I build ${ACLOCAL_FLAGS} +DISTCHECK_CONFIGURE_FLAGS = --enable-warnings=fatal + +if MAINTAINER_MODE +src_subdirs = codegen poppler-glib/src +else +src_subdirs = +endif +if ENABLE_DOCUMENTATION +doc_subdirs = doc +else +doc_subdirs = +endif +SUBDIRS = $(src_subdirs) poppler-glib/poppler-glibmm examples $(doc_subdirs) + +poppler_glibmm_includedir = $(includedir)/$(POPPLER_GLIBMM_MODULE_NAME) +poppler_glibmm_include_HEADERS = poppler-glib/poppler-glibmm.h + +poppler_glibmm_libincludedir = $(libdir)/$(POPPLER_GLIBMM_MODULE_NAME)/include +nodist_poppler_glibmm_libinclude_HEADERS = poppler-glib/poppler-glibmmconfig.h + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = poppler-glib/$(POPPLER_GLIBMM_MODULE_NAME).pc + +dist_noinst_SCRIPTS = autogen.sh + +# Optional: auto-generate the ChangeLog file from the git log on make dist +#include $(top_srcdir)/build/dist-changelog.am @@ -0,0 +1,2 @@ +Release 0.20.1 +* Initial release @@ -0,0 +1,2 @@ +poppler-glibmm is the C++ binding for the poppler-glib library. +This module is part of the GNOME C++ bindings effort <http://www.gtkmm.org/>. diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..6686611 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,7 @@ +#! /bin/sh -e +test -n "$srcdir" || srcdir=`dirname "$0"` +test -n "$srcdir" || srcdir=. + +mm-common-prepare --copy --force "$srcdir" +autoreconf --force --install --verbose "$srcdir" +test -n "$NOCONFIGURE" || "$srcdir/configure" --enable-maintainer-mode "$@" diff --git a/codegen/Makefile.am b/codegen/Makefile.am new file mode 100644 index 0000000..a9ba322 --- /dev/null +++ b/codegen/Makefile.am @@ -0,0 +1,33 @@ +## Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> +## +## This file is part of poppler-glibmm. +## +## poppler-glibmm is free software: you can redistribute it and/or modify it +## under the terms of the GNU Lesser General Public License as published +## by the Free Software Foundation, either version 2.1 of the License, +## or (at your option) any later version. +## +## poppler-glibmm is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +## See the GNU Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public License +## along with this program. If not, see <http://www.gnu.org/licenses/>. + +AUTOMAKE_OPTIONS = subdir-objects + +include $(srcdir)/m4/filelist.am + +dist_noinst_DATA = $(addprefix m4/,$(files_codegen_m4)) +noinst_PROGRAMS = extradefs/generate_extra_defs + +extradefs_generate_extra_defs_SOURCES = extradefs/generate_extra_defs_poppler-glib.cc +extradefs_generate_extra_defs_LDADD = $(POPPLER_GLIBMM_LIBS) -lglibmm_generate_extra_defs-2.4 + +AM_CPPFLAGS = -I$(top_builddir) $(GTHREAD_CFLAGS) $(POPPLER_GLIBMM_CFLAGS) +AM_CXXFLAGS = $(POPPLER_GLIBMM_WXXFLAGS) + +# Instruct GNU make to delete the targets of a rule after it failed, in +# order to avoid the complication of handling that situation manually. +.DELETE_ON_ERROR: diff --git a/codegen/extradefs/generate_extra_defs_poppler-glib.cc b/codegen/extradefs/generate_extra_defs_poppler-glib.cc new file mode 100644 index 0000000..154d0f6 --- /dev/null +++ b/codegen/extradefs/generate_extra_defs_poppler-glib.cc @@ -0,0 +1,88 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <glibmm_generate_extra_defs/generate_extra_defs.h> +#include <poppler.h> +#include <iostream> + +int main(int, char**) +{ + g_type_init(); + + std::cout + << get_defs(POPPLER_TYPE_ACTION) + << get_defs(POPPLER_TYPE_ACTION_LAYER_ACTION) + << get_defs(POPPLER_TYPE_ACTION_MOVIE_OPERATION) + << get_defs(POPPLER_TYPE_ACTION_TYPE) + << get_defs(POPPLER_TYPE_ANNOT) + << get_defs(POPPLER_TYPE_ANNOT_CALLOUT_LINE) + << get_defs(POPPLER_TYPE_ANNOT_EXTERNAL_DATA_TYPE) + << get_defs(POPPLER_TYPE_ANNOT_FILE_ATTACHMENT) + << get_defs(POPPLER_TYPE_ANNOT_FLAG) + << get_defs(POPPLER_TYPE_ANNOT_FREE_TEXT) + << get_defs(POPPLER_TYPE_ANNOT_FREE_TEXT_QUADDING) + << get_defs(POPPLER_TYPE_ANNOT_MAPPING) + << get_defs(POPPLER_TYPE_ANNOT_MARKUP) + << get_defs(POPPLER_TYPE_ANNOT_MARKUP_REPLY_TYPE) + << get_defs(POPPLER_TYPE_ANNOT_MOVIE) + << get_defs(POPPLER_TYPE_ANNOT_SCREEN) + << get_defs(POPPLER_TYPE_ANNOT_TEXT) + << get_defs(POPPLER_TYPE_ANNOT_TEXT_STATE) + << get_defs(POPPLER_TYPE_ANNOT_TYPE) + << get_defs(POPPLER_TYPE_ATTACHMENT) + << get_defs(POPPLER_TYPE_BACKEND) + << get_defs(POPPLER_TYPE_COLOR) + << get_defs(POPPLER_TYPE_DEST) + << get_defs(POPPLER_TYPE_DEST_TYPE) + << get_defs(POPPLER_TYPE_DOCUMENT) + << get_defs(POPPLER_TYPE_ERROR) + << get_defs(POPPLER_TYPE_FONTS_ITER) + << get_defs(POPPLER_TYPE_FONT_INFO) + << get_defs(POPPLER_TYPE_FONT_TYPE) + << get_defs(POPPLER_TYPE_FORM_BUTTON_TYPE) + << get_defs(POPPLER_TYPE_FORM_CHOICE_TYPE) + << get_defs(POPPLER_TYPE_FORM_FIELD) + << get_defs(POPPLER_TYPE_FORM_FIELD_MAPPING) + << get_defs(POPPLER_TYPE_FORM_FIELD_TYPE) + << get_defs(POPPLER_TYPE_FORM_TEXT_TYPE) + << get_defs(POPPLER_TYPE_IMAGE_MAPPING) + << get_defs(POPPLER_TYPE_INDEX_ITER) + << get_defs(POPPLER_TYPE_LAYER) + << get_defs(POPPLER_TYPE_LAYERS_ITER) + << get_defs(POPPLER_TYPE_LINK_MAPPING) + << get_defs(POPPLER_TYPE_MEDIA) + << get_defs(POPPLER_TYPE_MOVIE) + << get_defs(POPPLER_TYPE_ORIENTATION) + << get_defs(POPPLER_TYPE_PAGE) + << get_defs(POPPLER_TYPE_PAGE_LAYOUT) + << get_defs(POPPLER_TYPE_PAGE_MODE) + << get_defs(POPPLER_TYPE_PAGE_TRANSITION) + << get_defs(POPPLER_TYPE_PAGE_TRANSITION_ALIGNMENT) + << get_defs(POPPLER_TYPE_PAGE_TRANSITION_DIRECTION) + << get_defs(POPPLER_TYPE_PAGE_TRANSITION_TYPE) + << get_defs(POPPLER_TYPE_PERMISSIONS) + << get_defs(POPPLER_TYPE_PRINT_FLAGS) + << get_defs(POPPLER_TYPE_PS_FILE) + << get_defs(POPPLER_TYPE_RECTANGLE) + << get_defs(POPPLER_TYPE_SELECTION_STYLE) + << get_defs(POPPLER_TYPE_TEXT_ATTRIBUTES) + << get_defs(POPPLER_TYPE_VIEWER_PREFERENCES) + << std::endl; + + return 0; +} diff --git a/codegen/m4/convert.m4 b/codegen/m4/convert.m4 new file mode 100644 index 0000000..36e711f --- /dev/null +++ b/codegen/m4/convert.m4 @@ -0,0 +1,4 @@ +dnl Include gmmproc type conversion definitions: +m4_include(`convert_base.m4') +m4_include(`convert_glib.m4') +m4_include(`convert_poppler-glib.m4') diff --git a/codegen/m4/convert_poppler-glib.m4 b/codegen/m4/convert_poppler-glib.m4 new file mode 100644 index 0000000..4068d15 --- /dev/null +++ b/codegen/m4/convert_poppler-glib.m4 @@ -0,0 +1,84 @@ +dnl Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> +dnl This file is part of poppler-glibmm. + +_CONV_ENUM(Poppler,ActionLayerAction) +_CONV_ENUM(Poppler,ActionMovieOperation) +_CONV_ENUM(Poppler,ActionType) +_CONV_ENUM(Poppler,AnnotExternalDataType) +_CONV_ENUM(Poppler,AnnotFlag) +_CONV_ENUM(Poppler,AnnotFreeTextQuadding) +_CONV_ENUM(Poppler,AnnotMarkupReplyType) +_CONV_ENUM(Poppler,AnnotTextState) +_CONV_ENUM(Poppler,AnnotType) +_CONV_ENUM(Poppler,Backend) +_CONV_ENUM(Poppler,DestType) +_CONV_ENUM(Poppler,FontType) +_CONV_ENUM(Poppler,FormButtonType) +_CONV_ENUM(Poppler,FormChoiceType) +_CONV_ENUM(Poppler,FormFieldType) +_CONV_ENUM(Poppler,FormTextType) +_CONV_ENUM(Poppler,PageLayout) +_CONV_ENUM(Poppler,PageMode) +_CONV_ENUM(Poppler,PageTransitionAlignment) +_CONV_ENUM(Poppler,PageTransitionDirection) +_CONV_ENUM(Poppler,PageTransitionType) +_CONV_ENUM(Poppler,Permissions) +_CONV_ENUM(Poppler,PrintFlags) +_CONV_ENUM(Poppler,SelectionStyle) +_CONV_ENUM(Poppler,ViewerPreferences) + +_CONVERSION(`PopplerDocument*',`Glib::RefPtr<Document>',`Glib::wrap($3)') +_CONVERSION(`const Glib::RefPtr<Document>&',`PopplerDocument*',`($3)->gobj()') +_CONVERSION(`PopplerDest*',`Dest',`Glib::wrap($3)') +_CONVERSION(`const PopplerDest*',`Dest',`Glib::wrap($3, true)') +_CONVERSION(`PopplerFontInfo*',`Glib::RefPtr<FontInfo>',`Glib::wrap($3)') +_CONVERSION(`PopplerPSFile*',`Glib::RefPtr<PSFile>',`Glib::wrap($3)') +_CONVERSION(`const Glib::RefPtr<PSFile>&',`PopplerPSFile*',`($3)->gobj()') +_CONVERSION(`PopplerFormField*',`Glib::RefPtr<FormField>',`Glib::wrap($3)') +_CONVERSION(`PopplerIndexIter*',`IndexIter',`Glib::wrap($3)') +_CONVERSION(`PopplerLayersIter*',`LayersIter',`Glib::wrap($3)') +_CONVERSION(`PopplerAction*',`Action',`Glib::wrap($3)') +_CONVERSION(`const PopplerAction*',`Action',`Action($3)') +_CONVERSION(`PopplerLayer*',`Glib::RefPtr<Layer>',`Glib::wrap($3)') +_CONVERSION(`PopplerMedia*',`Glib::RefPtr<Media>',`Glib::wrap($3)') +_CONVERSION(`PopplerMedia*',`Glib::RefPtr<const Media>',`Glib::wrap($3)') +_CONVERSION(`PopplerMovie*',`Glib::RefPtr<Movie>',`Glib::wrap($3)') +_CONVERSION(`PopplerMovie*',`Glib::RefPtr<const Movie>',`Glib::wrap($3)') +_CONVERSION(`PopplerFormField*',`Glib::RefPtr<const FormField>',`Glib::wrap($3)') + +_CONVERSION(`PopplerAnnot*',`Glib::RefPtr<AnnotText>',`Glib::wrap((PopplerAnnotText*)($3))') +_CONVERSION(`const Glib::RefPtr<Annot>&',`PopplerAnnot*',`($3)->gobj()') +_CONVERSION(`PopplerAnnotCalloutLine*',`AnnotCalloutLine',`Glib::wrap($3)') +_CONVERSION(`PopplerAnnot*',`Glib::RefPtr<const Annot>',`Glib::wrap($3)') +_CONVERSION(`PopplerAnnot*',`Glib::RefPtr<Annot>',`Glib::wrap($3)') + +_CONVERSION(`PopplerPage*',`Glib::RefPtr<Page>',`Glib::wrap($3)') +_CONVERSION(`PopplerPageTransition*',`PageTransition',`Glib::wrap($3)') + +_CONVERSION(`const Cairo::RefPtr<Cairo::Context>&',`cairo_t*',`($3)->cobj()') +_CONVERSION(`const Cairo::RefPtr<const Cairo::Context>&',`cairo_t*',`const_cast<cairo_t*>(($3)->cobj())') +_CONVERSION(`const Cairo::RefPtr<Cairo::Surface>&',`cairo_surface_t*',`($3)->cobj()') +_CONVERSION(`const Cairo::RefPtr<const Cairo::Surface>&',`cairo_surface_t*',`const_cast<cairo_surface_t*>(($3)->cobj())') +_CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<Cairo::ImageSurface>',`Cairo::RefPtr<Cairo::ImageSurface>(new Cairo::ImageSurface($3))') +_CONVERSION(`cairo_region_t*',`Cairo::RefPtr<Cairo::Region>',`Cairo::RefPtr<Cairo::Region>(new Cairo::Region($3))') + +_CONVERSION(`PopplerAttachment*',`Glib::RefPtr<Attachment>',`Glib::wrap($3)') +_CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Attachment> >',`$2($3, Glib::OWNERSHIP_NONE)') +_CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<const Attachment> >',`$2($3, Glib::OWNERSHIP_NONE)') + +_CONVERSION(`Rectangle&',`PopplerRectangle*',($3).gobj()) +_CONVERSION(`Poppler::Rectangle&',`PopplerRectangle*',($3).gobj()) +_CONVERSION(`const Rectangle&',`const PopplerRectangle*',($3).gobj()) +_CONVERSION(`const Rectangle&',`PopplerRectangle*',`const_cast<PopplerRectangle*>(($3).gobj())') +_CONVERSION(`const Poppler::Rectangle&',`const PopplerRectangle*',($3).gobj()) +_CONVERSION(`PopplerRectangle*',`Rectangle',`Glib::wrap($3)') +_CONVERSION(`PopplerRectangle',`Rectangle',`Rectangle(const_cast<PopplerRectangle*>(&($3)))') + +_CONVERSION(`Color&',`PopplerColor*',($3).gobj()) +_CONVERSION(`Poppler::Color&',`PopplerColor*',($3).gobj()) +_CONVERSION(`const Color&',`const PopplerColor*',($3).gobj()) +_CONVERSION(`const Color&',`PopplerColor*',`const_cast<PopplerColor*>(($3).gobj())') +_CONVERSION(`const Poppler::Color&',`const PopplerColor*',($3).gobj()) +_CONVERSION(`PopplerColor',`Color',`Color(const_cast<PopplerColor*>(&($3)))') +_CONVERSION(`Color',`PopplerColor',`*(($3).gobj())') +_CONVERSION(`PopplerColor*',`Color',`Glib::wrap($3)') diff --git a/codegen/m4/filelist.am b/codegen/m4/filelist.am new file mode 100644 index 0000000..9bf91b1 --- /dev/null +++ b/codegen/m4/filelist.am @@ -0,0 +1,3 @@ +## This file is part of poppler-glibmm. + +files_codegen_m4 = convert.m4 convert_poppler-glib.m4 diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..e594468 --- /dev/null +++ b/configure.ac @@ -0,0 +1,79 @@ +## Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> +## +## This file is part of poppler-glibmm. +## +## poppler-glibmm is free software: you can redistribute it and/or modify it +## under the terms of the GNU Lesser General Public License as published +## by the Free Software Foundation, either version 2.1 of the License, +## or (at your option) any later version. +## +## poppler-glibmm is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +## See the GNU Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public License +## along with this program. If not, see <http://www.gnu.org/licenses/>. + +AC_INIT([poppler-glibmm], [0.20.1], [https://bugzilla.gnome.org/enter_bug.cgi?product=poppler-glibmm], + [poppler-glibmm], [http://www.gtkmm.org/]) +AC_PREREQ([2.59]) + +AC_CONFIG_SRCDIR([poppler-glib/poppler-glibmm.h]) +AC_CONFIG_AUX_DIR([build]) +AC_CONFIG_MACRO_DIR([build]) +AC_CONFIG_HEADERS([build/config.h poppler-glib/poppler-glibmmconfig.h]) + +AM_INIT_AUTOMAKE([1.9 -Wno-portability check-news dist-bzip2 no-define nostdinc tar-pax]) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) +AM_MAINTAINER_MODE +AC_ARG_VAR([ACLOCAL_FLAGS], [aclocal flags, e.g. -I <macro dir>]) + +MM_PREREQ([0.9]) +MM_INIT_MODULE([poppler-glibmm-1.0]) + +# Copy the mm-common .pl scripts into doc/, and use them from there, +# so we can dist them to avoid a tarball-build dependency. +MM_CONFIG_DOCTOOL_DIR([doc]) + +# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html +AC_SUBST([POPPLER_GLIBMM_SO_VERSION], [0:0:0]) + +AC_PROG_CXX +AC_DISABLE_STATIC +AC_LIBTOOL_WIN32_DLL +AC_PROG_LIBTOOL + + +AC_SUBST([POPPLER_GLIBMM_MODULES], ['poppler-glib >= 0.20 glibmm-2.4 >= 2.16 cairomm-1.0 >= 1.10']) +PKG_CHECK_MODULES([POPPLER_GLIBMM], [$POPPLER_GLIBMM_MODULES]) + +# This is only needed for the demos +AC_SUBST([GTKMM_MODULES], ['gtkmm-3.0 >= 3.4.0']) +PKG_CHECK_MODULES([GTKMM], [$GTKMM_MODULES]) + +MM_PKG_CONFIG_SUBST([GTHREAD_CFLAGS], [--cflags-only-other gthread-2.0]) +MM_PKG_CONFIG_SUBST([GMMPROC_DIR], [--variable=gmmprocdir glibmm-2.4]) + +MM_ARG_ENABLE_DOCUMENTATION +MM_ARG_WITH_TAGFILE_DOC([libstdc++.tag], [mm-common-libstdc++]) +MM_ARG_WITH_TAGFILE_DOC([libsigc++-2.0.tag], [sigc++-2.0]) +MM_ARG_WITH_TAGFILE_DOC([glibmm-2.4.tag], [glibmm-2.4]) +MM_ARG_WITH_TAGFILE_DOC([cairomm-1.0.tag], [cairomm-1.0]) + +AC_LANG([C++]) +MM_ARG_ENABLE_WARNINGS([POPPLER_GLIBMM_WXXFLAGS], + [-Wall], + [-pedantic -Wall -Wextra], + [G POPPLER_GLIB GLIBMM CAIROMM GTKMM]) + +AC_CONFIG_FILES([Makefile + codegen/Makefile + poppler-glib/${POPPLER_GLIBMM_MODULE_NAME}.pc:poppler-glib/poppler-glibmm.pc.in + poppler-glib/${POPPLER_GLIBMM_MODULE_NAME}-uninstalled.pc:poppler-glib/poppler-glibmm-uninstalled.pc.in + poppler-glib/src/Makefile + poppler-glib/poppler-glibmm/Makefile + examples/Makefile + doc/Makefile + doc/reference/Doxyfile]) +AC_OUTPUT diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..6fdae21 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,27 @@ +## Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> +## +## This file is part of poppler-glibmm. +## +## poppler-glibmm is free software: you can redistribute it and/or modify it +## under the terms of the GNU Lesser General Public License as published +## by the Free Software Foundation, either version 2.1 of the License, +## or (at your option) any later version. +## +## poppler-glibmm is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +## See the GNU Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public License +## along with this program. If not, see <http://www.gnu.org/licenses/>. + +include $(top_srcdir)/poppler-glib/src/filelist.am +include $(top_srcdir)/poppler-glib/poppler-glibmm/filelist.am + +poppler_glibmm_files_h = $(files_built_h) $(filter-out wrap_init.h,$(files_extra_h)) + +book_name = $(POPPLER_GLIBMM_MODULE_NAME) +doc_input = $(top_srcdir)/poppler-glib/poppler-glibmm.h $(addprefix\ + $(top_srcdir)/poppler-glib/poppler-glibmm/,$(poppler_glibmm_files_h)) + +include $(top_srcdir)/build/doc-reference.am diff --git a/doc/doc-install.pl b/doc/doc-install.pl new file mode 100644 index 0000000..91d3bdc --- /dev/null +++ b/doc/doc-install.pl @@ -0,0 +1,222 @@ +package main; + +# Copyright (c) 2009 Openismus GmbH <http://www.openismus.com/> +# +# This file is part of mm-common. +# +# mm-common is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation, either version 2 of the License, +# or (at your option) any later version. +# +# mm-common is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with mm-common. If not, see <http://www.gnu.org/licenses/>. + +use strict; +use warnings; +use bytes; +use File::Glob qw(:glob); +use File::Spec; +use Getopt::Long qw(:config no_getopt_compat no_ignore_case require_order bundling); + +# Globals +my $message_prefix; +my %tags_hash; +my $book_base; +my $perm_mode; +my $target_dir; +my $target_nodir = ''; +my $expand_glob = ''; +my $verbose = ''; + +sub path_basename ($) +{ + my ($path) = @_; + my $basename = File::Spec->splitpath($path); + + return $basename; +} + +sub exit_help () +{ + my $script_name = path_basename($0) || 'doc-install.pl'; + + print <<"EOF"; +Usage: perl $script_name [OPTION]... [-T] SOURCE DEST + or: perl $script_name [OPTION]... SOURCE... DIRECTORY + or: perl $script_name [OPTION]... -t DIRECTORY SOURCE... + +Copy SOURCE to DEST or multiple SOURCE files to the existing DIRECTORY, +while setting permission modes. For HTML files, translate references to +external documentation. + +Mandatory arguments to long options are mandatory for short options, too. + --book-base=BASEPATH use reference BASEPATH for Devhelp book + -l, --tag-base=TAGFILE\@BASEPATH use BASEPATH for references from TAGFILE + -m, --mode=MODE override file permission MODE (octal) + -t, --target-directory=DIRECTORY copy all SOURCE arguments into DIRECTORY + -T, --no-target-directory treat DEST as normal file + --glob expand SOURCE as filename glob pattern + -v, --verbose enable informational messages + -?, --help display this help and exit +EOF + exit; +} + +sub notice (@) +{ + print($message_prefix, @_, "\n") if ($verbose); +} + +sub warning (@) +{ + print STDERR ($message_prefix, @_, "\n"); +} + +sub error (@) +{ + warning(@_); + exit 1; +} + +# Copy file to destination while translating references on the fly. +# Sniff the content for the file type, as it is always read in anyway. +sub install_file ($$$) +{ + my ($in_name, $out_name, $basename) = @_; + my ($in, $out, $buf); + { + local $/; # slurp mode: read entire file into buffer + + open($in, '<', $in_name) and binmode($in) and defined($buf = <$in>) and close($in) + or error('Failed to read ', $basename, ': ', $!); + } + + if (%tags_hash and $buf =~ m/\A(?> \s*)(?> (?> <[?!][^<]+ )* )<html[>\s]/sx) + { + my $count = 0; + my $total = $buf =~ + s!(?<= \s) doxygen="((?> [^:"]+)):((?> [^"]*))" # doxygen="(TAGFILE):(BASEPATH)" + (?> \s+) ((?> href|src) =") \2 ((?> [^"]*)") # (href|src=")BASEPATH(RELPATH") + ! $3 . ((exists $tags_hash{$1}) ? (++$count, $tags_hash{$1}) : $2) . $4 + !egsx; + my $change = $total ? "rewrote $count of $total" + : 'no'; + notice('Translating ', $basename, ' (', $change, ' references)'); + } + elsif (defined($book_base) and $buf =~ m/\A(?> \s*)(?> (?> <[?!][^<]+ )* )<book\s/sx) + { + # Substitute new value for attribute "base" of element <book> + my $change = $buf =~ s/(<book \s [^<>]*? \b base=") (?> [^"]*) (?= ")/$1$book_base/sx + ? 'rewrote base path' + : 'base path not set'; + notice('Translating ', $basename, ' (', $change, ')'); + } + else + { + notice('Copying ', $basename); + } + + # Avoid inheriting permissions of existing file + unlink($out_name); + + open($out, '>', $out_name) and binmode($out) and print $out ($buf) and close($out) + or error('Failed to write ', $basename, ': ', $!); + + chmod($perm_mode, $out_name) + or warning('Failed to set ', $basename, ' permissions: ', $!); +} + +# Split TAGFILE@BASEPATH argument into key/value pair +sub split_key_value ($) +{ + my ($mapping) = @_; + my ($name, $path) = split(m'@', $mapping, 2); + + error('Invalid base path mapping: ', $mapping) unless (defined($name) and $name ne ''); + + if (defined $path) + { + notice('Using base path ', $path, ' for tag file ', $name); + return ($name, $path); + } + notice('Not changing base path for tag file ', $name); + return (); +} + +# Define line leader of log messages +$message_prefix = path_basename($0); +$message_prefix =~ s/\.[^.]*$//s if (defined $message_prefix); +$message_prefix = ($message_prefix || 'doc-install') . ': '; + +# Process command-line options +{ + my @tags = (); + my $mode = '0644'; + + GetOptions('book-base=s' => \$book_base, + 'tag-base|l=s' => \@tags, + 'mode|m=s' => \$mode, + 'target-directory|t=s' => \$target_dir, + 'no-target-directory|T' => \$target_nodir, + 'glob' => \$expand_glob, + 'verbose|v' => \$verbose, + 'help|?' => \&exit_help) + or exit 2; + + error('Invalid permission mode: ', $mode) unless ($mode =~ m/^[0-7]+$/s); + + $perm_mode = oct($mode); + %tags_hash = map(split_key_value($_), @tags); +} +notice('Using base path ', $book_base, ' for Devhelp book') if (defined $book_base); + +if ($target_nodir) +{ + error('Conflicting target directory options') if (defined $target_dir); + error('Source and destination filenames expected') unless ($#ARGV == 1); + error('Filename globbing requires target directory') if ($expand_glob); + + install_file($ARGV[0], $ARGV[1], path_basename($ARGV[1])); + exit; +} + +unless (defined $target_dir) +{ + if (!$expand_glob and $#ARGV == 1) + { + my $basename = path_basename($ARGV[1]); + + if (defined($basename) and $basename ne '') + { + install_file($ARGV[0], $ARGV[1], $basename); + exit; + } + } + $target_dir = pop(@ARGV); +} +error('No target directory specified') unless (defined($target_dir) and $target_dir ne ''); + +@ARGV = map(bsd_glob($_, GLOB_NOSORT), @ARGV) if ($expand_glob); +my %basename_hash = (); + +foreach my $in_name (@ARGV) +{ + my $basename = path_basename($in_name); + + # If there are multiple files with the same base name in the list, only + # the first one will be installed. This behavior makes it very easy to + # implement a VPATH search for each individual file. + unless (exists $basename_hash{$basename}) + { + $basename_hash{$basename} = undef; + my $out_name = File::Spec->catfile($target_dir, $basename); + install_file($in_name, $out_name, $basename); + } +} +exit; diff --git a/doc/doc-postprocess.pl b/doc/doc-postprocess.pl new file mode 100644 index 0000000..2fbea7c --- /dev/null +++ b/doc/doc-postprocess.pl @@ -0,0 +1,121 @@ +package main; + +# Copyright (c) 2009 Openismus GmbH <http://www.openismus.com/> +# +# This file is part of mm-common. +# +# mm-common is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation, either version 2 of the License, +# or (at your option) any later version. +# +# mm-common is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with mm-common. If not, see <http://www.gnu.org/licenses/>. + +use strict; +use warnings; +use bytes; +use File::Glob qw(:glob); +use File::Spec; +use Getopt::Long qw(:config no_getopt_compat no_ignore_case require_order bundling); + +sub path_basename ($) +{ + my ($path) = @_; + my $basename = File::Spec->splitpath($path); + + return $basename; +} + +sub exit_help () +{ + my $script_name = path_basename($0) || 'doc-postprocess.pl'; + + print <<"EOF"; +Usage: perl $script_name [OPTION]... [PATTERN]... + +Post-process the Doxygen-generated HTML files matching PATTERN. + +Options: + -?, --help display this help and exit +EOF + exit; +} + +sub error (@) +{ + my $script_name = path_basename($0); + $script_name =~ s/\.[^.]*$//s if (defined $script_name); + + print STDERR ($script_name || 'doc-postprocess', ': ', @_, "\n"); + exit 1; +} + +GetOptions('help|?' => \&exit_help) + or exit 2; + +foreach my $filename (map(bsd_glob($_, GLOB_NOSORT), @ARGV)) +{ + my @buf; + my $file; + + open($file, '<', $filename) and (@buf = <$file>) and close($file) + or error('Failed to read ', path_basename($filename), ': ', $!); + + foreach (@buf) + { + if (/<a class="el"/) + { + # return value + s/ & */& /; + s/ \* */* /; + + # parameters + s/ &/&/g; + s/&\b/& /g; + s/ \*/*/g; + s/\*\b/* /g; + + # templates + s/\btemplate</template </; + } + elsif (/<td class="md(?:name)?"/) + { + # left parenthesis + s/\( */(/; + + # return value + s/ & /& /g; + s/ \* /* /g; + + # parameters + s/ & */& /g; + s/ \* */* /g; + + # templates + s/\btemplate</template </; + } + else + { + # template decls + s/^(<h\d>|)template</$1template </; + } + + s/©/©/g; + s/—/—/g; + s/–/–/g; + s/ * */ /g; + s/(?<=\S)\s{2,}/ /g; + } + + # write the whole buffer back + open($file, '>', $filename) and print $file (@buf) and close($file) + or error('Failed to write ', path_basename($filename), ': ', $!); +} + +exit; diff --git a/doc/doxygen.css b/doc/doxygen.css new file mode 100644 index 0000000..3e7b3f6 --- /dev/null +++ b/doc/doxygen.css @@ -0,0 +1,249 @@ +/* GNOME C++ bindings Doxygen style */ + +html, body { + background: #FFFFFF; + color: #222222; + margin: 0; +} + +body { + font: normal 90%/150% sans-serif; + padding: 1.5em; + min-width: 28em; +} + +table { + font-size: inherit; +} + +img { + border-style: none; +} + +address img { + vertical-align: middle; +} + +h1 { + font-size: 150%; + line-height: 120%; + text-align: center; +} + +h2 { + font-size: 120%; +} + +h3 { + font-size: 100%; +} + +h1 + h3 { + text-align: center; +} + +.navpath { + display: none; +} + +caption { + font-weight: bold; +} + +p, dl { + margin: 0.75em 0; +} + +.center { + text-align: center; +} + +div.qindex { + width: 100%; + line-height: 140%; + background-color: #E8EEF2; + border: 1px solid #84B0C7; + text-align: center; + margin: 0.2em; + padding: 0.2em; +} + +a { + color: #153788; + font-weight: normal; + text-decoration: none; +} + +.contents a:visited { + color: #1B77C5; +} + +a:hover { + text-decoration: underline; +} + +a.el, a.qindex { + font-weight: bold; +} + +dl.el { + margin-left: -1.5em; +} + +code, .fragment { + font-family: monospace, fixed; +} + +pre.fragment { + background-color: #EEEEFF; + border: 1px solid #AAAAFF; + padding: 0.5em; + margin: 0.375em 0.75em 0.375em 0.2em; +} + +div.ah { + background-color: #000000; + color: #FFFFFF; + font-weight: bold; + margin: 0.2em 0; +} + +.indexkey, .indexvalue { + background-color: #E8EEF2; + border: 1px solid #CCCCCC; + margin: 0.2em 0; + padding: 0.2em 0.75em; +} + +.indexkey { + font-weight: bold; +} +.memlist { + background-color: #F0F0F0; +} + +span.keyword { + color: #008000; +} + +span.keywordtype { + color: #604020; +} + +span.keywordflow { + color: #E08000; +} + +span.comment { + color: #800000; +} + +span.preprocessor { + color: #806020; +} + +span.stringliteral { + color: #002080; +} + +span.charliteral { + color: #008080; +} + +.tiny { + font-size: 80%; +} + +hr { + height: 0; + border: none; + border-top: 1px solid #666666; +} + +.mdescLeft, .mdescRight, .memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #FAFAFA; + border: none; + margin: 0.375em; + padding: 0.125em 0 0 0.75em; +} + +.mdescLeft, .mdescRight { + padding: 0 0.75em 0.375em; + color: #555555; +} + +.memItemLeft, .memItemRight, .memTemplParams { + border-top: 1px solid #CCCCCC; +} + +.memTemplParams { + color: #606060; +} + +.memtemplate { + color: #606060; + font-size: 90%; + font-weight: normal; + margin-left: 0.2em; +} + +.memnav { + background-color: #E8EEF2; + border: 1px solid #84B0C7; + text-align: center; + margin: 0.2em 1em 0.2em 0; + padding: 0.2em; +} + +.memitem { + margin: 0.5em 0; + padding: 0; +} + +.memname { + white-space: nowrap; + font-weight: bold; + line-height: 120%; +} + +.memproto, .memdoc { + border: 1px solid #84B0C7; +} + +.memproto { + padding: 0; + background-color: #D5E1E8; + font-weight: bold; + -webkit-border-top-left-radius: 1ex; + -webkit-border-top-right-radius: 1ex; + -moz-border-radius-topleft: 1ex; + -moz-border-radius-topright: 1ex; +} + +.memdoc { + padding: 0.2em 0.5em; + background-color: #EEF3F5; + border-top-width: 0; + -webkit-border-bottom-left-radius: 1ex; + -webkit-border-bottom-right-radius: 1ex; + -moz-border-radius-bottomleft: 1ex; + -moz-border-radius-bottomright: 1ex; +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; +} + +.paramname { + color: #602020; + white-space: nowrap; +} + +.paramname em { + font-style: normal; +} diff --git a/doc/reference/Doxyfile.in b/doc/reference/Doxyfile.in new file mode 100644 index 0000000..72e3316 --- /dev/null +++ b/doc/reference/Doxyfile.in @@ -0,0 +1,293 @@ +# Doxyfile 1.6.1 +# @configure_input@ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = @PACKAGE_NAME@ +PROJECT_NUMBER = @PACKAGE_VERSION@ +OUTPUT_DIRECTORY = reference +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = "@abs_top_builddir@/poppler-glib/" \ + "@abs_top_srcdir@/poppler-glib/" \ + "@abs_top_builddir@/" \ + "@abs_top_srcdir@/" +STRIP_FROM_INC_PATH = "@abs_top_builddir@/poppler-glib/" \ + "@abs_top_srcdir@/poppler-glib/" \ + "@abs_top_builddir@/" \ + "@abs_top_srcdir@/" +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = YES +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 8 +ALIASES = "newin{2}=\xrefitem since_\1_\2 \"Since @PACKAGE_NAME@ \1.\2\" \"New API in @PACKAGE_NAME@ \1.\2\"" +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +EXTENSION_MAPPING = +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +TYPEDEF_HIDES_STRUCT = NO +SYMBOL_CACHE_SIZE = 0 +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = NO +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = YES +HIDE_FRIEND_COMPOUNDS = YES +HIDE_IN_BODY_DOCS = YES +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_MEMBERS_CTORS_1ST = YES +SORT_GROUP_NAMES = YES +SORT_BY_SCOPE_NAME = YES +GENERATE_TODOLIST = NO +GENERATE_TESTLIST = NO +GENERATE_BUGLIST = NO +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 2 +SHOW_USED_FILES = NO +SHOW_DIRECTORIES = NO +SHOW_FILES = NO +SHOW_NAMESPACES = YES +FILE_VERSION_FILTER = +LAYOUT_FILE = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = YES +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = reference/doxygen.log +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = +RECURSIVE = NO +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = _* \ + adaptor_trait \ + basic_filebuf \ + basic_streambuf \ + binary_function \ + char_traits \ + internal \ + pair \ + unary_function +EXAMPLE_PATH = "@abs_top_srcdir@/examples" +EXAMPLE_PATTERNS = *.cc \ + *.h +EXAMPLE_RECURSIVE = YES +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +USE_HTAGS = NO +VERBATIM_HEADERS = NO +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = "$(MMDOCTOOLDIR)/doxygen.css" +HTML_ALIGN_MEMBERS = YES +HTML_DYNAMIC_SECTIONS = NO +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +CHM_INDEX_ENCODING = +BINARY_TOC = NO +TOC_EXPAND = NO +GENERATE_QHP = NO +QCH_FILE = +QHP_NAMESPACE = +QHP_VIRTUAL_FOLDER = doc +QHP_CUST_FILTER_NAME = +QHP_CUST_FILTER_ATTRS = +QHP_SECT_FILTER_ATTRS = +QHG_LOCATION = +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 1 +GENERATE_TREEVIEW = NONE +USE_INLINE_TREES = NO +TREEVIEW_WIDTH = 250 +FORMULA_FONTSIZE = 10 +SEARCHENGINE = NO +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = YES +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +LATEX_SOURCE_CODE = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = NO +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = "@abs_top_builddir@/poppler-glib" \ + "@abs_top_srcdir@/poppler-glib" +INCLUDE_FILE_PATTERNS = *.h +PREDEFINED = __cplusplus \ + DOXYGEN_SHOULD_SKIP_THIS \ + "G_GNUC_CONST=" \ + "G_GNUC_DEPRECATED=" \ + "G_GNUC_EXTENSION=" \ + "G_GNUC_INTERNAL=" \ + "G_GNUC_MALLOC=" \ + "G_GNUC_NORETURN=" \ + "G_GNUC_NO_INSTRUMENT=" \ + "G_GNUC_NULL_TERMINATED=" \ + "G_GNUC_PURE=" \ + "G_GNUC_WARN_UNUSED_RESULT=" \ + "G_MODULE_EXPORT=" \ + GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED \ + GLIBMM_EXCEPTIONS_ENABLED \ + GLIBMM_PROPERTIES_ENABLED \ + GLIBMM_VFUNCS_ENABLED \ + "POPPLER_GLIBMM_API=" +EXPAND_AS_DEFINED = POPPLER_GLIBMM_MAJOR_VERSION \ + POPPLER_GLIBMM_MINOR_VERSION \ + POPPLER_GLIBMM_MICRO_VERSION +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = @DOXYGEN_TAGFILES@ +GENERATE_TAGFILE = "reference/@POPPLER_GLIBMM_MODULE_NAME@.tag" +ALLEXTERNALS = NO +EXTERNAL_GROUPS = NO +PERL_PATH = @PERL@ +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +MSCGEN_PATH = +HIDE_UNDOC_RELATIONS = NO +HAVE_DOT = YES +DOT_FONTNAME = Sans +DOT_FONTSIZE = 10 +DOT_FONTPATH = +CLASS_GRAPH = YES +COLLABORATION_GRAPH = NO +GROUP_GRAPHS = NO +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = NO +INCLUDED_BY_GRAPH = NO +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = NO +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = YES +GENERATE_LEGEND = YES +DOT_CLEANUP = YES diff --git a/doc/tagfile-to-devhelp2.xsl b/doc/tagfile-to-devhelp2.xsl new file mode 100644 index 0000000..35b129c --- /dev/null +++ b/doc/tagfile-to-devhelp2.xsl @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="1.0" xmlns="http://www.devhelp.net/book" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <!-- + Copyright (c) 2009 Daniel Elstner <daniel.kitta@gmail.com> + + XSL transformation from a Doxygen tag file to DevHelp 2 format. + + This script is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation, either version 2 of the License, + or (at your option) any later version. + + This script is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this script. If not, see <http://www.gnu.org/licenses/>. + --> + <xsl:strip-space elements="*"/> + <xsl:output method="xml" version="1.0" indent="yes" encoding="UTF-8"/> + + <xsl:param name="book_title"/> + <xsl:param name="book_name"/> + <xsl:param name="book_base"/> + + <!-- Define keys to filter compounds that are members of other compounds --> + <xsl:key name="nested-group" match="compound[@kind='group']" use="subgroup"/> + <xsl:key name="nested-scope" match="compound[@kind='namespace']" use="namespace|class"/> + <xsl:key name="nested-scope" match="compound[@kind='class' or @kind='struct' or @kind='union']" + use="class"/> + + <xsl:template match="/"> + <book title="{$book_title}" name="{$book_name}" base="{$book_base}" + link="index.html" version="2" language="c++"> + <chapters> + <xsl:variable name="modules" select="tagfile/compound[@kind='group']"/> + <xsl:if test="$modules"> + <sub name="Modules" link="modules.html"> + <!-- Select the top-level group compounds --> + <xsl:apply-templates select="$modules[not(key('nested-group', name))]" + mode="module-list"> + <xsl:sort lang="en" select="title"/> + </xsl:apply-templates> + </sub> + </xsl:if> + <xsl:variable name="namespaces" select="tagfile/compound[@kind='namespace']"/> + <xsl:if test="$namespaces"> + <sub name="Namespaces" link="namespaces.html"> + <!-- Generate a flat list of fully qualified namespaces --> + <xsl:for-each select="$namespaces"> + <xsl:sort lang="en" case-order="upper-first" select="name"/> + <sub name="{name}" link="{filename}"/> + </xsl:for-each> + </sub> + </xsl:if> + <xsl:if test="tagfile/compound[@kind='class' or @kind='struct' or @kind='union']"> + <sub name="Classes" link="classes.html"> + <!-- Select the top-level C++ compounds --> + <xsl:apply-templates select="tagfile/compound[not(key('nested-scope', name))]" + mode="class-list"> + <xsl:sort lang="en" case-order="upper-first" select="name"/> + </xsl:apply-templates> + </sub> + </xsl:if> + </chapters> + <functions> + <xsl:apply-templates select="tagfile/compound" mode="keyword-list"/> + </functions> + </book> + </xsl:template> + + <xsl:template match="compound" mode="module-list"> + <xsl:variable name="children" select="subgroup"/> + <sub name="{title}" link="{filename}"> + <!-- Select any subgroup compounds by name --> + <xsl:apply-templates select="../compound[@kind='group' and name=$children]" + mode="module-list"> + <xsl:sort lang="en" select="title"/> + </xsl:apply-templates> + </sub> + </xsl:template> + + <xsl:template match="compound[@kind='namespace' or @kind='class' or @kind='struct' or @kind='union']" + mode="class-list"> + <!-- The scope prefix to strip from the name --> + <xsl:param name="scope"/> + <xsl:variable name="fullname" select="name"/> + <xsl:variable name="children" select="namespace|class"/> + <sub name="{substring-after($fullname, $scope)}" link="{filename}"> + <!-- Select any nested C++ compounds by name --> + <xsl:apply-templates select="../compound[name=$children]" mode="class-list"> + <xsl:sort lang="en" case-order="upper-first" select="name"/> + <xsl:with-param name="scope" select="concat($fullname, '::')"/> + </xsl:apply-templates> + </sub> + </xsl:template> + <!-- Ignore any other kind of compound --> + <xsl:template match="*" mode="class-list"/> + + <xsl:template match="compound[@kind='namespace']" mode="keyword-list"> + <!-- Process members, but do not list the namespace itself as a keyword --> + <xsl:apply-templates select="member" mode="keyword-list"/> + </xsl:template> + <xsl:template match="compound[@kind='class' or @kind='struct' or @kind='union']" + mode="keyword-list"> + <!-- List the compound type itself as a keyword and process its members --> + <keyword type="struct" name="{name}" link="{filename}"/> + <xsl:apply-templates select="member" mode="keyword-list"/> + </xsl:template> + <!-- Match leaf compound members --> + <xsl:template match="member[@kind='typedef']" mode="keyword-list"> + <keyword type="typedef" xsl:use-attribute-sets="keyword-member"/> + </xsl:template> + <xsl:template match="member[@kind='function' or @kind='friend']" mode="keyword-list"> + <keyword type="function" xsl:use-attribute-sets="keyword-member"/> + </xsl:template> + <xsl:template match="member[@kind='enumeration']" mode="keyword-list"> + <keyword type="enum" xsl:use-attribute-sets="keyword-member"/> + </xsl:template> + <xsl:template match="member[@kind='enumvalue' or @kind='define']" mode="keyword-list"> + <keyword type="macro" xsl:use-attribute-sets="keyword-member"/> + </xsl:template> + <!-- Ignore unknown keyword types --> + <xsl:template match="*" mode="keyword-list"/> + + <!-- Qualify member name and link anchor --> + <xsl:attribute-set name="keyword-member"> + <xsl:attribute name="name"> + <xsl:value-of select="concat(../name, '::', name)"/> + </xsl:attribute> + <xsl:attribute name="link"> + <xsl:value-of select="concat(anchorfile, '#', anchor)"/> + </xsl:attribute> + </xsl:attribute-set> + +</xsl:stylesheet> diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..ea2c130 --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,73 @@ +## Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> +## +## This file is part of poppler-glibmm. +## +## poppler-glibmm is free software: you can redistribute it and/or modify it +## under the terms of the GNU Lesser General Public License as published +## by the Free Software Foundation, either version 2.1 of the License, +## or (at your option) any later version. +## +## poppler-glibmm is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +## See the GNU Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public License +## along with this program. If not, see <http://www.gnu.org/licenses/>. + +AUTOMAKE_OPTIONS = subdir-objects + +check_PROGRAMS = demo/poppler-glibmm-demo + +local_includes = -I$(top_builddir)/poppler-glib $(if $(srcdir:.=),-I$(top_srcdir)/poppler-glib) +local_libs = $(top_builddir)/poppler-glib/poppler-glibmm/libpoppler-glibmm-$(POPPLER_GLIBMM_API_VERSION).la + +AM_CPPFLAGS = -I$(top_builddir) $(local_includes) $(GTHREAD_CFLAGS) $(POPPLER_GLIBMM_CFLAGS) $(GTKMM_CFLAGS) +AM_CXXFLAGS = $(POPPLER_GLIBMM_WXXFLAGS) + +LDADD = $(POPPLER_GLIBMM_LIBS) $(GTKMM_LIBS) $(local_libs) + +demo_poppler_glibmm_demo_SOURCES = \ + demo/action-view.cc \ + demo/action-view.h \ + demo/annots.cc \ + demo/annots.h \ + demo/attachments.cc \ + demo/attachments.h \ + demo/auth-dialog.cc \ + demo/auth-dialog.h \ + demo/demo-window.cc \ + demo/demo-window.h \ + demo/find.cc \ + demo/find.h \ + demo/fonts.cc \ + demo/fonts.h \ + demo/forms.cc \ + demo/forms.h \ + demo/images.cc \ + demo/images.h \ + demo/info.cc \ + demo/info.h \ + demo/layers.cc \ + demo/layers.h \ + demo/links.cc \ + demo/links.h \ + demo/main.cc \ + demo/outline.cc \ + demo/outline.h \ + demo/page-info.cc \ + demo/page-info.h \ + demo/print.cc \ + demo/print.h \ + demo/property-grid.cc \ + demo/property-grid.h \ + demo/render.cc \ + demo/render.h \ + demo/selections.cc \ + demo/selections.h \ + demo/text.cc \ + demo/text.h \ + demo/transitions.cc \ + demo/transitions.h \ + demo/util.cc \ + demo/util.h diff --git a/examples/demo/action-view.cc b/examples/demo/action-view.cc new file mode 100644 index 0000000..523e7ec --- /dev/null +++ b/examples/demo/action-view.cc @@ -0,0 +1,365 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "action-view.h" + +#include <giomm/file.h> +#include <glibmm/miscutils.h> +#include <glibmm/fileutils.h> +#include <gtkmm/stock.h> +#include <gtkmm/button.h> +#include <gtkmm/textview.h> +#include <gtkmm/scrolledwindow.h> +#include <iomanip> + +namespace PGD +{ + +ActionView::ActionView(const Glib::RefPtr<Poppler::Document>& document) : + m_Document(document), + m_Alignment(0.5, 0.5, 1, 1) +{ + set_shadow_type(Gtk::SHADOW_NONE); + m_Label.set_markup("<b>Action Properties</b>"); + set_label_widget(m_Label); + + m_Alignment.set_padding(5, 5, 12, 5); + add(m_Alignment); +} + +void ActionView::add_destination(PropertyGrid* grid, const Poppler::Dest& dest, bool remote) +{ + grid->add_property("<b>Type:</b>", "Destination"); + + GEnumValue* enum_value = + g_enum_get_value((GEnumClass*)g_type_class_ref(Glib::Value<Poppler::DestType>::value_type()), + dest.get_dest_type()); + grid->add_property("<b>Destination Type:</b>", enum_value->value_name); + + if (dest.get_dest_type() != Poppler::DEST_NAMED) + { + Glib::ustring str; + if (m_Document && !remote) + { + Glib::RefPtr<Poppler::Page> poppler_page = m_Document->get_page(std::max(0, dest.get_page_num() - 1)); + Glib::ustring page_label = poppler_page->get_label(); + if (page_label.size()) str = Glib::ustring::compose("%1 (%2)", dest.get_page_num(), page_label); + } + if (str.empty()) str = Glib::ustring::format(dest.get_page_num()); + grid->add_property("<b>Page:</b>", str); + + grid->add_property("<b>Left:</b>", Glib::ustring::format(std::fixed, std::setprecision(2), dest.get_left())); + grid->add_property("<b>Right:</b>", Glib::ustring::format(std::fixed, std::setprecision(2), dest.get_right())); + grid->add_property("<b>Top:</b>", Glib::ustring::format(std::fixed, std::setprecision(2), dest.get_top())); + grid->add_property("<b>Bottom:</b>", Glib::ustring::format(std::fixed, std::setprecision(2), dest.get_bottom())); + grid->add_property("<b>Zoom:</b>", Glib::ustring::format(std::fixed, std::setprecision(2), dest.get_zoom())); + } + else + { + grid->add_property("<b>Named Dest:</b>", dest.get_named_dest()); + + if (m_Document && !remote) + { + Poppler::Dest new_dest = m_Document->find_dest(dest.get_named_dest()); + if (new_dest) + { + Gtk::Alignment* alignment; + grid->add_row_widget(*Gtk::manage(alignment = new Gtk::Alignment(0.5, 0.5, 1, 1))); + alignment->set_padding(5, 5, 12, 5); + + PropertyGrid* new_grid; + alignment->add(*Gtk::manage(new_grid = new PropertyGrid)); + new_grid->set_column_spacing(6); + new_grid->set_row_spacing(6); + + add_destination(new_grid, new_dest, false); + alignment->show_all(); + } + } + } +} + +static Glib::ustring get_movie_op(Poppler::ActionMovieOperation op) +{ + switch (op) + { + case Poppler::ACTION_MOVIE_PLAY: + return "Play"; + case Poppler::ACTION_MOVIE_PAUSE: + return "Pause"; + case Poppler::ACTION_MOVIE_RESUME: + return "Resume"; + case Poppler::ACTION_MOVIE_STOP: + return "Stop"; + } + return ""; +} + +void ActionView::set_action(const Poppler::Action& action) +{ + PropertyGrid* grid = static_cast<PropertyGrid*>(m_Alignment.get_child()); + if (grid) + { + m_Alignment.remove(); + delete grid; + } + + if (!action) return; + + m_Alignment.add(*Gtk::manage(grid = new PropertyGrid)); + + grid->set_column_spacing(6); + grid->set_row_spacing(6); + + grid->add_property("<b>Title:</b>", action.get_title()); + + switch (action.get_action_type()) + { + case Poppler::ACTION_UNKNOWN: + grid->add_property("<b>Type:</b>", "Unknown"); + break; + case Poppler::ACTION_NONE: + grid->add_property("<b>Type:</b>", "None"); + break; + case Poppler::ACTION_GOTO_DEST: + add_destination(grid, action.get_goto_dest_dest(), false); + break; + case Poppler::ACTION_GOTO_REMOTE: + grid->add_property("<b>Type:</b>", "Remote Destination"); + grid->add_property("<b>Filename:</b>", action.get_goto_remote_file_name()); + add_destination(grid, action.get_goto_remote_dest(), true); + break; + case Poppler::ACTION_LAUNCH: + grid->add_property("<b>Type:</b>", "Launch"); + grid->add_property("<b>Filename:</b>", action.get_launch_file_name()); + grid->add_property("<b>Params:</b>", action.get_launch_params()); + break; + case Poppler::ACTION_URI: + grid->add_property("<b>Type:</b>", "External URI"); + grid->add_property("<b>URI</b>", action.get_uri()); + break; + case Poppler::ACTION_NAMED: + grid->add_property("<b>Type:</b>", "Named Action"); + grid->add_property("<b>Name:</b>", action.get_named_dest()); + break; + case Poppler::ACTION_MOVIE: + grid->add_property("<b>Type:</b>", "Movie"); + grid->add_property("<b>Operation:</b>", get_movie_op(action.get_movie_operation())); + grid->add_property_with_custom_widget("<b>Movie:</b>", + *Gtk::manage(new MovieView(action.get_movie_movie()))); + break; + case Poppler::ACTION_RENDITION: + grid->add_property("<b>Type:</b>", "Rendition"); + grid->add_property("<b>Operation:</b>", Glib::ustring::format(action.get_rendition_op())); + + if (action.get_rendition_media()) + { + bool embedded = action.get_rendition_media()->is_embedded(); + grid->add_property("<b>Embedded:</b>", embedded ? "Yes": "No"); + + if (embedded) + grid->add_property("<b>Mime type:</b>", action.get_rendition_media()->get_mime_type()); + else + grid->add_property("<b>Filename:</b>", action.get_rendition_media()->get_filename()); + + Gtk::Button* button; + grid->add_property_with_custom_widget("", + *Gtk::manage(button = new Gtk::Button(Gtk::Stock::MEDIA_PLAY))); + button->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &ActionView::play_rendition), + action.get_rendition_media())); + } + break; + case Poppler::ACTION_OCG_STATE: + { + grid->add_property("<b>Type:</b>", "OCGState"); + + std::vector<Poppler::ActionLayer> action_layer_list = action.get_ocg_state_list(); + for (std::vector<Poppler::ActionLayer>::iterator action_layer = action_layer_list.begin(); + action_layer != action_layer_list.begin(); ++action_layer) + { + Glib::ustring text; + int n_layers = action_layer->get_layers().size(); + + switch (action_layer->get_action()) + { + case Poppler::ACTION_LAYER_ON: + text = Glib::ustring::format(n_layers, " layers On"); + break; + case Poppler::ACTION_LAYER_OFF: + text = Glib::ustring::format(n_layers, " layers Off"); + break; + case Poppler::ACTION_LAYER_TOGGLE: + text = Glib::ustring::format(n_layers, " layers Toggle"); + break; + } + grid->add_property("<b>Action:</b>", text); + } + Gtk::Button* button; + grid->add_property_with_custom_widget("", + *Gtk::manage(button = new Gtk::Button("Do action"))); + button->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &ActionView::do_action_layer), + action_layer_list)); + } + break; + case Poppler::ACTION_JAVASCRIPT: + { + grid->add_property("<b>Type:</b>", "JavaScript"); + + Glib::RefPtr<Gtk::TextBuffer> buffer = Gtk::TextBuffer::create(); + buffer->set_text(action.get_javascript()); + + Gtk::ScrolledWindow* swindow; + grid->add_property_with_custom_widget("", *Gtk::manage(swindow = new Gtk::ScrolledWindow)); + swindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + swindow->set_hexpand(); + + Gtk::TextView* textview; + swindow->add(*Gtk::manage(textview = new Gtk::TextView(buffer))); + textview->set_editable(false); + } + break; + } + + grid->show_all(); +} + +static bool save_helper(const gchar *buf, gsize count, const Glib::RefPtr<Gio::FileOutputStream>& stream) +{ + return stream->write(buf, count) == (unsigned int)count; +} + +void ActionView::play_rendition(const Glib::RefPtr<const Poppler::Media>& media) +{ + Glib::RefPtr<Gio::File> file; + + if (media->is_embedded()) + { + file = Gio::File::create_for_path(tmpnam(NULL)); + + Glib::RefPtr<Gio::FileOutputStream> stream; + if(file->query_exists()) stream = file->replace(); + else stream = file->create_file(); + + if (!stream || !media->save(sigc::bind(&save_helper, stream))) + file.reset(); + } + else + { + std::string filename = media->get_filename(); + if (Glib::path_is_absolute(filename)) + file = Gio::File::create_for_path(filename); + else if (filename.find("://") != std::string::npos) + file = Gio::File::create_for_uri(filename); + else + // FIXME: Make path relative to the document uri, not the cwd + file = Gio::File::create_for_path(Glib::build_filename(Glib::get_current_dir(), filename)); + } + + if (file) + { + try + { + Gio::AppInfo::launch_default_for_uri(file->get_uri()); + } + catch (const Glib::Error& ex) + { + } + } +} + +void ActionView::do_action_layer(const std::vector<Poppler::ActionLayer>& state_list) +{ + + for (std::vector<Poppler::ActionLayer>::const_iterator action_layer = state_list.begin(); + action_layer != state_list.begin(); ++action_layer) + { + std::vector< Glib::RefPtr<Poppler::Layer> > layers = action_layer->get_layers(); + for (std::vector< Glib::RefPtr<Poppler::Layer> >::iterator layer = layers.begin(); + layer != layers.end(); ++layer) + { + switch (action_layer->get_action()) + { + case Poppler::ACTION_LAYER_ON: + (*layer)->show(); + break; + case Poppler::ACTION_LAYER_OFF: + (*layer)->hide(); + break; + case Poppler::ACTION_LAYER_TOGGLE: + if ((*layer)->is_visible()) (*layer)->hide(); + else (*layer)->show(); + break; + } + } + } +} + +MovieView::MovieView(const Glib::RefPtr<const Poppler::Movie>& movie) : + m_Movie(movie), + m_Alignment(0.5, 0.5, 1, 1) +{ + set_shadow_type(Gtk::SHADOW_NONE); + m_Label.set_markup("<b>Movie Properties</b>"); + set_label_widget(m_Label); + + m_Alignment.set_padding(5, 5, 12, 5); + add(m_Alignment); + + m_Alignment.add(m_Grid); + + m_Grid.set_column_spacing(6); + m_Grid.set_row_spacing(6); + + if (movie) + { + m_Grid.add_property("<b>Filename:</b>", movie->get_filename()); + m_Grid.add_property("<b>Need Poster:</b>", movie->need_poster() ? "Yes" : "No"); + m_Grid.add_property("<b>Show Controls:</b>", movie->show_controls() ? "Yes" : "No"); + + Gtk::Button* button; + m_Grid.add_property_with_custom_widget("", *Gtk::manage(button = new Gtk::Button(Gtk::Stock::MEDIA_PLAY))); + button->signal_clicked().connect(sigc::mem_fun(*this, &MovieView::play_movie)); + } + + show_all(); +} + +void MovieView::play_movie() +{ + Glib::RefPtr<Gio::File> file; + + std::string filename = m_Movie->get_filename(); + + if (Glib::path_is_absolute(filename)) + file = Gio::File::create_for_path(filename); + else if (filename.find("://") != std::string::npos) + file = Gio::File::create_for_uri(filename); + else + // FIXME: Make path relative to the document uri, not the cwd + file = Gio::File::create_for_path(Glib::build_filename(Glib::get_current_dir(), filename)); + + try + { + Gio::AppInfo::launch_default_for_uri(file->get_uri()); + } + catch (const Glib::Error& ex) + { + } +} + +} diff --git a/examples/demo/action-view.h b/examples/demo/action-view.h new file mode 100644 index 0000000..efe5360 --- /dev/null +++ b/examples/demo/action-view.h @@ -0,0 +1,66 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _ACTION_VIEW_H_ +#define _ACTION_VIEW_H_ + +#include "property-grid.h" + +#include <poppler-glibmm/document.h> +#include <gtkmm/frame.h> +#include <gtkmm/label.h> +#include <gtkmm/alignment.h> + +namespace PGD +{ + +class ActionView : public Gtk::Frame +{ + public: + ActionView(const Glib::RefPtr<Poppler::Document>& document); + + void set_action(const Poppler::Action& action); + + private: + void add_destination(PropertyGrid* grid, const Poppler::Dest& dest, bool remote); + void play_rendition(const Glib::RefPtr<const Poppler::Media>& media); + void do_action_layer(const std::vector<Poppler::ActionLayer>& state_list); + + const Glib::RefPtr<Poppler::Document> m_Document; + + Gtk::Label m_Label; + Gtk::Alignment m_Alignment; +}; + +class MovieView : public Gtk::Frame +{ + public: + MovieView(const Glib::RefPtr<const Poppler::Movie>& movie); + void play_movie(); + + private: + const Glib::RefPtr<const Poppler::Movie> m_Movie; + + Gtk::Label m_Label; + Gtk::Alignment m_Alignment; + PropertyGrid m_Grid; +}; + +} + +#endif // _ACTION_VIEW_H_ diff --git a/examples/demo/annots.cc b/examples/demo/annots.cc new file mode 100644 index 0000000..951b04d --- /dev/null +++ b/examples/demo/annots.cc @@ -0,0 +1,529 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "annots.h" +#include "property-grid.h" +#include "action-view.h" +#include "util.h" + +#include <gtkmm/textview.h> +#include <gtkmm/filechooserdialog.h> +#include <gtkmm/comboboxtext.h> +#include <gtkmm/stock.h> +#include <glibmm/timer.h> +#include <poppler-glibmm/utility.h> +#include <iomanip> + +namespace PGD +{ + +AnnotView::AnnotView(const Glib::RefPtr<Poppler::Document>& document) : + m_Document(document), + m_Alignment(0.5, 0.5, 1, 1) +{ + set_shadow_type(Gtk::SHADOW_NONE); + m_Label.set_markup("<b>Annot Properties</b>"); + set_label_widget(m_Label); + + m_Alignment.set_padding(5, 5, 12, 5); + add(m_Alignment); +} + +static Glib::ustring get_markup_date(const Glib::RefPtr<Poppler::AnnotMarkup>& poppler_annot) +{ + Glib::Date date = poppler_annot->get_date(); + if (date.valid()) return date.format_string("%c"); + else return ""; +} + +static Glib::ustring get_markup_reply_to(const Glib::RefPtr<Poppler::AnnotMarkup>& poppler_annot) +{ + switch (poppler_annot->get_reply_to()) + { + case Poppler::ANNOT_MARKUP_REPLY_TYPE_R: + return "Type R"; + case Poppler::ANNOT_MARKUP_REPLY_TYPE_GROUP: + return "Type Group"; + default: + break; + } + return "Unknown"; +} + +static Glib::ustring get_markup_external_data(const Glib::RefPtr<Poppler::AnnotMarkup>& poppler_annot) +{ + switch (poppler_annot->get_external_data()) + { + case Poppler::ANNOT_EXTERNAL_DATA_MARKUP_3D: + return "Markup 3D"; + default: + break; + } + return "Unknown"; +} + +static Glib::ustring get_text_state(const Poppler::AnnotTextState state) +{ + switch (state) + { + case Poppler::ANNOT_TEXT_STATE_MARKED: + return "Marked"; + case Poppler::ANNOT_TEXT_STATE_UNMARKED: + return "Unmarked"; + case Poppler::ANNOT_TEXT_STATE_ACCEPTED: + return "Accepted"; + case Poppler::ANNOT_TEXT_STATE_REJECTED: + return "Rejected"; + case Poppler::ANNOT_TEXT_STATE_CANCELLED: + return "Cancelled"; + case Poppler::ANNOT_TEXT_STATE_COMPLETED: + return "Completed"; + case Poppler::ANNOT_TEXT_STATE_NONE: + return "None"; + case Poppler::ANNOT_TEXT_STATE_UNKNOWN: + return "Unknown"; + default: + break; + } + return "Unknown"; +} + +static Glib::ustring get_free_text_quadding(const Poppler::AnnotFreeTextQuadding quadding) +{ + switch (quadding) + { + case Poppler::ANNOT_FREE_TEXT_QUADDING_LEFT_JUSTIFIED: + return "Left Justified"; + case Poppler::ANNOT_FREE_TEXT_QUADDING_CENTERED: + return "Centered"; + case Poppler::ANNOT_FREE_TEXT_QUADDING_RIGHT_JUSTIFIED: + return "Right Justified"; + default: + break; + } + return "Unknown"; +} + +static Glib::ustring get_free_text_callout_line(const Poppler::AnnotCalloutLine& callout) +{ + if (callout) + { + Glib::ustring text = Glib::ustring::format(std::fixed, callout.get_x1(), ",", callout.get_y1(), ",") + + Glib::ustring::format(std::fixed, callout.get_x2(), ",", callout.get_y2()); + if (callout.get_multiline()) + text += Glib::ustring::format(std::fixed, ",", callout.get_x3(), ",", callout.get_y3()); + return text; + } + return ""; +} + +void AnnotView::save_file_attachment() +{ + Glib::RefPtr<Poppler::Attachment> attachment = + Glib::RefPtr<Poppler::AnnotFileAttachment>::cast_static(m_Annot)->get_attachment(); + if (!attachment) return; + + Gtk::FileChooserDialog file_chooser("Save attachment", Gtk::FILE_CHOOSER_ACTION_SAVE); + file_chooser.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + file_chooser.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT); + file_chooser.set_current_name(attachment->get_name()); + + if (file_chooser.run() == Gtk::RESPONSE_ACCEPT) + { + std::string filename = file_chooser.get_filename(); + try + { + attachment->save(filename); + } + catch (Glib::Error exception) + { + } + } +} + +void AnnotView::set_annot(const Glib::RefPtr<Poppler::Annot>& annot) +{ + PropertyGrid* grid = static_cast<PropertyGrid*>(m_Alignment.get_child()); + if (grid) + { + m_Alignment.remove(); + delete grid; + } + + m_Annot = annot; + if (!annot) return; + + m_Alignment.add(*Gtk::manage(grid = new PropertyGrid)); + + grid->set_column_spacing(6); + grid->set_row_spacing(6); + + grid->add_property("<b>Contents:</b>", annot->get_contents()); + grid->add_property("<b>Name:</b>", annot->get_name()); + + time_t timet; + if (Poppler::date_parse(annot->get_modified(), &timet)) + grid->add_property("<b>Modified:</b>", format_date(timet)); + else + grid->add_property("<b>Modified:</b>", annot->get_modified()); + + grid->add_property("<b>Flags:</b>", Glib::ustring::format(annot->get_flags())); + grid->add_property("<b>Page:</b>", Glib::ustring::format(annot->get_page_index())); + + const Glib::RefPtr<Poppler::AnnotMarkup>& annot_markup = Glib::RefPtr<Poppler::AnnotMarkup>::cast_dynamic(annot); + if (annot_markup) + { + grid->add_property("<b>Label:</b>", annot_markup->get_label()); + + if (annot_markup->has_popup()) + { + grid->add_property("<b>Popup is open:</b>", annot_markup->get_popup_is_open() ? "Yes" : "No"); + + Poppler::Rectangle rect; + annot_markup->get_popup_rectangle(rect); + grid->add_property("<b>Popup Rectangle:</b>", + Glib::ustring::format(std::fixed, std::setprecision(2), + "X1: ", rect.get_x1(), ", Y1: ", rect.get_y1()) + + Glib::ustring::format(std::fixed, std::setprecision(2), + ", X2: ", rect.get_x2(), ", Y2: ", rect.get_y2())); + } + + grid->add_property("<b>Opacity:</b>", Glib::ustring::format(std::fixed, annot_markup->get_opacity())); + grid->add_property("<b>Date:</b>", get_markup_date(annot_markup)); + grid->add_property("<b>Subject:</b>", annot_markup->get_subject()); + grid->add_property("<b>Reply To:</b>", get_markup_reply_to(annot_markup)); + grid->add_property("<b>External Data:</b>", get_markup_external_data(annot_markup)); + } + + switch (annot->get_annot_type()) + { + case Poppler::ANNOT_TEXT: + { + const Glib::RefPtr<Poppler::AnnotText>& annot_text = Glib::RefPtr<Poppler::AnnotText>::cast_static(annot); + grid->add_property("<b>Is open:</b>", annot_text->get_is_open() ? "Yes" : "No"); + grid->add_property("<b>Icon:</b>", annot_text->get_icon()); + grid->add_property("<b>State:</b>", get_text_state(annot_text->get_state())); + } + break; + case Poppler::ANNOT_FREE_TEXT: + { + const Glib::RefPtr<Poppler::AnnotFreeText>& annot_free_text = + Glib::RefPtr<Poppler::AnnotFreeText>::cast_static(annot); + grid->add_property("<b>Quadding:</b>", get_free_text_quadding(annot_free_text->get_quadding())); + grid->add_property("<b>Callout:</b>", get_free_text_callout_line(annot_free_text->get_callout_line())); + } + break; + case Poppler::ANNOT_FILE_ATTACHMENT: + { + const Glib::RefPtr<Poppler::AnnotFileAttachment>& annot_file_attachment = + Glib::RefPtr<Poppler::AnnotFileAttachment>::cast_static(annot); + + grid->add_property("<b>Attachment Name:</b>", annot_file_attachment->get_name()); + + Gtk::Button* button; + grid->add_property_with_custom_widget("<b>File Attachment:</b>", + *Gtk::manage(button = new Gtk::Button("Save Attachment"))); + button->signal_clicked().connect(sigc::mem_fun(*this, &AnnotView::save_file_attachment)); + } + break; + case Poppler::ANNOT_MOVIE: + { + const Glib::RefPtr<Poppler::AnnotMovie>& annot_movie = + Glib::RefPtr<Poppler::AnnotMovie>::cast_static(annot); + + grid->add_property("<b>Movie Title:</b>", annot_movie->get_title()); + MovieView* movie_view; + grid->add_property_with_custom_widget("<b>Movie:</b>", + *Gtk::manage(movie_view = new MovieView(annot_movie->get_movie()))); + } + break; + case Poppler::ANNOT_SCREEN: + { + const Glib::RefPtr<Poppler::AnnotScreen>& annot_screen = + Glib::RefPtr<Poppler::AnnotScreen>::cast_static(annot); + + ActionView* action_view; + grid->add_property_with_custom_widget("<b>Action:</b>", + *Gtk::manage(action_view = new ActionView(m_Document))); + action_view->set_action(annot_screen->get_action()); + } + break; + default: + break; + } + grid->show_all(); +} + +Annots::Annots(const Glib::RefPtr<Poppler::Document>& document) : + Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12), + m_Document(document), + m_Page(0), + m_HBoxTop(Gtk::ORIENTATION_HORIZONTAL, 6), + m_PageLabel("Page:"), + m_AddButton("Add Annot"), + m_GetButton("Get Annots"), + m_HPaned(Gtk::ORIENTATION_HORIZONTAL), + m_AnnotView(document) +{ + int n_pages = m_Document->get_n_pages(); + m_PageSelector.set_range(1, n_pages); + m_PageSelector.set_increments(1, 10); + m_PageSelector.set_numeric(); + m_PageSelector.signal_value_changed().connect(sigc::mem_fun(*this, &Annots::page_selector_changed)); + m_PageNumLabel.set_text(Glib::ustring::compose("of %1", n_pages)); + + m_AddButton.signal_clicked().connect(sigc::mem_fun(*this, &Annots::add_annot)); + m_GetButton.signal_clicked().connect(sigc::mem_fun(*this, &Annots::get_annots)); + + m_HBoxTop.pack_start(m_PageLabel, false, true); + m_HBoxTop.pack_start(m_PageSelector, false, true); + m_HBoxTop.pack_start(m_PageNumLabel, false, true); + m_HBoxTop.pack_end(m_GetButton, false, false); + m_HBoxTop.pack_end(m_AddButton, false, false); + + m_TimerLabel.set_markup("<i>No annots found</i>"); + m_TimerLabel.set_alignment(1.0, 0.5); + + m_ScrolledWin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + + m_AnnotStore = Gtk::ListStore::create(m_StoreColumns); + m_TreeView.set_model(m_AnnotStore); + + m_TreeView.append_column_numeric("X1", m_StoreColumns.m_X1, "%.2f"); + m_TreeView.append_column_numeric("Y1", m_StoreColumns.m_Y1, "%.2f"); + m_TreeView.append_column_numeric("X2", m_StoreColumns.m_X2, "%.2f"); + m_TreeView.append_column_numeric("Y2", m_StoreColumns.m_Y2, "%.2f"); + m_TreeView.append_column("Type", m_StoreColumns.m_AnnotType); + m_TreeView.append_column("Color", m_StoreColumns.m_Color); + m_TreeView.append_column("Invisible", m_StoreColumns.m_FlagInvisible); + m_TreeView.append_column("Hidden", m_StoreColumns.m_FlagHidden); + m_TreeView.append_column("Print", m_StoreColumns.m_FlagPrint); + + m_TreeView.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &Annots::selection_changed)); + + m_ScrolledWin.add(m_TreeView); + + m_HPaned.add1(m_ScrolledWin); + m_HPaned.add2(m_AnnotView); + m_HPaned.set_position(300); + + pack_start(m_HBoxTop, false, true); + pack_start(m_TimerLabel, false, true); + pack_start(m_HPaned, true, true); + + show_all(); +} + +void Annots::page_selector_changed() +{ + m_Page = m_PageSelector.get_value() - 1; +} + +void Annots::add_annot() +{ + Glib::RefPtr<Poppler::Page> page = m_Document->get_page(m_Page); + if (!page) return; + + double width, height; + page->get_size(width, height); + + Gtk::Dialog dialog("Add new annotation", true); + dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + dialog.add_button("Add annotation", Gtk::RESPONSE_ACCEPT); + + Gtk::Box* vbox = dialog.get_content_area(); + + Gtk::ComboBoxText type_selector; + type_selector.append("POPPLER_ANNOT_UNKNOWN"); + type_selector.append("POPPLER_ANNOT_TEXT"); + type_selector.set_active(1); + vbox->pack_start(type_selector, true, true); + + Gtk::Box hbox(Gtk::ORIENTATION_HORIZONTAL, 6); + + Gtk::Label x1_label("x1:"); + Gtk::SpinButton rect_x1; + rect_x1.set_range(0, width); + rect_x1.set_increments(1, 10); + rect_x1.set_numeric(); + + Gtk::Box x1_hbox(Gtk::ORIENTATION_HORIZONTAL, 6); + x1_hbox.pack_start(x1_label, true, true); + x1_hbox.pack_start(rect_x1, true, true); + hbox.pack_start(x1_hbox, false, true); + + Gtk::Label x2_label("x2:"); + Gtk::SpinButton rect_x2; + rect_x2.set_range(0, width); + rect_x2.set_increments(1, 10); + rect_x2.set_numeric(); + + Gtk::Box x2_hbox(Gtk::ORIENTATION_HORIZONTAL, 6); + x2_hbox.pack_start(x2_label, true, true); + x2_hbox.pack_start(rect_x2, true, true); + hbox.pack_start(x2_hbox, false, true); + + Gtk::Label y1_label("y1:"); + Gtk::SpinButton rect_y1; + rect_y1.set_range(0, height); + rect_y1.set_increments(1, 10); + rect_y1.set_numeric(); + + Gtk::Box y1_hbox(Gtk::ORIENTATION_HORIZONTAL, 6); + y1_hbox.pack_start(y1_label, true, true); + y1_hbox.pack_start(rect_y1, true, true); + hbox.pack_start(y1_hbox, false, true); + + Gtk::Label y2_label("y2:"); + Gtk::SpinButton rect_y2; + rect_y2.set_range(0, height); + rect_y2.set_increments(1, 10); + rect_y2.set_numeric(); + + Gtk::Box y2_hbox(Gtk::ORIENTATION_HORIZONTAL, 6); + y2_hbox.pack_start(y2_label, true, true); + y2_hbox.pack_start(rect_y2, true, true); + hbox.pack_start(y2_hbox, false, true); + + vbox->pack_start(hbox, true, true); + + dialog.show_all(); + + if (dialog.run() != Gtk::RESPONSE_ACCEPT) return; + + Poppler::Rectangle rect(rect_x1.get_value(), height - rect_y1.get_value(), + rect_x2.get_value(), height - rect_y2.get_value()); + + Glib::RefPtr<Poppler::AnnotText> annot = Poppler::AnnotText::create(m_Document, rect); + page->add_annot(annot); +} + +static Glib::ustring get_annot_type_string(Poppler::AnnotType type) +{ + switch (type) + { + case Poppler::ANNOT_TEXT: + return "Text"; + case Poppler::ANNOT_LINK: + return "Link"; + case Poppler::ANNOT_FREE_TEXT: + return "Free Text"; + case Poppler::ANNOT_LINE: + return "Line"; + case Poppler::ANNOT_SQUARE: + return "Square"; + case Poppler::ANNOT_CIRCLE: + return "Circle"; + case Poppler::ANNOT_POLYGON: + return "Polygon"; + case Poppler::ANNOT_POLY_LINE: + return "Poly Line"; + case Poppler::ANNOT_HIGHLIGHT: + return "Highlight"; + case Poppler::ANNOT_UNDERLINE: + return "Underline"; + case Poppler::ANNOT_SQUIGGLY: + return "Squiggly"; + case Poppler::ANNOT_STRIKE_OUT: + return "Strike Out"; + case Poppler::ANNOT_STAMP: + return "Stamp"; + case Poppler::ANNOT_CARET: + return "Caret"; + case Poppler::ANNOT_INK: + return "Ink"; + case Poppler::ANNOT_POPUP: + return "Popup"; + case Poppler::ANNOT_FILE_ATTACHMENT: + return "File Attachment"; + case Poppler::ANNOT_SOUND: + return "Sound"; + case Poppler::ANNOT_MOVIE: + return "Movie"; + case Poppler::ANNOT_WIDGET: + return "Widget"; + case Poppler::ANNOT_SCREEN: + return "Screen"; + case Poppler::ANNOT_PRINTER_MARK: + return "Printer Mark"; + case Poppler::ANNOT_TRAP_NET: + return "Trap Net"; + case Poppler::ANNOT_WATERMARK: + return "Watermark"; + case Poppler::ANNOT_3D: + return "3D"; + default: + break; + } + return "Unknown"; +} + + +void Annots::get_annots() +{ + m_AnnotStore->clear(); + + m_AnnotView.set_annot(Glib::RefPtr<Poppler::Annot>()); + + Glib::RefPtr<Poppler::Page> page = m_Document->get_page(m_Page); + if (!page) return; + + Glib::Timer timer; + std::vector<Poppler::AnnotMapping> mapping = page->get_annot_mapping(); + timer.stop(); + + int n_annots = mapping.size(); + + if (n_annots > 0) + m_TimerLabel.set_markup(Glib::ustring::format("<i>", n_annots, " annots found in ", + std::fixed, std::setprecision(4), timer.elapsed(), " seconds</i>")); + else + m_TimerLabel.set_markup("<i>No annots found</i>"); + + for (std::vector<Poppler::AnnotMapping>::iterator amapping = mapping.begin(); + amapping != mapping.end(); ++amapping) + { + Gtk::TreeRow tree_row = *(m_AnnotStore->append()); + + Poppler::Rectangle area = amapping->get_area(); + tree_row[m_StoreColumns.m_X1] = area.get_x1(); + tree_row[m_StoreColumns.m_Y1] = area.get_y1(); + tree_row[m_StoreColumns.m_X2] = area.get_x2(); + tree_row[m_StoreColumns.m_Y2] = area.get_y2(); + + Glib::RefPtr<Poppler::Annot> annot = amapping->get_annot(); + tree_row[m_StoreColumns.m_AnnotType] = get_annot_type_string(annot->get_annot_type()); + tree_row[m_StoreColumns.m_Color] = pixbuf_new_for_color(annot->get_color()); + + Poppler::AnnotFlag flags = annot->get_flags(); + tree_row[m_StoreColumns.m_FlagInvisible] = flags & Poppler::ANNOT_FLAG_INVISIBLE; + tree_row[m_StoreColumns.m_FlagHidden] = flags & Poppler::ANNOT_FLAG_HIDDEN; + tree_row[m_StoreColumns.m_FlagPrint] = flags & Poppler::ANNOT_FLAG_PRINT; + + tree_row[m_StoreColumns.m_Annot] = annot; + } +} + +void Annots::selection_changed() +{ + Gtk::TreeIter iter = m_TreeView.get_selection()->get_selected(); + if (iter) m_AnnotView.set_annot((*iter)[m_StoreColumns.m_Annot]); + else m_AnnotView.set_annot(Glib::RefPtr<Poppler::Annot>()); +} + +} diff --git a/examples/demo/annots.h b/examples/demo/annots.h new file mode 100644 index 0000000..2fc8b8f --- /dev/null +++ b/examples/demo/annots.h @@ -0,0 +1,100 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _ANNOTS_H_ +#define _ANNOTS_H_ + +#include <poppler-glibmm/document.h> +#include <gtkmm/box.h> +#include <gtkmm/label.h> +#include <gtkmm/button.h> +#include <gtkmm/spinbutton.h> +#include <gtkmm/scrolledwindow.h> +#include <gtkmm/paned.h> +#include <gtkmm/frame.h> +#include <gtkmm/liststore.h> +#include <gtkmm/treeview.h> +#include <gtkmm/alignment.h> + +namespace PGD +{ + +class AnnotView : public Gtk::Frame +{ + public: + AnnotView(const Glib::RefPtr<Poppler::Document>& document); + void set_annot(const Glib::RefPtr<Poppler::Annot>& annot); + void save_file_attachment(); + + private: + const Glib::RefPtr<Poppler::Document> m_Document; + Glib::RefPtr<Poppler::Annot> m_Annot; + + Gtk::Label m_Label; + Gtk::Alignment m_Alignment; +}; + +class Annots : public Gtk::Box +{ + public: + Annots(const Glib::RefPtr<Poppler::Document>& document); + + private: + void page_selector_changed(); + void add_annot(); + void get_annots(); + void selection_changed(); + + const Glib::RefPtr<Poppler::Document> m_Document; + int m_Page; + + class ModelColumns : public Gtk::TreeModel::ColumnRecord + { + public: + ModelColumns() { add(m_X1); add(m_Y1); add(m_X2); add(m_Y2); add(m_AnnotType); + add(m_Color); add(m_FlagInvisible); add(m_FlagHidden); add(m_FlagPrint); add(m_Annot); } + + Gtk::TreeModelColumn<double> m_X1; + Gtk::TreeModelColumn<double> m_Y1; + Gtk::TreeModelColumn<double> m_X2; + Gtk::TreeModelColumn<double> m_Y2; + Gtk::TreeModelColumn<Glib::ustring> m_AnnotType; + Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > m_Color; + Gtk::TreeModelColumn<bool> m_FlagInvisible; + Gtk::TreeModelColumn<bool> m_FlagHidden; + Gtk::TreeModelColumn<bool> m_FlagPrint; + Gtk::TreeModelColumn< Glib::RefPtr<Poppler::Annot> > m_Annot; + }; + + Gtk::Box m_HBoxTop; + Gtk::Label m_PageLabel, m_PageNumLabel, m_TimerLabel; + Gtk::SpinButton m_PageSelector; + Gtk::Button m_AddButton; + Gtk::Button m_GetButton; + Gtk::ScrolledWindow m_ScrolledWin; + Gtk::Paned m_HPaned; + AnnotView m_AnnotView; + + ModelColumns m_StoreColumns; + Gtk::TreeView m_TreeView; + Glib::RefPtr<Gtk::ListStore> m_AnnotStore; +}; + +} + +#endif // _ANNOTS_H_ diff --git a/examples/demo/attachments.cc b/examples/demo/attachments.cc new file mode 100644 index 0000000..344d3db --- /dev/null +++ b/examples/demo/attachments.cc @@ -0,0 +1,187 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "attachments.h" +#include "util.h" + +#include <gtkmm/main.h> +#include <gtkmm/stock.h> +#include <gtkmm/messagedialog.h> +#include <gtkmm/filechooserdialog.h> +#include <glibmm/main.h> +#include <glibmm/markup.h> + +namespace PGD +{ + +Attachments::Attachments(const Glib::RefPtr<Poppler::Document>& document) : + Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12), + m_Document(document), + m_ButtonBox(Gtk::ORIENTATION_HORIZONTAL), + m_SaveButton("Save"), m_ValidateButton("Validate"), + m_DescriptionCell(), m_NameCell(), + m_DescriptionColumn("Description", m_DescriptionCell), m_NameColumn("Name", m_NameCell) +{ + m_ScrolledWin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + + bool has_attachments = document->has_attachments(); + + m_AttachmentsStore = Gtk::ListStore::create(m_StoreColumns); + + m_TreeView.set_model(m_AttachmentsStore); + m_TreeView.append_column(m_NameColumn); + + if (has_attachments) + { + fill_model(); + + m_TreeView.set_headers_visible(); + m_TreeView.set_rules_hint(); + + m_NameColumn.add_attribute(m_NameCell.property_text(), m_StoreColumns.m_Name); + + m_DescriptionCell.property_ellipsize() = Pango::ELLIPSIZE_END; + m_DescriptionColumn.add_attribute(m_DescriptionCell.property_text(), m_StoreColumns.m_Description); + m_DescriptionColumn.set_expand(); + m_TreeView.append_column(m_DescriptionColumn); + + m_TreeView.append_column_numeric("Size", m_StoreColumns.m_Size, "%" G_GSIZE_FORMAT); + m_TreeView.append_column("Creation Date", m_StoreColumns.m_CTime); + m_TreeView.append_column("Modification Date", m_StoreColumns.m_MTime); + } + else + { + m_NameColumn.add_attribute(m_NameCell.property_markup(), m_StoreColumns.m_Name); + Gtk::TreeRow tree_row = *(m_AttachmentsStore->append()); + tree_row[m_StoreColumns.m_Name] = + "<span size=\"larger\" style=\"italic\">Document does not contain attachments</span>"; + } + + m_ScrolledWin.add(m_TreeView); + + pack_start(m_ScrolledWin, true, true); + + if (!has_attachments) return; + + m_ButtonBox.set_layout(Gtk::BUTTONBOX_SPREAD); + m_ButtonBox.pack_start(m_SaveButton, false, false); + m_ButtonBox.pack_start(m_ValidateButton, false, false); + + pack_start(m_ButtonBox, false, true, 6); + + m_SaveButton.signal_clicked().connect(sigc::mem_fun(*this, &Attachments::save_button_clicked)); + m_ValidateButton.signal_clicked().connect(sigc::mem_fun(*this, &Attachments::validate_button_clicked)); + + show_all(); +} + +void Attachments::fill_model() +{ + std::vector< Glib::RefPtr<Poppler::Attachment> > attachments = m_Document->get_attachments(); + for (std::vector< Glib::RefPtr<Poppler::Attachment> >::iterator attachment = attachments.begin(); + attachment != attachments.end(); ++attachment) + { + Gtk::TreeRow tree_row = *(m_AttachmentsStore->append()); + + Glib::ustring name = (*attachment)->get_name(); + tree_row[m_StoreColumns.m_Name] = name.empty() ? "Unknown" : name; + + Glib::ustring description = (*attachment)->get_description(); + tree_row[m_StoreColumns.m_Description] = description.empty() ? "Unknown" : description; + + tree_row[m_StoreColumns.m_Size] = (*attachment)->get_size(); + + Glib::ustring ctime = format_date((*attachment)->get_ctime()); + tree_row[m_StoreColumns.m_CTime] = ctime.empty() ? "Unknown" : ctime; + + Glib::ustring mtime = format_date((*attachment)->get_mtime()); + tree_row[m_StoreColumns.m_MTime] = mtime.empty() ? "Unknown" : mtime; + + tree_row[m_StoreColumns.m_Attachment] = *attachment; + } +} + +void Attachments::save_button_clicked() +{ + Gtk::TreeIter iter = m_TreeView.get_selection()->get_selected(); + if (!iter) return; + + Glib::RefPtr<Poppler::Attachment> attachment = (*iter)[m_StoreColumns.m_Attachment]; + if (!attachment) return; + + Gtk::FileChooserDialog file_chooser("Save attachment", Gtk::FILE_CHOOSER_ACTION_SAVE); + file_chooser.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + file_chooser.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT); + file_chooser.set_current_name(attachment->get_name()); + + if (file_chooser.run() == Gtk::RESPONSE_ACCEPT) + { + std::string filename = file_chooser.get_filename(); + try + { + attachment->save(filename); + } + catch (Glib::Error exception) + { + } + } +} + +static void message_dialog_run(const Glib::ustring& message) +{ + Gtk::MessageDialog dialog(message, false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_CLOSE); + dialog.run(); +} + +bool Attachments::save_slot(const gchar* buf, gsize count, Glib::Checksum& cs) +{ + cs.update((const guchar*)buf, count); + return true; +} + +void Attachments::validate_button_clicked() +{ + Gtk::TreeIter iter = m_TreeView.get_selection()->get_selected(); + if (!iter) return; + + Glib::RefPtr<Poppler::Attachment> attachment = (*iter)[m_StoreColumns.m_Attachment]; + if (!attachment) return; + + std::string checksum = attachment->get_checksum(); + if (checksum.empty()) message_dialog_run("Impossible to validate attachment: checksum is not available"); + + Glib::Checksum cs(Glib::Checksum::CHECKSUM_MD5); + attachment->save(sigc::bind(sigc::mem_fun(*this, &Attachments::save_slot), cs)); + + gsize digest_len = Glib::Checksum::get_length(Glib::Checksum::CHECKSUM_MD5); + std::string digest(digest_len, 0); + cs.get_digest((guint8*)&digest[0], &digest_len); + + if (checksum.size() == digest_len) + { + for (unsigned int i = 0; i < digest_len; ++i) + if (checksum[i] != digest[i]) + { + message_dialog_run("Attachment is not valid: the checksum does not match"); + return; + } + } + message_dialog_run("Attachment is valid"); +} + +} diff --git a/examples/demo/attachments.h b/examples/demo/attachments.h new file mode 100644 index 0000000..5da7b46 --- /dev/null +++ b/examples/demo/attachments.h @@ -0,0 +1,71 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _ATTACHMENTS_H_ +#define _ATTACHMENTS_H_ + +#include <poppler-glibmm/document.h> +#include <gtkmm/buttonbox.h> +#include <gtkmm/scrolledwindow.h> +#include <gtkmm/treeview.h> +#include <gtkmm/liststore.h> +#include <glibmm/checksum.h> + +namespace PGD +{ + +class Attachments : public Gtk::Box +{ + public: + Attachments(const Glib::RefPtr<Poppler::Document>& document); + + private: + void fill_model(); + void save_button_clicked(); + bool save_slot(const gchar* buf, gsize count, Glib::Checksum& cs); + void validate_button_clicked(); + + const Glib::RefPtr<Poppler::Document> m_Document; + + class ModelColumns : public Gtk::TreeModel::ColumnRecord + { + public: + ModelColumns() { add(m_Name); add(m_Description); add(m_Size); + add(m_CTime); add(m_MTime); add(m_Attachment); } + + Gtk::TreeModelColumn<Glib::ustring> m_Name; + Gtk::TreeModelColumn<Glib::ustring> m_Description; + Gtk::TreeModelColumn<gsize> m_Size; + Gtk::TreeModelColumn<Glib::ustring> m_CTime; + Gtk::TreeModelColumn<Glib::ustring> m_MTime; + Gtk::TreeModelColumn< Glib::RefPtr<Poppler::Attachment> > m_Attachment; + }; + + Gtk::ButtonBox m_ButtonBox; + Gtk::Button m_SaveButton, m_ValidateButton; + Gtk::ScrolledWindow m_ScrolledWin; + Gtk::TreeView m_TreeView; + ModelColumns m_StoreColumns; + Glib::RefPtr<Gtk::ListStore> m_AttachmentsStore; + Gtk::CellRendererText m_DescriptionCell, m_NameCell; + Gtk::TreeViewColumn m_DescriptionColumn, m_NameColumn; +}; + +} + +#endif // _ATTACHMENTS_H_ diff --git a/examples/demo/auth-dialog.cc b/examples/demo/auth-dialog.cc new file mode 100644 index 0000000..bfa5f7e --- /dev/null +++ b/examples/demo/auth-dialog.cc @@ -0,0 +1,88 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "auth-dialog.h" + +#include <gtkmm/stock.h> + +AuthDialog::AuthDialog(const std::string& filename) : + m_HBox(false, 12), + m_VBox(false, 18), + m_Icon(Gtk::Stock::DIALOG_AUTHENTICATION, Gtk::ICON_SIZE_DIALOG), + m_PasswordLabel("_Password:", 0.0, 0.5, true) +{ + set_border_width(5); + get_content_area()->set_spacing(2); + get_action_area()->set_border_width(5); + get_action_area()->set_spacing(6); + + set_title("Enter password"); + set_resizable(false); + set_icon_name(Gtk::Stock::DIALOG_AUTHENTICATION.id); + set_modal(); + + add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + add_button("_Unlock Document", Gtk::RESPONSE_OK); + set_response_sensitive(Gtk::RESPONSE_OK, false); + set_default_response(Gtk::RESPONSE_OK); + + std::vector<int> button_order; + button_order.push_back(Gtk::RESPONSE_OK); + button_order.push_back(Gtk::RESPONSE_CANCEL); + set_alternative_button_order_from_array(button_order); + + m_HBox.set_border_width(5); + get_content_area()->pack_start(m_HBox, true, true); + + m_Icon.set_alignment(0.5, 0.0); + m_HBox.pack_start(m_Icon, false, false); + + m_HBox.pack_start(m_VBox, true, true); + + m_ContentLabel.set_alignment(0.0, 0.5); + m_ContentLabel.set_line_wrap(); + m_ContentLabel.set_max_width_chars(45); + m_ContentLabel.set_justify(Gtk::JUSTIFY_FILL); + + m_ContentLabel.set_markup("<span size=\"larger\" weight=\"bold\">Password required</span>\n\n" + "The document “" + filename + "” is locked and requires a password before it can be opened."); + + m_VBox.pack_start(m_ContentLabel, false, false); + + m_Grid.set_column_spacing(12); + m_Grid.set_row_spacing(6); + + m_PasswordEntry.set_visibility(false); + m_PasswordEntry.signal_changed().connect(sigc::mem_fun(*this, &AuthDialog::EntryChanged)); + m_PasswordEntry.set_activates_default(); + m_PasswordEntry.set_hexpand(); + m_PasswordLabel.set_mnemonic_widget(m_PasswordEntry); + + m_Grid.attach(m_PasswordLabel, 0, 0, 1, 1); + m_Grid.attach(m_PasswordEntry, 1, 0, 1, 1); + + m_VBox.pack_start(m_Grid, false, false); + + show_all_children(); +} + +void AuthDialog::EntryChanged() +{ + m_Password = m_PasswordEntry.get_text(); + set_response_sensitive(Gtk::RESPONSE_OK, m_Password.size()); +} diff --git a/examples/demo/auth-dialog.h b/examples/demo/auth-dialog.h new file mode 100644 index 0000000..bed52b8 --- /dev/null +++ b/examples/demo/auth-dialog.h @@ -0,0 +1,49 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + + +#ifndef _AUTH_DIALOG_H_ +#define _AUTH_DIALOG_H_ + +#include <gtkmm/dialog.h> +#include <gtkmm/grid.h> +#include <gtkmm/entry.h> +#include <gtkmm/image.h> + +class AuthDialog : public Gtk::Dialog +{ + public: + AuthDialog(const std::string& filename); + + inline Glib::ustring GetPassword() const { return m_Password; } + + private: + Glib::ustring m_Password; + + Gtk::HBox m_HBox; + Gtk::VBox m_VBox; + Gtk::Image m_Icon; + Gtk::Label m_ContentLabel, m_PasswordLabel; + Gtk::Grid m_Grid; + Gtk::Entry m_PasswordEntry; + + void EntryChanged(); +}; + + +#endif // _AUTH_DIALOG_H_ diff --git a/examples/demo/demo-window.cc b/examples/demo/demo-window.cc new file mode 100644 index 0000000..b2460a5 --- /dev/null +++ b/examples/demo/demo-window.cc @@ -0,0 +1,154 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "demo-window.h" + +DemoWindow::DemoWindow(const Glib::RefPtr<Poppler::Document>& document) : + m_HBox(Gtk::ORIENTATION_HORIZONTAL, 6), + m_Info(document), + m_Fonts(document), + m_Render(document), + m_Selections(document), + m_PageInfo(document), + m_Outline(document), + m_Links(document), + m_Forms(document), + m_Transitions(document), + m_Images(document), + m_Annots(document), + m_Attachments(document), + m_Layers(document), + m_Text(document), + m_Find(document), + m_Print(document) +{ + // Set up the treeview that displays the list of available demos + m_DemoStore = Gtk::ListStore::create(m_StoreColumns); + m_TreeView.append_column("Demos", m_StoreColumns.m_DemoName); + m_TreeView.set_model(m_DemoStore); + m_TreeView.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &DemoWindow::demo_changed)); + + int index = 0; + + Gtk::TreeRow row = *(m_DemoStore->append()); + row[m_StoreColumns.m_DemoName] = "Info"; + row[m_StoreColumns.m_Index] = index++; + + row = *(m_DemoStore->append()); + row[m_StoreColumns.m_DemoName] = "Fonts"; + row[m_StoreColumns.m_Index] = index++; + + row = *(m_DemoStore->append()); + row[m_StoreColumns.m_DemoName] = "Render"; + row[m_StoreColumns.m_Index] = index++; + + row = *(m_DemoStore->append()); + row[m_StoreColumns.m_DemoName] = "Selections"; + row[m_StoreColumns.m_Index] = index++; + + row = *(m_DemoStore->append()); + row[m_StoreColumns.m_DemoName] = "Page Info"; + row[m_StoreColumns.m_Index] = index++; + + row = *(m_DemoStore->append()); + row[m_StoreColumns.m_DemoName] = "Outline"; + row[m_StoreColumns.m_Index] = index++; + + row = *(m_DemoStore->append()); + row[m_StoreColumns.m_DemoName] = "Links"; + row[m_StoreColumns.m_Index] = index++; + + row = *(m_DemoStore->append()); + row[m_StoreColumns.m_DemoName] = "Forms"; + row[m_StoreColumns.m_Index] = index++; + + row = *(m_DemoStore->append()); + row[m_StoreColumns.m_DemoName] = "Page Transitions"; + row[m_StoreColumns.m_Index] = index++; + + row = *(m_DemoStore->append()); + row[m_StoreColumns.m_DemoName] = "Images"; + row[m_StoreColumns.m_Index] = index++; + + row = *(m_DemoStore->append()); + row[m_StoreColumns.m_DemoName] = "Annots"; + row[m_StoreColumns.m_Index] = index++; + + row = *(m_DemoStore->append()); + row[m_StoreColumns.m_DemoName] = "Attachments"; + row[m_StoreColumns.m_Index] = index++; + + row = *(m_DemoStore->append()); + row[m_StoreColumns.m_DemoName] = "Layers"; + row[m_StoreColumns.m_Index] = index++; + + row = *(m_DemoStore->append()); + row[m_StoreColumns.m_DemoName] = "Text"; + row[m_StoreColumns.m_Index] = index++; + + row = *(m_DemoStore->append()); + row[m_StoreColumns.m_DemoName] = "Find"; + row[m_StoreColumns.m_Index] = index++; + + row = *(m_DemoStore->append()); + row[m_StoreColumns.m_DemoName] = "Print"; + row[m_StoreColumns.m_Index] = index++; + + // Set up the notebook that will show the demos in action + m_Notebook.set_show_tabs(false); + m_Notebook.set_show_border(false); + + // Add the demo widgets as the pages + m_Notebook.append_page(m_Info); + m_Notebook.append_page(m_Fonts); + m_Notebook.append_page(m_Render); + m_Notebook.append_page(m_Selections); + m_Notebook.append_page(m_PageInfo); + m_Notebook.append_page(m_Outline); + m_Notebook.append_page(m_Links); + m_Notebook.append_page(m_Forms); + m_Notebook.append_page(m_Transitions); + m_Notebook.append_page(m_Images); + m_Notebook.append_page(m_Annots); + m_Notebook.append_page(m_Attachments); + m_Notebook.append_page(m_Layers); + m_Notebook.append_page(m_Text); + m_Notebook.append_page(m_Find); + m_Notebook.append_page(m_Print); + + m_HBox.pack_start(m_TreeView, false, true); + m_HBox.pack_start(m_Notebook, true, true); + add(m_HBox); + + set_default_size(660, 600); + set_title("Poppler GLib Demo"); + + show_all(); +} + +void DemoWindow::demo_changed() +{ + Gtk::TreeModel::iterator iter = m_TreeView.get_selection()->get_selected(); + if (iter) m_Notebook.set_current_page((*iter)[m_StoreColumns.m_Index]); +} + +bool DemoWindow::on_key_press_event(GdkEventKey* event) +{ + if (event->keyval == GDK_KEY_q && (event->state & GDK_CONTROL_MASK)) hide(); + return false; +} diff --git a/examples/demo/demo-window.h b/examples/demo/demo-window.h new file mode 100644 index 0000000..ab87672 --- /dev/null +++ b/examples/demo/demo-window.h @@ -0,0 +1,91 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _DEMO_WINDOW_H_ +#define _DEMO_WINDOW_H_ + +#include "info.h" +#include "fonts.h" +#include "render.h" +#include "selections.h" +#include "page-info.h" +#include "outline.h" +#include "links.h" +#include "forms.h" +#include "transitions.h" +#include "images.h" +#include "annots.h" +#include "attachments.h" +#include "layers.h" +#include "text.h" +#include "find.h" +#include "print.h" + +#include <gtkmm/window.h> +#include <gtkmm/treeview.h> +#include <gtkmm/liststore.h> +#include <gtkmm/notebook.h> +#include <gtkmm/box.h> +#include <poppler-glibmm/document.h> + +class DemoWindow : public Gtk::Window +{ + public: + DemoWindow(const Glib::RefPtr<Poppler::Document>& document); + + private: + void demo_changed(); + bool on_key_press_event(GdkEventKey* event); + + class ModelColumns : public Gtk::TreeModel::ColumnRecord + { + public: + ModelColumns() { add(m_DemoName); add(m_Index); } + + Gtk::TreeModelColumn<std::string> m_DemoName; + Gtk::TreeModelColumn<int> m_Index; + }; + + Gtk::TreeView m_TreeView; + ModelColumns m_StoreColumns; + Glib::RefPtr<Gtk::ListStore> m_DemoStore; + + Gtk::Box m_HBox; + Gtk::Notebook m_Notebook; + Glib::RefPtr<Gtk::AccelGroup> m_AccelGroup; + + // Demo widgets + PGD::Info m_Info; + PGD::Fonts m_Fonts; + PGD::Render m_Render; + PGD::Selections m_Selections; + PGD::PageInfo m_PageInfo; + PGD::Outline m_Outline; + PGD::Links m_Links; + PGD::Forms m_Forms; + PGD::Transitions m_Transitions; + PGD::Images m_Images; + PGD::Annots m_Annots; + PGD::Attachments m_Attachments; + PGD::Layers m_Layers; + PGD::Text m_Text; + PGD::Find m_Find; + PGD::Print m_Print; +}; + +#endif // _DEMO_WINDOW_H_ diff --git a/examples/demo/find.cc b/examples/demo/find.cc new file mode 100644 index 0000000..02ee356 --- /dev/null +++ b/examples/demo/find.cc @@ -0,0 +1,131 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "find.h" + +#include <glibmm/main.h> +#include <glibmm/timer.h> +#include <iomanip> + +namespace PGD +{ + +Find::Find(const Glib::RefPtr<Poppler::Document>& document) : + Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12), + m_Document(document), + m_PageIndex(0), + m_HBoxTop(Gtk::ORIENTATION_HORIZONTAL, 6), + m_FindButton("Find") +{ + m_NPages = document->get_n_pages(); + + m_ProgressBar.set_ellipsize(Pango::ELLIPSIZE_END); + m_ProgressBar.set_show_text(); + m_ProgressBar.set_text(""); + m_FindButton.set_sensitive(false); + m_FindButton.signal_clicked().connect(sigc::mem_fun(*this, &Find::find_button_clicked)); + m_TextEntry.signal_changed().connect(sigc::mem_fun(*this, &Find::set_button_sensitivity)); + + m_HBoxTop.pack_start(m_TextEntry, false, true); + m_HBoxTop.pack_start(m_ProgressBar, true, true); + m_HBoxTop.pack_end(m_FindButton, false, false); + + m_ScrolledWin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + + m_MatchStore = Gtk::TreeStore::create(m_StoreColumns); + m_TreeView.set_model(m_MatchStore); + m_TreeView.set_rules_hint(); + m_TreeView.get_selection()->set_mode(Gtk::SELECTION_NONE); + + m_TreeView.append_column("Matches", m_StoreColumns.m_Matches); + int column_num = m_TreeView.append_column_numeric("X1", m_StoreColumns.m_X1, "%.2f"); + m_TreeView.get_column(column_num - 1)->add_attribute( + m_TreeView.get_column_cell_renderer(column_num - 1)->property_visible(), m_StoreColumns.m_Visible); + column_num = m_TreeView.append_column_numeric("Y1", m_StoreColumns.m_Y1, "%.2f"); + m_TreeView.get_column(column_num - 1)->add_attribute( + m_TreeView.get_column_cell_renderer(column_num - 1)->property_visible(), m_StoreColumns.m_Visible); + column_num = m_TreeView.append_column_numeric("X2", m_StoreColumns.m_X2, "%.2f"); + m_TreeView.get_column(column_num - 1)->add_attribute( + m_TreeView.get_column_cell_renderer(column_num - 1)->property_visible(), m_StoreColumns.m_Visible); + column_num = m_TreeView.append_column_numeric("Y2", m_StoreColumns.m_Y2, "%.2f"); + m_TreeView.get_column(column_num - 1)->add_attribute( + m_TreeView.get_column_cell_renderer(column_num - 1)->property_visible(), m_StoreColumns.m_Visible); + + m_ScrolledWin.add(m_TreeView); + + pack_start(m_HBoxTop, false, true, 6); + pack_start(m_ScrolledWin, true, true); + + show_all(); +} + +void Find::find_button_clicked() +{ + m_MatchStore->clear(); + m_PageIndex = 0; + + update_progress(m_NPages, m_PageIndex); + if (m_FindIdle.connected()) m_FindIdle.disconnect(); + m_FindIdle = Glib::signal_idle().connect(sigc::mem_fun(*this, &Find::find_text)); +} + +void Find::set_button_sensitivity() +{ + m_FindButton.set_sensitive(m_TextEntry.get_text().size()); +} + +void Find::update_progress(int n_pages, int scanned) +{ + m_ProgressBar.set_text(Glib::ustring::compose("Searching ... (%1%%)", std::min(scanned * 100 / n_pages, 100))); + m_ProgressBar.set_fraction(std::min((double)scanned / n_pages, 1.0)); +} + +bool Find::find_text() +{ + Glib::RefPtr<Poppler::Page> page = m_Document->get_page(m_PageIndex); + if (!page) return ++m_PageIndex < m_NPages; + + Glib::Timer timer; + std::vector<Poppler::Rectangle> matches = page->find_text(m_TextEntry.get_text()); + timer.stop(); + + if (matches.size()) + { + Gtk::TreeRow row = *(m_MatchStore->append()); + row[m_StoreColumns.m_Matches] = Glib::ustring::format(matches.size(), " matches found on page ", m_PageIndex + 1, + " in ", std::fixed, std::setprecision(4), timer.elapsed(), " seconds"); + + int n_match = 0; + for (std::vector<Poppler::Rectangle>::iterator match = matches.begin(); + match != matches.end(); ++match) + { + Gtk::TreeRow match_row = *(m_MatchStore->append(row.children())); + match_row[m_StoreColumns.m_Matches] = Glib::ustring::format("Match ", ++n_match); + match_row[m_StoreColumns.m_X1] = match->get_x1(); + match_row[m_StoreColumns.m_Y1] = match->get_y1(); + match_row[m_StoreColumns.m_X2] = match->get_x2(); + match_row[m_StoreColumns.m_Y2] = match->get_y2(); + match_row[m_StoreColumns.m_Visible] = true; + } + } + + update_progress(m_NPages, ++m_PageIndex); + return m_PageIndex < m_NPages; +} + +} diff --git a/examples/demo/find.h b/examples/demo/find.h new file mode 100644 index 0000000..5047227 --- /dev/null +++ b/examples/demo/find.h @@ -0,0 +1,74 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _FIND_H_ +#define _FIND_H_ + +#include <poppler-glibmm/document.h> +#include <gtkmm/box.h> +#include <gtkmm/progressbar.h> +#include <gtkmm/button.h> +#include <gtkmm/scrolledwindow.h> +#include <gtkmm/treeview.h> +#include <gtkmm/treestore.h> + +namespace PGD +{ + +class Find : public Gtk::Box +{ + public: + Find(const Glib::RefPtr<Poppler::Document>& document); + + private: + void find_button_clicked(); + void set_button_sensitivity(); + void update_progress(int n_pages, int scanned); + bool find_text(); + + const Glib::RefPtr<Poppler::Document> m_Document; + int m_NPages; + int m_PageIndex; + + class ModelColumns : public Gtk::TreeModel::ColumnRecord + { + public: + ModelColumns() { add(m_Matches); add(m_X1); add(m_Y1); add(m_X2); add(m_Y2); add(m_Visible); } + + Gtk::TreeModelColumn<Glib::ustring> m_Matches; + Gtk::TreeModelColumn<double> m_X1; + Gtk::TreeModelColumn<double> m_Y1; + Gtk::TreeModelColumn<double> m_X2; + Gtk::TreeModelColumn<double> m_Y2; + Gtk::TreeModelColumn<bool> m_Visible; + }; + + Gtk::Box m_HBoxTop; + Gtk::ProgressBar m_ProgressBar; + Gtk::Entry m_TextEntry; + Gtk::Button m_FindButton; + Gtk::ScrolledWindow m_ScrolledWin; + Gtk::TreeView m_TreeView; + ModelColumns m_StoreColumns; + Glib::RefPtr<Gtk::TreeStore> m_MatchStore; + sigc::connection m_FindIdle; +}; + +} + +#endif // _FIND_H_ diff --git a/examples/demo/fonts.cc b/examples/demo/fonts.cc new file mode 100644 index 0000000..aa9717a --- /dev/null +++ b/examples/demo/fonts.cc @@ -0,0 +1,160 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "fonts.h" + +#include <glibmm/main.h> +#include <glibmm/markup.h> +#include <gtkmm/main.h> + +namespace PGD +{ + +Fonts::Fonts(const Glib::RefPtr<Poppler::Document>& document) : + Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12), + m_Document(document), + m_HBox(Gtk::ORIENTATION_HORIZONTAL, 6), + m_ScanButton("Scan"), + m_Column("Fonts") +{ + m_ProgressBar.set_ellipsize(Pango::ELLIPSIZE_END); + m_ProgressBar.set_show_text(); + m_ProgressBar.set_text(""); + m_ScanButton.signal_clicked().connect(sigc::mem_fun(*this, &Fonts::scan_button_clicked)); + + m_HBox.pack_start(m_ProgressBar, true, true); + m_HBox.pack_end(m_ScanButton, false, false); + pack_start(m_HBox, false, true, 6); + + // Set up the treeview that displays the fonts + m_FontsWin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + m_FontsStore = Gtk::ListStore::create(m_StoreColumns); + + m_Column.pack_start(m_FontCell, true); + m_Column.set_cell_data_func(m_FontCell, sigc::mem_fun(*this, &Fonts::fonts_cell_data_func)); + + m_TreeView.append_column(m_Column); + m_TreeView.set_model(m_FontsStore); + m_TreeView.set_headers_visible(false); + m_TreeView.set_rules_hint(); + m_TreeView.get_selection()->set_mode(Gtk::SELECTION_NONE); + + m_FontsWin.add(m_TreeView); + pack_start(m_FontsWin, true, true); + + show_all(); +} + +void Fonts::scan_button_clicked() +{ + Glib::signal_idle().connect_once(sigc::mem_fun(*this, &Fonts::fill_model)); +} + +void Fonts::fonts_cell_data_func(Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter) +{ + Glib::ustring font_name = (*iter)[m_StoreColumns.m_FontName]; + Glib::ustring details = (*iter)[m_StoreColumns.m_FontDetails]; + + if (details.empty()) + ((Gtk::CellRendererText*)cell)->property_markup() = "<b><big>" + font_name + "</big></b>"; + else + ((Gtk::CellRendererText*)cell)->property_markup() = + "<b><big>" + font_name + "</big></b>\n<small>" + details + "</small>"; +} + +static Glib::ustring font_type_to_string(Poppler::FontType type) +{ + switch (type) + { + case Poppler::FONT_TYPE_TYPE1: + return "Type 1"; + case Poppler::FONT_TYPE_TYPE1C: + return "Type 1C"; + case Poppler::FONT_TYPE_TYPE3: + return "Type 3"; + case Poppler::FONT_TYPE_TRUETYPE: + return "TrueType"; + case Poppler::FONT_TYPE_CID_TYPE0: + return "Type 1 (CID)"; + case Poppler::FONT_TYPE_CID_TYPE0C: + return "Type 1C (CID)"; + case Poppler::FONT_TYPE_CID_TYPE2: + return "TrueType (CID)"; + default: + return "Unknown font type"; + } +} + +void Fonts::fill_model() +{ + int n_pages = m_Document->get_n_pages(), scanned = 0; + m_FontsStore->clear(); + + Glib::RefPtr<Poppler::FontInfo> font_info = m_Document->get_font_info(); + Poppler::FontsIter fonts_iter; + while (font_info->scan(20, fonts_iter)) + { + update_progress(n_pages, scanned); + while (Gtk::Main::events_pending()) + Gtk::Main::iteration(); + + scanned += 20; + + if (!fonts_iter) continue; // No fonts found in these 20 pages + do + { + Gtk::TreeRow row = *(m_FontsStore->append()); + + Glib::ustring name = fonts_iter.get_name(); + row[m_StoreColumns.m_FontName] = name.empty() ? "No name" : name; + + Glib::ustring encoding = fonts_iter.get_encoding(); + if (encoding.empty()) encoding = "None"; + + Glib::ustring type = font_type_to_string(fonts_iter.get_font_type()); + + Glib::ustring embedded; + if (fonts_iter.is_embedded()) + { + if (fonts_iter.is_subset()) embedded = "Embedded subset"; + else embedded = "Embedded"; + } + else embedded = "Not embedded"; + + Glib::ustring substitute = fonts_iter.get_substitute_name(); + Glib::ustring filename = fonts_iter.get_file_name(); + + Glib::ustring details = type + "\nEncoding: " + Glib::Markup::escape_text(encoding) + "\n" + embedded; + if (substitute.size() && filename.size()) + details += ", substituting with <b>" + Glib::Markup::escape_text(substitute) + "</b>\n(" + + Glib::Markup::escape_text(filename) + ")"; + + row[m_StoreColumns.m_FontDetails] = details; + + } while (fonts_iter.next()); + } + update_progress(n_pages, scanned); +} + +void Fonts::update_progress(int n_pages, int scanned) +{ + m_ProgressBar.set_text(Glib::ustring::compose("Scanning fonts (%1%%)", std::min(scanned * 100 / n_pages, 100))); + m_ProgressBar.set_fraction(std::min((double)scanned / n_pages, 1.0)); +} + +} diff --git a/examples/demo/fonts.h b/examples/demo/fonts.h new file mode 100644 index 0000000..bc2b7b8 --- /dev/null +++ b/examples/demo/fonts.h @@ -0,0 +1,68 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _FONTS_H_ +#define _FONTS_H_ + +#include <poppler-glibmm/document.h> +#include <gtkmm/box.h> +#include <gtkmm/progressbar.h> +#include <gtkmm/button.h> +#include <gtkmm/scrolledwindow.h> +#include <gtkmm/treeview.h> +#include <gtkmm/liststore.h> + +namespace PGD +{ + +class Fonts : public Gtk::Box +{ + public: + Fonts(const Glib::RefPtr<Poppler::Document>& document); + + private: + void scan_button_clicked(); + void fonts_cell_data_func(Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter); + void fill_model(); + void update_progress(int n_pages, int scanned); + + const Glib::RefPtr<Poppler::Document> m_Document; + + class ModelColumns : public Gtk::TreeModel::ColumnRecord + { + public: + ModelColumns() { add(m_FontName); add(m_FontDetails); } + + Gtk::TreeModelColumn<Glib::ustring> m_FontName; + Gtk::TreeModelColumn<Glib::ustring> m_FontDetails; + }; + + Gtk::Box m_HBox; + Gtk::ProgressBar m_ProgressBar; + Gtk::Button m_ScanButton; + Gtk::ScrolledWindow m_FontsWin; + Gtk::TreeView m_TreeView; + ModelColumns m_StoreColumns; + Glib::RefPtr<Gtk::ListStore> m_FontsStore; + Gtk::TreeViewColumn m_Column; + Gtk::CellRendererText m_FontCell; +}; + +} + +#endif // _FONTS_H_ diff --git a/examples/demo/forms.cc b/examples/demo/forms.cc new file mode 100644 index 0000000..963e46a --- /dev/null +++ b/examples/demo/forms.cc @@ -0,0 +1,260 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "forms.h" +#include "property-grid.h" +#include "action-view.h" + +#include <gtkmm/textview.h> +#include <glibmm/timer.h> +#include <iomanip> + +namespace PGD +{ + +FormFieldView::FormFieldView(const Glib::RefPtr<Poppler::Document>& document) : + m_Document(document), + m_Alignment(0.5, 0.5, 1, 1) +{ + set_shadow_type(Gtk::SHADOW_NONE); + m_Label.set_markup("<b>Form Field Properties</b>"); + set_label_widget(m_Label); + + m_Alignment.set_padding(5, 5, 12, 5); + add(m_Alignment); +} + +void FormFieldView::set_field(const Glib::RefPtr<Poppler::FormField>& field) +{ + PropertyGrid* grid = static_cast<PropertyGrid*>(m_Alignment.get_child()); + if (grid) + { + m_Alignment.remove(); + delete grid; + } + + if (!field) return; + + m_Alignment.add(*Gtk::manage(grid = new PropertyGrid)); + + grid->set_column_spacing(6); + grid->set_row_spacing(6); + + if (field->get_name().size()) grid->add_property("<b>Name:</b>", field->get_name()); + if (field->get_partial_name().size()) grid->add_property("<b>Partial Name:</b>", field->get_partial_name()); + if (field->get_mapping_name().size()) grid->add_property("<b>Mapping Name:</b>", field->get_mapping_name()); + + Poppler::Action action = field->get_action(); + if (action) + { + ActionView* action_view; + grid->add_property_with_custom_widget("<b>Action:</b>", *Gtk::manage(action_view = new ActionView(m_Document))); + action_view->set_action(action); + } + + switch (field->get_field_type()) + { + case Poppler::FORM_FIELD_BUTTON: + { + GEnumValue* enum_value = g_enum_get_value((GEnumClass*)g_type_class_ref( + Glib::Value<Poppler::FormButtonType>::value_type()), field->button_get_button_type()); + grid->add_property("<b>Button Type:</b>", enum_value->value_name); + grid->add_property("<b>Button State:</b>", field->button_get_state() ? "Active" : "Inactive"); + } + break; + case Poppler::FORM_FIELD_TEXT: + { + GEnumValue* enum_value = g_enum_get_value((GEnumClass*)g_type_class_ref( + Glib::Value<Poppler::FormTextType>::value_type()), field->text_get_text_type()); + grid->add_property("<b>Text Type:</b>", enum_value->value_name); + grid->add_property("<b>Contents:</b>", field->text_get_text()); + grid->add_property("<b>Max Length:</b>", Glib::ustring::format(field->text_get_max_len())); + grid->add_property("<b>Do spellcheck:</b>", field->text_do_spell_check() ? "Yes" : "No"); + grid->add_property("<b>Do scroll:</b>", field->text_do_scroll() ? "Yes" : "No"); + grid->add_property("<b>Rich Text:</b>", field->text_is_rich_text() ? "Yes" : "No"); + grid->add_property("<b>Pasword type:</b>", field->text_is_password() ? "Yes" : "No"); + } + break; + case Poppler::FORM_FIELD_CHOICE: + { + GEnumValue* enum_value = g_enum_get_value((GEnumClass*)g_type_class_ref( + Glib::Value<Poppler::FormChoiceType>::value_type()), field->choice_get_choice_type()); + grid->add_property("<b>Choice Type:</b>", enum_value->value_name); + grid->add_property("<b>Editable:</b>", field->choice_is_editable() ? "Yes" : "No"); + grid->add_property("<b>Multiple Selection:</b>", field->choice_can_select_multiple() ? "Yes" : "No"); + grid->add_property("<b>Do spellcheck:</b>", field->choice_do_spell_check() ? "Yes" : "No"); + grid->add_property("<b>Commit on Change:</b>", field->choice_commit_on_change() ? "Yes" : "No"); + int n_items = field->choice_get_n_items(); + grid->add_property("<b>Number of items:</b>", Glib::ustring::format(n_items)); + + Gtk::ScrolledWindow* swindow; + grid->add_property_with_custom_widget("<b>Items:</b>", *Gtk::manage(swindow = new Gtk::ScrolledWindow)); + swindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + Gtk::TextView* textview; + swindow->add(*Gtk::manage(textview = new Gtk::TextView)); + textview->set_editable(false); + Glib::RefPtr<Gtk::TextBuffer> buffer = textview->get_buffer(); + int selected = -1; + for (int i = 0; i < n_items; ++i) + { + Glib::ustring item = field->choice_get_item(i); + buffer->insert_at_cursor(item); + buffer->insert_at_cursor("\n"); + if (field->choice_is_item_selected(i)) selected = i; + } + if (selected >= 0 && n_items > selected) + grid->add_property("<b>Selected item:</b>", + Glib::ustring::compose("%1 (%2)", selected, field->choice_get_item(selected))); + + grid->add_property("<b>Contents:</b>", field->choice_get_text()); + } + break; + case Poppler::FORM_FIELD_SIGNATURE: + case Poppler::FORM_FIELD_UNKNOWN: + break; + } + grid->show_all(); +} + +Forms::Forms(const Glib::RefPtr<Poppler::Document>& document) : + Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12), + m_Document(document), + m_Page(0), + m_HBoxTop(Gtk::ORIENTATION_HORIZONTAL, 6), + m_PageLabel("Page:"), + m_GetButton("Get Forms Fields"), + m_HPaned(Gtk::ORIENTATION_HORIZONTAL), + m_FormFieldView(document) +{ + int n_pages = m_Document->get_n_pages(); + m_PageSelector.set_range(1, n_pages); + m_PageSelector.set_increments(1, 10); + m_PageSelector.set_numeric(); + m_PageSelector.signal_value_changed().connect(sigc::mem_fun(*this, &Forms::page_selector_changed)); + m_PageNumLabel.set_text(Glib::ustring::compose("of %1", n_pages)); + + m_GetButton.signal_clicked().connect(sigc::mem_fun(*this, &Forms::get_form_fields)); + + m_HBoxTop.pack_start(m_PageLabel, false, true); + m_HBoxTop.pack_start(m_PageSelector, false, true); + m_HBoxTop.pack_start(m_PageNumLabel, false, true); + m_HBoxTop.pack_end(m_GetButton, false, false); + + m_TimerLabel.set_markup("<i>No form fields found</i>"); + m_TimerLabel.set_alignment(1.0, 0.5); + + m_ScrolledWin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + + m_FieldStore = Gtk::ListStore::create(m_StoreColumns); + m_TreeView.set_model(m_FieldStore); + + m_TreeView.append_column("Form Field Type", m_StoreColumns.m_FieldType); + m_TreeView.append_column("Form Field Id", m_StoreColumns.m_Id); + m_TreeView.append_column("Read Only", m_StoreColumns.m_ReadOnly); + m_TreeView.append_column_numeric("X1", m_StoreColumns.m_X1, "%.2f"); + m_TreeView.append_column_numeric("Y1", m_StoreColumns.m_Y1, "%.2f"); + m_TreeView.append_column_numeric("X2", m_StoreColumns.m_X2, "%.2f"); + m_TreeView.append_column_numeric("Y2", m_StoreColumns.m_Y2, "%.2f"); + + m_TreeView.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &Forms::selection_changed)); + + m_ScrolledWin.add(m_TreeView); + + m_HPaned.add1(m_ScrolledWin); + m_HPaned.add2(m_FormFieldView); + m_HPaned.set_position(300); + + pack_start(m_HBoxTop, false, true); + pack_start(m_TimerLabel, false, true); + pack_start(m_HPaned, true, true); + + show_all(); +} + +void Forms::page_selector_changed() +{ + m_Page = m_PageSelector.get_value() - 1; +} + +static Glib::ustring get_form_field_type(const Glib::RefPtr<Poppler::FormField>& field) +{ + switch (field->get_field_type()) + { + case Poppler::FORM_FIELD_TEXT: + return "Text"; + case Poppler::FORM_FIELD_BUTTON: + return "Button"; + case Poppler::FORM_FIELD_CHOICE: + return "Choice"; + case Poppler::FORM_FIELD_SIGNATURE: + return "Signature"; + case Poppler::FORM_FIELD_UNKNOWN: + break; + } + return "Unknown"; +} + +void Forms::get_form_fields() +{ + m_FieldStore->clear(); + + m_FormFieldView.set_field(Glib::RefPtr<Poppler::FormField>()); + + Glib::RefPtr<Poppler::Page> page = m_Document->get_page(m_Page); + if (!page) return; + + Glib::Timer timer; + std::vector<Poppler::FormFieldMapping> mapping = page->get_form_field_mapping(); + timer.stop(); + + int n_fields = mapping.size(); + + if (n_fields > 0) + m_TimerLabel.set_markup(Glib::ustring::format("<i>", n_fields, " form fields found in ", + std::fixed, std::setprecision(4), timer.elapsed(), " seconds</i>")); + else + m_TimerLabel.set_markup("<i>No form fields found</i>"); + + for (std::vector<Poppler::FormFieldMapping>::iterator fmapping = mapping.begin(); + fmapping != mapping.end(); ++fmapping) + { + Gtk::TreeRow tree_row = *(m_FieldStore->append()); + + Glib::RefPtr<Poppler::FormField> field = fmapping->get_field(); + tree_row[m_StoreColumns.m_FieldType] = get_form_field_type(field); + tree_row[m_StoreColumns.m_Id] = field->get_id(); + tree_row[m_StoreColumns.m_ReadOnly] = field->is_read_only(); + + Poppler::Rectangle area = fmapping->get_area(); + tree_row[m_StoreColumns.m_X1] = area.get_x1(); + tree_row[m_StoreColumns.m_Y1] = area.get_y1(); + tree_row[m_StoreColumns.m_X2] = area.get_x2(); + tree_row[m_StoreColumns.m_Y2] = area.get_y2(); + + tree_row[m_StoreColumns.m_Field] = field; + } +} + +void Forms::selection_changed() +{ + Gtk::TreeIter iter = m_TreeView.get_selection()->get_selected(); + if (iter) m_FormFieldView.set_field((*iter)[m_StoreColumns.m_Field]); + else m_FormFieldView.set_field(Glib::RefPtr<Poppler::FormField>()); +} + +} diff --git a/examples/demo/forms.h b/examples/demo/forms.h new file mode 100644 index 0000000..599b127 --- /dev/null +++ b/examples/demo/forms.h @@ -0,0 +1,94 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _FORMS_H_ +#define _FORMS_H_ + +#include <poppler-glibmm/document.h> +#include <gtkmm/box.h> +#include <gtkmm/label.h> +#include <gtkmm/button.h> +#include <gtkmm/spinbutton.h> +#include <gtkmm/scrolledwindow.h> +#include <gtkmm/paned.h> +#include <gtkmm/frame.h> +#include <gtkmm/liststore.h> +#include <gtkmm/treeview.h> +#include <gtkmm/alignment.h> + +namespace PGD +{ + +class FormFieldView : public Gtk::Frame +{ + public: + FormFieldView(const Glib::RefPtr<Poppler::Document>& document); + void set_field(const Glib::RefPtr<Poppler::FormField>& field); + + private: + const Glib::RefPtr<Poppler::Document> m_Document; + + Gtk::Label m_Label; + Gtk::Alignment m_Alignment; +}; + +class Forms : public Gtk::Box +{ + public: + Forms(const Glib::RefPtr<Poppler::Document>& document); + + private: + void page_selector_changed(); + void get_form_fields(); + void selection_changed(); + + const Glib::RefPtr<Poppler::Document> m_Document; + int m_Page; + + class ModelColumns : public Gtk::TreeModel::ColumnRecord + { + public: + ModelColumns() { add(m_FieldType); add(m_Id); add(m_ReadOnly); + add(m_X1); add(m_Y1); add(m_X2); add(m_Y2); add(m_Field); } + + Gtk::TreeModelColumn<Glib::ustring> m_FieldType; + Gtk::TreeModelColumn<int> m_Id; + Gtk::TreeModelColumn<bool> m_ReadOnly; + Gtk::TreeModelColumn<double> m_X1; + Gtk::TreeModelColumn<double> m_Y1; + Gtk::TreeModelColumn<double> m_X2; + Gtk::TreeModelColumn<double> m_Y2; + Gtk::TreeModelColumn< Glib::RefPtr<Poppler::FormField> > m_Field; + }; + + Gtk::Box m_HBoxTop; + Gtk::Label m_PageLabel, m_PageNumLabel, m_TimerLabel; + Gtk::SpinButton m_PageSelector; + Gtk::Button m_GetButton; + Gtk::ScrolledWindow m_ScrolledWin; + Gtk::Paned m_HPaned; + FormFieldView m_FormFieldView; + + ModelColumns m_StoreColumns; + Gtk::TreeView m_TreeView; + Glib::RefPtr<Gtk::ListStore> m_FieldStore; +}; + +} + +#endif // _FORMS_H_ diff --git a/examples/demo/images.cc b/examples/demo/images.cc new file mode 100644 index 0000000..8d62e7c --- /dev/null +++ b/examples/demo/images.cc @@ -0,0 +1,153 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "images.h" + +#include <glibmm/timer.h> +#include <iomanip> + +namespace PGD +{ + +ImageView::ImageView(const Glib::RefPtr<Poppler::Document>& document) : + m_Document(document) +{ + m_DrawingArea.signal_draw().connect(sigc::mem_fun(*this, &ImageView::drawing_area_draw)); + set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + add(m_DrawingArea); +} + +bool ImageView::drawing_area_draw(const Cairo::RefPtr<Cairo::Context>& cr) +{ + if (!m_Image) return false; + + m_DrawingArea.set_size_request(m_Image->get_width(), m_Image->get_height()); + cr->set_source(m_Image, 0, 0); + cr->paint(); + + return true; +} + +void ImageView::set_image(const Cairo::RefPtr<Cairo::ImageSurface>& image) +{ + m_Image = image; + m_DrawingArea.queue_draw(); +} + +Images::Images(const Glib::RefPtr<Poppler::Document>& document) : + Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12), + m_Document(document), + m_Page(0), + m_HBoxTop(Gtk::ORIENTATION_HORIZONTAL, 6), + m_PageLabel("Page:"), + m_GetButton("Get Images"), + m_HPaned(Gtk::ORIENTATION_HORIZONTAL), + m_ImageView(document) +{ + int n_pages = m_Document->get_n_pages(); + m_PageSelector.set_range(1, n_pages); + m_PageSelector.set_increments(1, 10); + m_PageSelector.set_numeric(); + m_PageSelector.signal_value_changed().connect(sigc::mem_fun(*this, &Images::page_selector_changed)); + m_PageNumLabel.set_text(Glib::ustring::compose("of %1", n_pages)); + + m_GetButton.signal_clicked().connect(sigc::mem_fun(*this, &Images::get_images)); + + m_HBoxTop.pack_start(m_PageLabel, false, true); + m_HBoxTop.pack_start(m_PageSelector, false, true); + m_HBoxTop.pack_start(m_PageNumLabel, false, true); + m_HBoxTop.pack_end(m_GetButton, false, false); + + m_TimerLabel.set_markup("<i>No images found</i>"); + m_TimerLabel.set_alignment(1.0, 0.5); + + m_ScrolledWin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + + m_ImageStore = Gtk::ListStore::create(m_StoreColumns); + m_TreeView.set_model(m_ImageStore); + + m_TreeView.append_column_numeric("Image", m_StoreColumns.m_Id, "%d"); + m_TreeView.append_column_numeric("X1", m_StoreColumns.m_X1, "%.2f"); + m_TreeView.append_column_numeric("Y1", m_StoreColumns.m_Y1, "%.2f"); + m_TreeView.append_column_numeric("X2", m_StoreColumns.m_X2, "%.2f"); + m_TreeView.append_column_numeric("Y2", m_StoreColumns.m_Y2, "%.2f"); + + m_TreeView.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &Images::selection_changed)); + + m_ScrolledWin.add(m_TreeView); + + m_HPaned.add1(m_ScrolledWin); + m_HPaned.add2(m_ImageView); + m_HPaned.set_position(300); + + pack_start(m_HBoxTop, false, true); + pack_start(m_TimerLabel, false, true); + pack_start(m_HPaned, true, true); + + show_all(); +} + +void Images::page_selector_changed() +{ + m_Page = m_PageSelector.get_value() - 1; +} + +void Images::selection_changed() +{ + Gtk::TreeIter iter = m_TreeView.get_selection()->get_selected(); + if (iter) m_ImageView.set_image(m_Document->get_page(m_Page)->get_image((*iter)[m_StoreColumns.m_Id])); + else m_ImageView.set_image(Cairo::RefPtr<Cairo::ImageSurface>()); +} + +void Images::get_images() +{ + m_ImageStore->clear(); + + m_ImageView.set_image(Cairo::RefPtr<Cairo::ImageSurface>()); + + Glib::RefPtr<Poppler::Page> page = m_Document->get_page(m_Page); + if (!page) return; + + Glib::Timer timer; + std::vector<Poppler::ImageMapping> mapping = page->get_image_mapping(); + timer.stop(); + + int n_links = mapping.size(); + + if (n_links > 0) + m_TimerLabel.set_markup(Glib::ustring::format("<i>", n_links, " images found in ", + std::fixed, std::setprecision(4), timer.elapsed(), " seconds</i>")); + else + m_TimerLabel.set_markup("<i>No images found</i>"); + + for (std::vector<Poppler::ImageMapping>::iterator imapping = mapping.begin(); + imapping != mapping.end(); ++imapping) + { + Gtk::TreeRow tree_row = *(m_ImageStore->append()); + + tree_row[m_StoreColumns.m_Id] = imapping->get_image_id(); + + Poppler::Rectangle area = imapping->get_area(); + tree_row[m_StoreColumns.m_X1] = area.get_x1(); + tree_row[m_StoreColumns.m_Y1] = area.get_y1(); + tree_row[m_StoreColumns.m_X2] = area.get_x2(); + tree_row[m_StoreColumns.m_Y2] = area.get_y2(); + } +} + +} diff --git a/examples/demo/images.h b/examples/demo/images.h new file mode 100644 index 0000000..4a1525d --- /dev/null +++ b/examples/demo/images.h @@ -0,0 +1,91 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _IMAGES_H_ +#define _IMAGES_H_ + +#include <poppler-glibmm/document.h> +#include <gtkmm/box.h> +#include <gtkmm/label.h> +#include <gtkmm/button.h> +#include <gtkmm/spinbutton.h> +#include <gtkmm/scrolledwindow.h> +#include <gtkmm/paned.h> +#include <gtkmm/liststore.h> +#include <gtkmm/treeview.h> +#include <gtkmm/drawingarea.h> + +namespace PGD +{ + +class ImageView : public Gtk::ScrolledWindow +{ + public: + ImageView(const Glib::RefPtr<Poppler::Document>& document); + void set_image(const Cairo::RefPtr<Cairo::ImageSurface>& image); + + private: + bool drawing_area_draw(const Cairo::RefPtr<Cairo::Context>& cr); + + const Glib::RefPtr<Poppler::Document> m_Document; + Cairo::RefPtr<Cairo::ImageSurface> m_Image; + + Gtk::DrawingArea m_DrawingArea; +}; + +class Images : public Gtk::Box +{ + public: + Images(const Glib::RefPtr<Poppler::Document>& document); + + private: + void page_selector_changed(); + void get_images(); + void selection_changed(); + + const Glib::RefPtr<Poppler::Document> m_Document; + int m_Page; + + class ModelColumns : public Gtk::TreeModel::ColumnRecord + { + public: + ModelColumns() { add(m_Id); add(m_X1); add(m_Y1); add(m_X2); add(m_Y2); } + + Gtk::TreeModelColumn<int> m_Id; + Gtk::TreeModelColumn<double> m_X1; + Gtk::TreeModelColumn<double> m_Y1; + Gtk::TreeModelColumn<double> m_X2; + Gtk::TreeModelColumn<double> m_Y2; + }; + + Gtk::Box m_HBoxTop; + Gtk::Label m_PageLabel, m_PageNumLabel, m_TimerLabel; + Gtk::SpinButton m_PageSelector; + Gtk::Button m_GetButton; + Gtk::ScrolledWindow m_ScrolledWin; + Gtk::Paned m_HPaned; + ImageView m_ImageView; + + ModelColumns m_StoreColumns; + Gtk::TreeView m_TreeView; + Glib::RefPtr<Gtk::ListStore> m_ImageStore; +}; + +} + +#endif // _IMAGES_H_ diff --git a/examples/demo/info.cc b/examples/demo/info.cc new file mode 100644 index 0000000..c65eaf9 --- /dev/null +++ b/examples/demo/info.cc @@ -0,0 +1,132 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "info.h" +#include "util.h" + +#include <poppler-glibmm/utility.h> + +namespace PGD +{ + +Info::Info(const Glib::RefPtr<Poppler::Document>& document) : + Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12), + m_Alignment(0.5, 0.5, 1, 1), + m_PermissionsHBoxTop(Gtk::ORIENTATION_HORIZONTAL, 6), + m_PermissionsHBoxBottom(Gtk::ORIENTATION_HORIZONTAL, 6), + m_PermissionsVBox(Gtk::ORIENTATION_VERTICAL, 0), + m_PrintCB("Print"), + m_CopyCB("Copy"), + m_ModifyCB("Modify"), + m_AddNotesCB("Add notes"), + m_FillFormsCB("Fill forms"), + m_ExtractContentsCB("Extract contents"), + m_AssembleCB("Assemble"), + m_HighResPrintCB("Print at high resolution") +{ + GEnumValue* enum_value = g_enum_get_value((GEnumClass*)g_type_class_ref(Glib::Value<Poppler::Backend>::value_type()), + Poppler::get_backend()); + m_VersionLabel.set_markup("<span weight='bold' size='larger'>Poppler " + Poppler::get_version() + + " (" + enum_value->value_name + ")</span>"); + pack_start(m_VersionLabel, false, false, 12); + + m_Frame.set_shadow_type(Gtk::SHADOW_NONE); + m_FrameLabel.set_markup("<b>Document properties</b>"); + m_Frame.set_label_widget(m_FrameLabel); + + m_Grid.set_column_spacing(6); + m_Grid.set_row_spacing(6); + + m_Grid.add_property("<b>Format:</b>", document->get_pdf_version_string()); + m_Grid.add_property("<b>Title:</b>", document->get_title()); + m_Grid.add_property("<b>Author:</b>", document->get_author()); + m_Grid.add_property("<b>Subject:</b>", document->get_subject()); + m_Grid.add_property("<b>Keywords:</b>", document->get_keywords()); + m_Grid.add_property("<b>Creator:</b>", document->get_creator()); + m_Grid.add_property("<b>Producer:</b>", document->get_producer()); + m_Grid.add_property("<b>Linearized:</b>", document->is_linearized() ? "Yes" : "No"); + m_Grid.add_property("<b>Creation Date:</b>", format_date(document->get_creation_date())); + m_Grid.add_property("<b>Modification Date:</b>", format_date(document->get_modification_date())); + + enum_value = g_enum_get_value((GEnumClass*)g_type_class_peek(Glib::Value<Poppler::PageMode>::value_type()), + document->get_page_mode()); + m_Grid.add_property("<b>Page Mode:</b>", enum_value->value_name); + enum_value = g_enum_get_value((GEnumClass*)g_type_class_peek(Glib::Value<Poppler::PageLayout>::value_type()), + document->get_page_layout()); + m_Grid.add_property("<b>Page Layout:</b>", enum_value->value_name); + + Glib::ustring perm_id, up_id; + if (document->get_id(perm_id, up_id)) + { + m_Grid.add_property("<b>Permanent ID:</b>", perm_id); + m_Grid.add_property("<b>Update ID:</b>", up_id); + } + + // Permissions + Poppler::Permissions permissions = document->get_permissions(); + + m_PrintCB.set_active(permissions & Poppler::PERMISSIONS_OK_TO_PRINT); + m_PermissionsHBoxTop.pack_start(m_PrintCB, false, true); + + m_CopyCB.set_active(permissions & Poppler::PERMISSIONS_OK_TO_COPY); + m_PermissionsHBoxTop.pack_start(m_CopyCB, false, true); + + m_ModifyCB.set_active(permissions & Poppler::PERMISSIONS_OK_TO_MODIFY); + m_PermissionsHBoxTop.pack_start(m_ModifyCB, false, true); + + m_AddNotesCB.set_active(permissions & Poppler::PERMISSIONS_OK_TO_ADD_NOTES); + m_PermissionsHBoxTop.pack_start(m_AddNotesCB, false, true); + + m_FillFormsCB.set_active(permissions & Poppler::PERMISSIONS_OK_TO_FILL_FORM); + m_PermissionsHBoxTop.pack_start(m_FillFormsCB, false, true); + + m_PermissionsVBox.pack_start(m_PermissionsHBoxTop, false, true); + + m_ExtractContentsCB.set_active(permissions & Poppler::PERMISSIONS_OK_TO_EXTRACT_CONTENTS); + m_PermissionsHBoxBottom.pack_start(m_ExtractContentsCB, false, true); + + m_AssembleCB.set_active(permissions & Poppler::PERMISSIONS_OK_TO_ASSEMBLE); + m_PermissionsHBoxBottom.pack_start(m_AssembleCB, false, true); + + m_HighResPrintCB.set_active(permissions & Poppler::PERMISSIONS_OK_TO_PRINT_HIGH_RESOLUTION); + m_PermissionsHBoxBottom.pack_start(m_HighResPrintCB, false, true); + + m_PermissionsVBox.pack_start(m_PermissionsHBoxBottom, false, true); + + m_Grid.add_property_with_custom_widget("<b>Permissions:</b>", m_PermissionsVBox); + + // Metadata + m_MetadataWin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + m_MetadataView.set_editable(false); + m_MetadataView.get_buffer()->set_text(document->get_metadata()); + m_MetadataWin.add(m_MetadataView); + m_MetadataWin.set_hexpand(); + m_MetadataWin.set_vexpand(); + m_Grid.add_property_with_custom_widget("<b>Metadata:</b>", m_MetadataWin); + + // TODO: view_prefs + + m_Alignment.set_padding(5, 5, 12, 5); + m_Alignment.add(m_Grid); + m_Frame.add(m_Alignment); + pack_start(m_Frame, true, true, 0); + + show_all(); +} + +} diff --git a/examples/demo/info.h b/examples/demo/info.h new file mode 100644 index 0000000..13f1e10 --- /dev/null +++ b/examples/demo/info.h @@ -0,0 +1,57 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _INFO_H_ +#define _INFO_H_ + +#include "property-grid.h" + +#include <poppler-glibmm/document.h> +#include <gtkmm/box.h> +#include <gtkmm/label.h> +#include <gtkmm/frame.h> +#include <gtkmm/alignment.h> +#include <gtkmm/checkbutton.h> +#include <gtkmm/scrolledwindow.h> +#include <gtkmm/textview.h> + +namespace PGD +{ + +class Info : public Gtk::Box +{ + public: + Info(const Glib::RefPtr<Poppler::Document>& document); + + private: + Gtk::Label m_VersionLabel, m_FrameLabel; + Gtk::Frame m_Frame; + Gtk::Alignment m_Alignment; + PropertyGrid m_Grid; + + Gtk::Box m_PermissionsHBoxTop, m_PermissionsHBoxBottom, m_PermissionsVBox; + Gtk::CheckButton m_PrintCB, m_CopyCB, m_ModifyCB, m_AddNotesCB, m_FillFormsCB, + m_ExtractContentsCB, m_AssembleCB, m_HighResPrintCB; + + Gtk::ScrolledWindow m_MetadataWin; + Gtk::TextView m_MetadataView; +}; + +} + +#endif // _INFO_H_ diff --git a/examples/demo/layers.cc b/examples/demo/layers.cc new file mode 100644 index 0000000..38a0900 --- /dev/null +++ b/examples/demo/layers.cc @@ -0,0 +1,214 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "layers.h" + +#include <gtkmm/treestore.h> +#include <gtkmm/liststore.h> +#include <glibmm/markup.h> + +namespace PGD +{ + +LayersViewer::LayersViewer(const Glib::RefPtr<Poppler::Document>& document) : + Gtk::Box(Gtk::ORIENTATION_VERTICAL, 6), + m_Document(document), + m_Page(0), + m_HBoxTop(Gtk::ORIENTATION_HORIZONTAL, 6), + m_PageLabel("Page:") +{ + int n_pages = m_Document->get_n_pages(); + m_PageSelector.set_range(1, n_pages); + m_PageSelector.set_increments(1, 10); + m_PageSelector.set_numeric(); + m_PageSelector.signal_value_changed().connect(sigc::mem_fun(*this, &LayersViewer::page_selector_changed)); + m_PageNumLabel.set_text(Glib::ustring::compose("of %1", n_pages)); + + m_HBoxTop.pack_start(m_PageLabel, false, true); + m_HBoxTop.pack_start(m_PageSelector, false, true); + m_HBoxTop.pack_start(m_PageNumLabel, false, true); + + m_DrawingArea.signal_draw().connect(sigc::mem_fun(*this, &LayersViewer::drawing_area_draw)); + m_ScrolledWin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + m_ScrolledWin.add(m_DrawingArea); + + pack_start(m_HBoxTop, false, true); + pack_start(m_ScrolledWin, true, true); +} + +void LayersViewer::page_selector_changed() +{ + m_Page = m_PageSelector.get_value() - 1; + queue_redraw(); +} + +void LayersViewer::queue_redraw() +{ + m_Surface.clear(); + m_DrawingArea.queue_draw(); +} + +bool LayersViewer::drawing_area_draw(const Cairo::RefPtr<Cairo::Context>& cr) +{ + if (!m_Surface) + { + Glib::RefPtr<Poppler::Page> page = m_Document->get_page(m_Page); + if (!page) return false; + + double width, height; + page->get_size(width, height); + m_DrawingArea.set_size_request(width, height); + + + m_Surface = Cairo::ImageSurface::create(Cairo::FORMAT_RGB24, width, height); + Cairo::RefPtr<Cairo::Context> cr_tmp = Cairo::Context::create(m_Surface); + + cr_tmp->save(); + cr_tmp->set_source_rgb(1.0, 1.0, 1.0); + cr_tmp->rectangle(0.0, 0.0, width, height); + cr_tmp->fill(); + cr_tmp->restore(); + + cr_tmp->save(); + page->render(cr_tmp); + cr_tmp->restore(); + } + + cr->set_source(m_Surface, 0, 0); + cr->paint(); + + return true; +} + +Layers::Layers(const Glib::RefPtr<Poppler::Document>& document) : + Gtk::Paned(Gtk::ORIENTATION_HORIZONTAL), + m_Document(document), + m_Viewer(document), + m_TitleCell(), + m_TitleColumn("Title", m_TitleCell) +{ + m_ScrolledWin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + + Poppler::LayersIter iter = m_Document->layers_iter_new(); + if (iter) + { + m_LayerStore = Gtk::TreeStore::create(m_StoreColumns); + build_tree(m_LayerStore->children(), iter); + } + else + { + m_LayerStore = Gtk::ListStore::create(m_StoreColumns); + Gtk::TreeRow tree_row = *(Glib::RefPtr<Gtk::ListStore>::cast_static(m_LayerStore)->append()); + tree_row[m_StoreColumns.m_Title] = + "<span size=\"larger\" style=\"italic\">Document does not contain layers</span>"; + } + + m_TreeView.set_model(m_LayerStore); + m_TitleCell.property_ellipsize() = Pango::ELLIPSIZE_END; + m_TitleColumn.add_attribute(m_TitleCell.property_markup(), m_StoreColumns.m_Title); + m_TitleColumn.set_expand(); + m_TreeView.append_column(m_TitleColumn); + + if (iter) + { + m_TreeView.insert_column("Show/Hide", m_StoreColumns.m_Visibility, 1); + Gtk::TreeViewColumn* sh_column = m_TreeView.get_column(1); + Gtk::CellRendererToggle* sh_cell = static_cast<Gtk::CellRendererToggle*>(m_TreeView.get_column_cell_renderer(1)); + sh_column->add_attribute(sh_cell->property_activatable(), m_StoreColumns.m_Enable); + sh_column->add_attribute(sh_cell->property_visible(), m_StoreColumns.m_ShowToggle); + sh_cell->signal_toggled().connect(sigc::mem_fun(*this, &Layers::visibility_changed)); + } + + m_TreeView.get_selection()->set_mode(Gtk::SELECTION_NONE); + + m_ScrolledWin.add(m_TreeView); + + add1(m_ScrolledWin); + add2(m_Viewer); + + set_position(150); + + show_all(); +} + +void Layers::build_tree(const Gtk::TreeModel::Children& parent, const Poppler::LayersIter &iter) +{ + do + { + Glib::ustring markup; + bool visible; + int rb_group = 0; + + Glib::RefPtr<Poppler::Layer> layer = iter.get_layer(); + if (layer) + { + markup = Glib::Markup::escape_text(layer->get_title()); + visible = layer->is_visible(); + rb_group = layer->get_radio_button_group_id(); + } + else + { + markup = Glib::Markup::escape_text(iter.get_title()); + visible = false; + } + + Gtk::TreeRow tree_row = *(Glib::RefPtr<Gtk::TreeStore>::cast_static(m_LayerStore)->append(parent)); + tree_row[m_StoreColumns.m_Title] = markup; + tree_row[m_StoreColumns.m_Visibility] = visible; + tree_row[m_StoreColumns.m_Enable] = true; // FIXME + tree_row[m_StoreColumns.m_ShowToggle] = layer; + tree_row[m_StoreColumns.m_RBGroup] = rb_group; + tree_row[m_StoreColumns.m_Layer] = layer; + + Poppler::LayersIter child = iter.get_child(); + if (child) build_tree(tree_row.children(), child); + } while (iter.next()); +} + +void Layers::visibility_changed(const Glib::ustring& path) +{ + Gtk::TreeIter iter = m_LayerStore->get_iter(path); + (*iter)[m_StoreColumns.m_Visibility] = !bool((*iter)[m_StoreColumns.m_Visibility]); + Glib::RefPtr<Poppler::Layer> layer = (*iter)[m_StoreColumns.m_Layer]; + if ((*iter)[m_StoreColumns.m_Visibility]) + { + layer->show(); + int rb_group = layer->get_radio_button_group_id(); + if (rb_group) m_LayerStore->foreach_iter(sigc::bind(sigc::mem_fun(*this, &Layers::clear_rb_group), rb_group)); + + } + else layer->hide(); + + if (layer->is_parent()) m_LayerStore->foreach_iter(sigc::bind(sigc::mem_fun(*this, &Layers::update_kids), iter)); + m_Viewer.queue_redraw(); +} + +bool Layers::clear_rb_group(const Gtk::TreeIter& iter, int rb_group) +{ + if ((*iter)[m_StoreColumns.m_RBGroup] == rb_group) (*iter)[m_StoreColumns.m_Visibility] = false; + return false; +} + +bool Layers::update_kids(const Gtk::TreeIter& iter, const Gtk::TreeIter& parent) +{ + if (Glib::RefPtr<Gtk::TreeStore>::cast_static(m_LayerStore)->is_ancestor(parent, iter)) + (*iter)[m_StoreColumns.m_Visibility] = bool((*parent)[m_StoreColumns.m_Visibility]); + return false; +} + +} diff --git a/examples/demo/layers.h b/examples/demo/layers.h new file mode 100644 index 0000000..82c420e --- /dev/null +++ b/examples/demo/layers.h @@ -0,0 +1,98 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _LAYERS_H_ +#define _LAYERS_H_ + +#include "action-view.h" + +#include <poppler-glibmm/document.h> +#include <gtkmm/box.h> +#include <gtkmm/drawingarea.h> +#include <gtkmm/label.h> +#include <gtkmm/spinbutton.h> +#include <gtkmm/scrolledwindow.h> +#include <gtkmm/paned.h> +#include <gtkmm/treeview.h> + +namespace PGD +{ + +class LayersViewer : public Gtk::Box +{ + public: + LayersViewer(const Glib::RefPtr<Poppler::Document>& document); + void queue_redraw(); + + private: + void page_selector_changed(); + bool drawing_area_draw(const Cairo::RefPtr<Cairo::Context>& cr); + + const Glib::RefPtr<Poppler::Document> m_Document; + int m_Page; + Cairo::RefPtr<Cairo::ImageSurface> m_Surface; + bool m_RecreateSurface; + + Gtk::Box m_HBoxTop; + Gtk::Label m_PageLabel, m_PageNumLabel; + Gtk::SpinButton m_PageSelector; + Gtk::DrawingArea m_DrawingArea; + Gtk::ScrolledWindow m_ScrolledWin; +}; + +class Layers : public Gtk::Paned +{ + public: + Layers(const Glib::RefPtr<Poppler::Document>& document); + + private: + void build_tree(const Gtk::TreeModel::Children& parent, const Poppler::LayersIter &iter); + void selection_changed(); + void visibility_changed(const Glib::ustring& path); + bool clear_rb_group(const Gtk::TreeIter& iter, int rb_group); + bool update_kids(const Gtk::TreeIter& iter, const Gtk::TreeIter& parent); + + const Glib::RefPtr<Poppler::Document> m_Document; + + class ModelColumns : public Gtk::TreeModel::ColumnRecord + { + public: + ModelColumns() { add(m_Title); add(m_Visibility); add(m_Enable); + add(m_ShowToggle); add(m_RBGroup); add(m_Layer); } + + Gtk::TreeModelColumn<Glib::ustring> m_Title; + Gtk::TreeModelColumn<bool> m_Visibility; + Gtk::TreeModelColumn<bool> m_Enable; + Gtk::TreeModelColumn<bool> m_ShowToggle; + Gtk::TreeModelColumn<int> m_RBGroup; + Gtk::TreeModelColumn< Glib::RefPtr<Poppler::Layer> > m_Layer; + }; + + Gtk::ScrolledWindow m_ScrolledWin; + LayersViewer m_Viewer; + + ModelColumns m_StoreColumns; + Gtk::TreeView m_TreeView; + Glib::RefPtr<Gtk::TreeModel> m_LayerStore; + Gtk::CellRendererText m_TitleCell; + Gtk::TreeViewColumn m_TitleColumn; +}; + +} + +#endif // _LAYERS_H_ diff --git a/examples/demo/links.cc b/examples/demo/links.cc new file mode 100644 index 0000000..c55ab52 --- /dev/null +++ b/examples/demo/links.cc @@ -0,0 +1,135 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "links.h" +#include "property-grid.h" + +#include <gtkmm/textview.h> +#include <glibmm/timer.h> +#include <iomanip> + +namespace PGD +{ + +Links::Links(const Glib::RefPtr<Poppler::Document>& document) : + Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12), + m_Document(document), + m_Page(0), + m_HBoxTop(Gtk::ORIENTATION_HORIZONTAL, 6), + m_PageLabel("Page:"), + m_GetButton("Get Links"), + m_HPaned(Gtk::ORIENTATION_HORIZONTAL), + m_ActionView(document) +{ + int n_pages = m_Document->get_n_pages(); + m_PageSelector.set_range(1, n_pages); + m_PageSelector.set_increments(1, 10); + m_PageSelector.set_numeric(); + m_PageSelector.signal_value_changed().connect(sigc::mem_fun(*this, &Links::page_selector_changed)); + m_PageNumLabel.set_text(Glib::ustring::compose("of %1", n_pages)); + + m_GetButton.signal_clicked().connect(sigc::mem_fun(*this, &Links::get_links)); + + m_HBoxTop.pack_start(m_PageLabel, false, true); + m_HBoxTop.pack_start(m_PageSelector, false, true); + m_HBoxTop.pack_start(m_PageNumLabel, false, true); + m_HBoxTop.pack_end(m_GetButton, false, false); + + m_TimerLabel.set_markup("<i>No links found</i>"); + m_TimerLabel.set_alignment(1.0, 0.5); + + m_ScrolledWin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + + m_LinkStore = Gtk::ListStore::create(m_StoreColumns); + m_TreeView.set_model(m_LinkStore); + + m_TreeView.append_column("Action Type", m_StoreColumns.m_ActionType); + m_TreeView.append_column_numeric("X1", m_StoreColumns.m_X1, "%.2f"); + m_TreeView.append_column_numeric("Y1", m_StoreColumns.m_Y1, "%.2f"); + m_TreeView.append_column_numeric("X2", m_StoreColumns.m_X2, "%.2f"); + m_TreeView.append_column_numeric("Y2", m_StoreColumns.m_Y2, "%.2f"); + + m_TreeView.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &Links::selection_changed)); + + m_ScrolledWin.add(m_TreeView); + + m_HPaned.add1(m_ScrolledWin); + m_HPaned.add2(m_ActionView); + m_HPaned.set_position(300); + + pack_start(m_HBoxTop, false, true); + pack_start(m_TimerLabel, false, true); + pack_start(m_HPaned, true, true); + + show_all(); +} + +void Links::page_selector_changed() +{ + m_Page = m_PageSelector.get_value() - 1; +} + +void Links::selection_changed() +{ + Gtk::TreeIter iter = m_TreeView.get_selection()->get_selected(); + if (iter) m_ActionView.set_action((*iter)[m_StoreColumns.m_Action]); + else m_ActionView.set_action(Poppler::Action()); +} + +void Links::get_links() +{ + m_LinkStore->clear(); + + m_ActionView.set_action(Poppler::Action()); + + Glib::RefPtr<Poppler::Page> page = m_Document->get_page(m_Page); + if (!page) return; + + Glib::Timer timer; + std::vector<Poppler::LinkMapping> mapping = page->get_link_mapping(); + timer.stop(); + + int n_links = mapping.size(); + + if (n_links > 0) + m_TimerLabel.set_markup(Glib::ustring::format("<i>", n_links, " links found in ", + std::fixed, std::setprecision(4), timer.elapsed(), " seconds</i>")); + else + m_TimerLabel.set_markup("<i>No links found</i>"); + + for (std::vector<Poppler::LinkMapping>::iterator lmapping = mapping.begin(); + lmapping != mapping.end(); ++lmapping) + { + Gtk::TreeRow tree_row = *(m_LinkStore->append()); + + Poppler::Action action = lmapping->get_action(); + GEnumValue* enum_value = g_enum_get_value((GEnumClass*)g_type_class_ref( + Glib::Value<Poppler::ActionType>::value_type()), action.get_action_type()); + tree_row[m_StoreColumns.m_ActionType] = enum_value->value_name; + + Poppler::Rectangle area = lmapping->get_area(); + tree_row[m_StoreColumns.m_X1] = area.get_x1(); + tree_row[m_StoreColumns.m_Y1] = area.get_y1(); + tree_row[m_StoreColumns.m_X2] = area.get_x2(); + tree_row[m_StoreColumns.m_Y2] = area.get_y2(); + + tree_row[m_StoreColumns.m_Action] = action; + } +} + +} diff --git a/examples/demo/links.h b/examples/demo/links.h new file mode 100644 index 0000000..449caa6 --- /dev/null +++ b/examples/demo/links.h @@ -0,0 +1,78 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _LINKS_H_ +#define _LINKS_H_ + +#include "action-view.h" + +#include <poppler-glibmm/document.h> +#include <gtkmm/box.h> +#include <gtkmm/label.h> +#include <gtkmm/button.h> +#include <gtkmm/spinbutton.h> +#include <gtkmm/scrolledwindow.h> +#include <gtkmm/paned.h> +#include <gtkmm/liststore.h> +#include <gtkmm/treeview.h> + +namespace PGD +{ + +class Links : public Gtk::Box +{ + public: + Links(const Glib::RefPtr<Poppler::Document>& document); + + private: + void page_selector_changed(); + void get_links(); + void selection_changed(); + + const Glib::RefPtr<Poppler::Document> m_Document; + int m_Page; + + class ModelColumns : public Gtk::TreeModel::ColumnRecord + { + public: + ModelColumns() { add(m_ActionType); add(m_X1); add(m_Y1); add(m_X2); add(m_Y2); add(m_Action); } + + Gtk::TreeModelColumn<Glib::ustring> m_ActionType; + Gtk::TreeModelColumn<double> m_X1; + Gtk::TreeModelColumn<double> m_Y1; + Gtk::TreeModelColumn<double> m_X2; + Gtk::TreeModelColumn<double> m_Y2; + Gtk::TreeModelColumn<Poppler::Action> m_Action; + }; + + Gtk::Box m_HBoxTop; + Gtk::Label m_PageLabel, m_PageNumLabel, m_TimerLabel; + Gtk::SpinButton m_PageSelector; + Gtk::Button m_GetButton; + Gtk::ScrolledWindow m_ScrolledWin; + Gtk::Paned m_HPaned; + ActionView m_ActionView; + + ModelColumns m_StoreColumns; + Gtk::TreeView m_TreeView; + Glib::RefPtr<Gtk::ListStore> m_LinkStore; +}; + +} + +#endif // _LINKS_H_ diff --git a/examples/demo/main.cc b/examples/demo/main.cc new file mode 100644 index 0000000..fdb72c7 --- /dev/null +++ b/examples/demo/main.cc @@ -0,0 +1,81 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "demo-window.h" +#include "auth-dialog.h" + +#include <gtkmm/application.h> +#include <glibmm/timer.h> +#include <poppler-glibmm/init.h> +#include <poppler-glibmm/document.h> +#include <poppler-glibmm/error.h> +#include <iostream> +#include <iomanip> + +int main (int argc, char **argv) +{ + if (argc != 2) + { + std::cout << "Usage: poppler-glibmm-demo file" << std::endl; + return 1; + } + + Poppler::init(); + + // Hack to work around a bug in recent versions of Gtk/Gtkmm + int _argc = 1; + char** _argv = &argv[0]; + Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(_argc, _argv, + "org.poppler-glibmm.demo", Gio::APPLICATION_HANDLES_OPEN); + + Glib::RefPtr<Gio::File> file = Gio::File::create_for_commandline_arg(argv[1]); + + Glib::RefPtr<Poppler::Document> document; + { + std::string password; + AuthDialog dialog(file->get_basename()); + do + { + password = dialog.GetPassword(); + Glib::Timer timer; + try + { + document = Poppler::Document::new_from_file(file->get_uri(), password); + } + catch (Poppler::Error exception) + { + continue; + } + catch (Glib::Error exception) + { + return 1; + } + timer.stop(); + std::cout << "Document successfully loaded in " + << std::fixed << std::setprecision(4) << timer.elapsed() << " seconds\n"; + } while (!document && dialog.run() == Gtk::RESPONSE_OK); + } + + if (!document) return 1; + + // Main window + DemoWindow window(document); + app->run(window); + + return 0; +} diff --git a/examples/demo/outline.cc b/examples/demo/outline.cc new file mode 100644 index 0000000..1b7ba10 --- /dev/null +++ b/examples/demo/outline.cc @@ -0,0 +1,123 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "outline.h" + +#include <glibmm/markup.h> + +namespace PGD +{ + +Outline::Outline(const Glib::RefPtr<Poppler::Document>& document) : + Gtk::Paned(Gtk::ORIENTATION_HORIZONTAL), + m_Document(document), + m_ActionView(document), + m_TitleCell(), + m_TitleColumn("Title", m_TitleCell) +{ + m_ScrolledWin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + + Poppler::IndexIter iter = m_Document->index_iter_new(); + + if (iter) + { + m_ActionStore = Gtk::TreeStore::create(m_StoreColumns); + build_tree(m_ActionStore->children(), iter); + } + else + { + m_ActionStore = Gtk::ListStore::create(m_StoreColumns); + Gtk::TreeRow tree_row = *(Glib::RefPtr<Gtk::ListStore>::cast_static(m_ActionStore)->append()); + tree_row[m_StoreColumns.m_Title] = + "<span size=\"larger\" style=\"italic\">Document does not contain an outline</span>"; + } + + m_TreeView.set_model(m_ActionStore); + m_TitleCell.property_ellipsize() = Pango::ELLIPSIZE_END; + m_TitleColumn.add_attribute(m_TitleCell.property_markup(), m_StoreColumns.m_Title); + m_TitleColumn.set_expand(); + m_TreeView.append_column(m_TitleColumn); + + Glib::RefPtr<Gtk::TreeSelection> selection = m_TreeView.get_selection(); + + if (iter) + { + m_TreeView.append_column("Action Type", m_StoreColumns.m_ActionType); + expand_open_links(m_ActionStore->children()); + selection->signal_changed().connect(sigc::mem_fun(*this, &Outline::selection_changed)); + + } + else selection->set_mode(Gtk::SELECTION_NONE); + + m_ScrolledWin.add(m_TreeView); + + add1(m_ScrolledWin); + add2(m_ActionView); + + set_position(300); + + show_all(); +} + +void Outline::build_tree(const Gtk::TreeModel::Children& parent, const Poppler::IndexIter &iter) +{ + do + { + Poppler::Action action = iter.get_action(); + if (!action) continue; + + if (action.get_action_type() == Poppler::ACTION_GOTO_DEST && + action.get_goto_dest_dest().get_dest_type() == Poppler::DEST_NAMED) + { + // TODO + } + + GEnumValue* enum_value = + g_enum_get_value((GEnumClass*)g_type_class_ref(Glib::Value<Poppler::ActionType>::value_type()), + action.get_action_type()); + + Gtk::TreeRow tree_row = *(Glib::RefPtr<Gtk::TreeStore>::cast_static(m_ActionStore)->append(parent)); + tree_row[m_StoreColumns.m_Title] = Glib::Markup::escape_text(action.get_title()); + tree_row[m_StoreColumns.m_ActionType] = enum_value->value_name; + tree_row[m_StoreColumns.m_Expand] = iter.is_open(); + tree_row[m_StoreColumns.m_Action] = action; + + Poppler::IndexIter child = iter.get_child(); + if (child) build_tree(tree_row.children(), child); + } while (iter.next()); +} + +void Outline::expand_open_links(const Gtk::TreeModel::Children& parent) +{ + for (Gtk::TreeIter iter = parent.begin(); iter != parent.end(); ++iter) + { + if ((*iter)[m_StoreColumns.m_Expand]) + m_TreeView.expand_row(m_ActionStore->get_path(iter), false); + + expand_open_links((*iter).children()); + } +} + +void Outline::selection_changed() +{ + Gtk::TreeIter iter = m_TreeView.get_selection()->get_selected(); + if (iter) m_ActionView.set_action((*iter)[m_StoreColumns.m_Action]); + else m_ActionView.set_action(Poppler::Action()); +} + +} diff --git a/examples/demo/outline.h b/examples/demo/outline.h new file mode 100644 index 0000000..d8ecc18 --- /dev/null +++ b/examples/demo/outline.h @@ -0,0 +1,68 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _OUTLINE_H_ +#define _OUTLINE_H_ + +#include "action-view.h" + +#include <poppler-glibmm/document.h> +#include <gtkmm/paned.h> +#include <gtkmm/scrolledwindow.h> +#include <gtkmm/liststore.h> +#include <gtkmm/treestore.h> +#include <gtkmm/treeview.h> + +namespace PGD +{ + +class Outline : public Gtk::Paned +{ + public: + Outline(const Glib::RefPtr<Poppler::Document>& document); + + private: + void build_tree(const Gtk::TreeModel::Children& parent, const Poppler::IndexIter &iter); + void expand_open_links(const Gtk::TreeModel::Children& parent); + void selection_changed(); + + const Glib::RefPtr<Poppler::Document> m_Document; + + class ModelColumns : public Gtk::TreeModel::ColumnRecord + { + public: + ModelColumns() { add(m_Title); add(m_ActionType); add(m_Expand); add(m_Action); } + + Gtk::TreeModelColumn<Glib::ustring> m_Title; + Gtk::TreeModelColumn<Glib::ustring> m_ActionType; + Gtk::TreeModelColumn<bool> m_Expand; + Gtk::TreeModelColumn<Poppler::Action> m_Action; + }; + + ActionView m_ActionView; + Gtk::ScrolledWindow m_ScrolledWin; + Gtk::TreeView m_TreeView; + ModelColumns m_StoreColumns; + Glib::RefPtr<Gtk::TreeModel> m_ActionStore; + Gtk::CellRendererText m_TitleCell; + Gtk::TreeViewColumn m_TitleColumn; +}; + +} + +#endif // _OUTLINE_H_ diff --git a/examples/demo/page-info.cc b/examples/demo/page-info.cc new file mode 100644 index 0000000..e086272 --- /dev/null +++ b/examples/demo/page-info.cc @@ -0,0 +1,171 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "page-info.h" + +#include <gtkmm/stock.h> +#include <iomanip> + +namespace PGD +{ + +PageInfo::PageInfo(const Glib::RefPtr<Poppler::Document>& document) : + Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12), + m_Document(document), + m_Page(0), + m_HBoxTop(Gtk::ORIENTATION_HORIZONTAL, 6), m_HBoxBottom(Gtk::ORIENTATION_HORIZONTAL, 6), + m_ThumbnailVBox(Gtk::ORIENTATION_VERTICAL, 6), + m_PropertiesAlignment(0.5, 0.5, 1, 1), m_ThumbnailAlignment(0.5, 0.5, 1, 1), + m_PageLabel("Page:"), + m_GetInfoButton("Get Info") +{ + int n_pages = m_Document->get_n_pages(); + m_PageSelector.set_range(1, n_pages); + m_PageSelector.set_increments(1, 10); + m_PageSelector.set_numeric(); + m_PageSelector.signal_value_changed().connect(sigc::mem_fun(*this, &PageInfo::page_selector_changed)); + m_PageNumLabel.set_text(Glib::ustring::compose("of %1", n_pages)); + m_GetInfoButton.signal_clicked().connect(sigc::mem_fun(*this, &PageInfo::get_info)); + + m_HBoxTop.pack_start(m_PageLabel, false, true); + m_HBoxTop.pack_start(m_PageSelector, false, true); + m_HBoxTop.pack_start(m_PageNumLabel, false, true); + m_HBoxTop.pack_end(m_GetInfoButton, false, false); + + // Page Properties + m_PropertiesFrame.set_shadow_type(Gtk::SHADOW_NONE); + m_PropertiesFrameLabel.set_markup("<b>Page properties</b>"); + m_PropertiesFrame.set_label_widget(m_PropertiesFrameLabel); + + m_Grid.set_column_spacing(6); + m_Grid.set_row_spacing(6); + + m_Grid.add_property_with_value_widget("<b>Page Index:</b>", m_Index, ""); + m_Grid.add_property_with_value_widget("<b>Page Label:</b>", m_Label, ""); + m_Grid.add_property_with_value_widget("<b>Page Size:</b>", m_Size, ""); + m_Grid.add_property_with_value_widget("<b>Page Duration:</b>", m_Duration, ""); + + // Page Thumbnail + m_ThumbnailFrame.set_shadow_type(Gtk::SHADOW_NONE); + m_ThumbnailFrame.set_label_align(0.5, 0.5); + m_ThumbnailFrameLabel.set_markup("<b>Page Thumbnail</b>"); + m_ThumbnailFrame.set_label_widget(m_ThumbnailFrameLabel); + + m_ThumbnailSize.set_alignment(0.5, 0.5); + m_ThumbnailVBox.pack_start(m_Thumbnail, true, true); + m_ThumbnailVBox.pack_start(m_ThumbnailSize, true, true); + + m_PropertiesAlignment.set_padding(5, 5, 12, 5); + m_PropertiesAlignment.add(m_Grid); + m_PropertiesFrame.add(m_PropertiesAlignment); + m_HBoxBottom.pack_start(m_PropertiesFrame, true, true); + + m_ThumbnailAlignment.set_padding(5, 5, 12, 5); + m_ThumbnailAlignment.add(m_ThumbnailVBox); + m_ThumbnailFrame.add(m_ThumbnailAlignment); + m_HBoxBottom.pack_start(m_ThumbnailFrame, true, true); + + pack_start(m_HBoxTop, false, true); + pack_start(m_HBoxBottom, false, true); + + show_all(); +} + +void PageInfo::page_selector_changed() +{ + m_Page = m_PageSelector.get_value() - 1; +} + +void PageInfo::get_info() +{ + Glib::RefPtr<Poppler::Page> page = m_Document->get_page(m_Page); + + if (page) + { + m_Index->set_text(Glib::ustring::format(page->get_index())); + m_Label->set_text(page->get_label()); + + double width, height; + page->get_size(width, height); + m_Size->set_text(Glib::ustring::format(std::fixed, std::setprecision(2), width, " x ", height)); + + m_Duration->set_text(Glib::ustring::format(std::fixed, std::setprecision(2), page->get_duration(), " seconds")); + } + else + { + m_Index->set_text(""); + m_Label->set_text(""); + m_Size->set_text(""); + m_Duration->set_text(""); + } + + Cairo::RefPtr<Cairo::ImageSurface> thumbnail = page ? page->get_thumbnail() : Cairo::RefPtr<Cairo::ImageSurface>(); + if (thumbnail) + { + int width, height; + page->get_thumbnail_size(width, height); + m_ThumbnailSize.set_text(Glib::ustring::format(width, " x ", height)); + + width = thumbnail->get_width(); + height = thumbnail->get_height(); + Cairo::Format surface_format = thumbnail->get_format(); + bool has_alpha = (surface_format == Cairo::FORMAT_ARGB32); + + Glib::RefPtr<Gdk::Pixbuf> pixbuf = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, true, 8, width, height); + int pixbuf_n_channels = pixbuf->get_n_channels(); + int pixbuf_rowstride = pixbuf->get_rowstride(); + guint8* pixbuf_pixels = pixbuf->get_pixels(); + + Cairo::RefPtr<Cairo::ImageSurface> image = Cairo::ImageSurface::create(pixbuf_pixels, + surface_format, width, height, pixbuf_rowstride); + Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(image); + cr->set_source(thumbnail, 0, 0); + + if (has_alpha) cr->mask(thumbnail, 0, 0); + else cr->paint(); + + for (int y = 0; y < height; ++y) + { + guint8* p = pixbuf_pixels + y * pixbuf_rowstride; + + for (int x = 0; x < width; ++x) + { +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + std::swap(p[0], p[2]); + p[3] = (has_alpha) ? p[3] : 0xff; +#else + guint8 tmp = p[0]; + p[0] = (has_alpha) ? p[3] : 0xff; + p[3] = p[2]; + p[2] = p[1]; + p[1] = tmp; +#endif + p += pixbuf_n_channels; + } + } + + m_Thumbnail.set(pixbuf); + } + else + { + m_ThumbnailSize.set_markup("<i>No thumbnail found</i>"); + m_Thumbnail.set(Gtk::Stock::MISSING_IMAGE, Gtk::ICON_SIZE_DIALOG); + } +} + +} diff --git a/examples/demo/page-info.h b/examples/demo/page-info.h new file mode 100644 index 0000000..041c697 --- /dev/null +++ b/examples/demo/page-info.h @@ -0,0 +1,64 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _PAGE_H_ +#define _PAGE_H_ + +#include "property-grid.h" + +#include <poppler-glibmm/document.h> +#include <gtkmm/box.h> +#include <gtkmm/frame.h> +#include <gtkmm/alignment.h> +#include <gtkmm/label.h> +#include <gtkmm/spinbutton.h> +#include <gtkmm/button.h> + +namespace PGD +{ + +class PageInfo : public Gtk::Box +{ + public: + PageInfo(const Glib::RefPtr<Poppler::Document>& document); + + private: + void page_selector_changed(); + void get_info(); + + const Glib::RefPtr<Poppler::Document> m_Document; + int m_Page; + Gtk::Label* m_Index; + Gtk::Label* m_Label; + Gtk::Label* m_Size; + Gtk::Label* m_Duration; + Gtk::Image m_Thumbnail; + Gtk::Label m_ThumbnailSize; + + Gtk::Box m_HBoxTop, m_HBoxBottom, m_ThumbnailVBox; + Gtk::Frame m_PropertiesFrame, m_ThumbnailFrame; + PGD::PropertyGrid m_Grid; + Gtk::Alignment m_PropertiesAlignment, m_ThumbnailAlignment; + Gtk::Label m_PageLabel, m_PageNumLabel, m_PropertiesFrameLabel, m_ThumbnailFrameLabel; + Gtk::SpinButton m_PageSelector; + Gtk::Button m_GetInfoButton; +}; + +} + +#endif // _PAGE_H_ diff --git a/examples/demo/print.cc b/examples/demo/print.cc new file mode 100644 index 0000000..ccf6e4d --- /dev/null +++ b/examples/demo/print.cc @@ -0,0 +1,114 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "print.h" + +#include <gtkmm/messagedialog.h> + +namespace PGD +{ + +const char* Print::m_PrintOptions = "pgd-print-options"; + +Print::Print(const Glib::RefPtr<Poppler::Document>& document) : + Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12), + m_Document(document), + m_HBox(Gtk::ORIENTATION_HORIZONTAL, 6), + m_PrintButton("Print...") +{ + m_PrintButton.signal_clicked().connect(sigc::mem_fun(*this, &Print::print)); + m_HBox.pack_end(m_PrintButton, false, false); + pack_start(m_HBox, false, true); + show_all(); +} + +void Print::print() +{ + m_PrintOp = Gtk::PrintOperation::create(); + m_PrintOp->set_custom_tab_label("PDF Options"); + m_PrintOp->signal_begin_print().connect(sigc::mem_fun(*this, &Print::begin_print)); + m_PrintOp->signal_draw_page().connect(sigc::mem_fun(*this, &Print::draw_page)); + m_PrintOp->signal_create_custom_widget().connect(sigc::mem_fun(*this, &Print::create_custom_widget)); + m_PrintOp->signal_custom_widget_apply().connect(sigc::mem_fun(*this, &Print::custom_widget_apply)); + try + { + m_PrintOp->run(); + } + catch (Glib::Error exception) + { + Gtk::MessageDialog dialog(exception.what(), false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE); + dialog.run(); + } +} + +void Print::begin_print(const Glib::RefPtr<Gtk::PrintContext>& /* context */) +{ + m_PrintOp->set_n_pages(m_Document->get_n_pages()); +} + +void Print::draw_page(const Glib::RefPtr<Gtk::PrintContext>& context, int page_nr) +{ + Glib::RefPtr<Poppler::Page> page = m_Document->get_page(page_nr); + if (!page) return; + + Poppler::PrintFlags flags = Poppler::PrintFlags(0); + int options = m_PrintOp->get_print_settings()->get_int_with_default(m_PrintOptions, PGD::PRINT_DOCUMENT_MARKUPS); + switch (options) + { + case PGD::PRINT_DOCUMENT: + flags |= Poppler::PRINT_DOCUMENT; + break; + case PGD::PRINT_DOCUMENT_MARKUPS: + flags |= Poppler::PRINT_MARKUP_ANNOTS; + break; + case PGD::PRINT_DOCUMENT_STAMPS: + flags |= Poppler::PRINT_STAMP_ANNOTS_ONLY; + break; + } + + Cairo::RefPtr<Cairo::Context> cr = context->get_cairo_context(); + page->render_for_printing_with_options(cr, flags); +} + +Gtk::Widget* Print::create_custom_widget() +{ + Gtk::Box* hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL)); + hbox->set_border_width(12); + hbox->pack_start(*Gtk::manage(new Gtk::Label("Print: ")), false, false); + + Gtk::ComboBoxText* combo; + hbox->pack_start(*Gtk::manage(combo = new Gtk::ComboBoxText), false, false); + combo->append("Document"); + combo->append("Document and markup"); + combo->append("Document and stamps"); + + int options = m_PrintOp->get_print_settings()->get_int_with_default(m_PrintOptions, PGD::PRINT_DOCUMENT_MARKUPS); + combo->set_active(options); + + hbox->show_all(); + + return hbox; +} + +void Print::custom_widget_apply(Gtk::Widget* widget) +{ + Gtk::ComboBoxText* combo = static_cast<Gtk::ComboBoxText*>(widget); + m_PrintOp->get_print_settings()->set_int(m_PrintOptions, combo->get_active_row_number()); +} + +} diff --git a/examples/demo/print.h b/examples/demo/print.h new file mode 100644 index 0000000..5561939 --- /dev/null +++ b/examples/demo/print.h @@ -0,0 +1,61 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _PRINT_H_ +#define _PRINT_H_ + +#include <poppler-glibmm/document.h> +#include <gtkmm/box.h> +#include <gtkmm/button.h> +#include <gtkmm/comboboxtext.h> +#include <gtkmm/printoperation.h> + +namespace PGD +{ + +typedef enum +{ + PRINT_DOCUMENT, + PRINT_DOCUMENT_MARKUPS, + PRINT_DOCUMENT_STAMPS +} PrintOptions; + +class Print : public Gtk::Box +{ + public: + Print(const Glib::RefPtr<Poppler::Document>& document); + + private: + void print(); + void begin_print(const Glib::RefPtr<Gtk::PrintContext>& context); + void draw_page(const Glib::RefPtr<Gtk::PrintContext>& context, int page_nr); + Gtk::Widget* create_custom_widget(); + void custom_widget_apply(Gtk::Widget* widget); + + const Glib::RefPtr<Poppler::Document> m_Document; + + Gtk::Box m_HBox; + Gtk::Button m_PrintButton; + Glib::RefPtr<Gtk::PrintOperation> m_PrintOp; + + static const char* m_PrintOptions; +}; + +} + +#endif // _PRINT_H_ diff --git a/examples/demo/property-grid.cc b/examples/demo/property-grid.cc new file mode 100644 index 0000000..f665d79 --- /dev/null +++ b/examples/demo/property-grid.cc @@ -0,0 +1,70 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "property-grid.h" + +#include <gtkmm/label.h> + +namespace PGD +{ + +PropertyGrid::PropertyGrid() : + m_Row(0) +{ +} + +void PropertyGrid::add_property_with_custom_widget(const Glib::ustring& markup, Gtk::Widget& widget) +{ + Gtk::Label *label = Gtk::manage(new Gtk::Label()); + label->set_alignment(0.0, 0.5); + label->set_markup(markup); + attach(*label, 0, m_Row, 1, 1); + label->show(); + + attach(widget, 1, m_Row, 1, 1); + widget.show(); + + ++m_Row; +} + +void PropertyGrid::add_property_with_value_widget(const Glib::ustring& markup, Gtk::Label*& value_widget, + const Glib::ustring& value) +{ + Gtk::Label *label = value_widget = Gtk::manage(new Gtk::Label(value)); + label->set_alignment(0.0, 0.5); + label->set_selectable(); + label->set_ellipsize(Pango::ELLIPSIZE_END); + + add_property_with_custom_widget(markup, *label); +} + +void PropertyGrid::add_property(const Glib::ustring& markup, const Glib::ustring& value) +{ + Gtk::Label *label; + add_property_with_value_widget(markup, label, value); +} + +void PropertyGrid::add_row_widget(Gtk::Widget& widget) +{ + attach(widget, 0, m_Row, 2, 1); + widget.show(); + + ++m_Row; +} + +} diff --git a/examples/demo/property-grid.h b/examples/demo/property-grid.h new file mode 100644 index 0000000..7494738 --- /dev/null +++ b/examples/demo/property-grid.h @@ -0,0 +1,45 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + + +#ifndef _PGD_GRID_H_ +#define _PGD_GRID_H_ + +#include <gtkmm/grid.h> + +namespace PGD +{ + +class PropertyGrid : public Gtk::Grid +{ + public: + PropertyGrid(); + + void add_property_with_custom_widget(const Glib::ustring& markup, Gtk::Widget& widget); + void add_property_with_value_widget(const Glib::ustring& markup, Gtk::Label*& value_widget, + const Glib::ustring& value); + void add_property(const Glib::ustring& markup, const Glib::ustring& value); + void add_row_widget(Gtk::Widget& widget); + + private: + int m_Row; +}; + +} + +#endif // _PGD_GRID_H_ diff --git a/examples/demo/render.cc b/examples/demo/render.cc new file mode 100644 index 0000000..02cc22e --- /dev/null +++ b/examples/demo/render.cc @@ -0,0 +1,251 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "render.h" + +#include <glibmm/timer.h> + +namespace PGD +{ + +Render::Render(const Glib::RefPtr<Poppler::Document>& document) : + Gtk::Box(Gtk::ORIENTATION_VERTICAL, 6), + m_Document(document), + m_Scale(1.0), m_Page(0), m_Rotate(0), + m_PropertiesVBox(Gtk::ORIENTATION_VERTICAL, 6), + m_HBoxTop(Gtk::ORIENTATION_HORIZONTAL, 12), m_HBoxBottom(Gtk::ORIENTATION_HORIZONTAL, 12), + m_PageHBox(Gtk::ORIENTATION_HORIZONTAL, 6), m_ScaleHBox(Gtk::ORIENTATION_HORIZONTAL, 6), + m_RotateHBox(Gtk::ORIENTATION_HORIZONTAL, 6), + m_SliceXHBox(Gtk::ORIENTATION_HORIZONTAL, 6), m_SliceYHBox(Gtk::ORIENTATION_HORIZONTAL, 6), + m_SliceWidthHBox(Gtk::ORIENTATION_HORIZONTAL, 6), m_SliceHeightHBox(Gtk::ORIENTATION_HORIZONTAL, 6), + m_PageLabel("Page:"), m_ScaleLabel("Scale:"), m_RotateLabel("Rotate:"), + m_SliceXLabel("x:"), m_SliceYLabel("y:"), + m_SliceWidthLabel("width:"), m_SliceHeightLabel("height:"), + m_ScaleSelector(0.1, 1), + m_PrintingSelector("Printing"), + m_RenderButton("Render") +{ + int n_pages = m_Document->get_n_pages(); + m_PageSelector.set_range(1, n_pages); + m_PageSelector.set_increments(1, 10); + m_PageSelector.set_numeric(); + m_PageSelector.signal_value_changed().connect(sigc::mem_fun(*this, &Render::page_selector_changed)); + m_PageNumLabel.set_text(Glib::ustring::compose("of %1", n_pages)); + m_PageHBox.pack_start(m_PageLabel, true, true); + m_PageHBox.pack_start(m_PageSelector, true, true); + m_PageHBox.pack_start(m_PageNumLabel, true, true); + m_HBoxTop.pack_start(m_PageHBox, false, true); + + m_ScaleSelector.set_range(0.0, 10.0); + m_ScaleSelector.set_increments(0.1, 1.0); + m_ScaleSelector.set_value(1.0); + m_ScaleSelector.set_numeric(); + m_ScaleSelector.signal_value_changed().connect(sigc::mem_fun(*this, &Render::scale_selector_changed)); + m_ScaleHBox.pack_start(m_ScaleLabel, true, true); + m_ScaleHBox.pack_start(m_ScaleSelector, true, true); + m_HBoxTop.pack_start(m_ScaleHBox, false, true); + + m_RotateSelector.append("0"); + m_RotateSelector.append("90"); + m_RotateSelector.append("180"); + m_RotateSelector.append("270"); + m_RotateSelector.set_active(0); + m_RotateSelector.signal_changed().connect(sigc::mem_fun(*this, &Render::rotate_selector_changed)); + m_RotateHBox.pack_start(m_RotateLabel, true, true); + m_RotateHBox.pack_start(m_RotateSelector, true, true); + m_HBoxTop.pack_start(m_RotateHBox, false, true); + + m_PrintingSelector.signal_toggled().connect(sigc::mem_fun(*this, &Render::printing_selector_changed)); + m_HBoxTop.pack_start(m_PrintingSelector, false, true); + + m_SliceXSelector.set_increments(1, 10); + m_SliceXSelector.set_numeric(); + m_SliceXSelector.signal_value_changed().connect(sigc::mem_fun(*this, &Render::slice_selector_changed)); + m_SliceXHBox.pack_start(m_SliceXLabel, true, true); + m_SliceXHBox.pack_start(m_SliceXSelector, true, true); + m_HBoxBottom.pack_start(m_SliceXHBox, false, true); + + m_SliceYSelector.set_increments(1, 10); + m_SliceYSelector.set_numeric(); + m_SliceYSelector.signal_value_changed().connect(sigc::mem_fun(*this, &Render::slice_selector_changed)); + m_SliceYHBox.pack_start(m_SliceYLabel, true, true); + m_SliceYHBox.pack_start(m_SliceYSelector, true, true); + m_HBoxBottom.pack_start(m_SliceYHBox, false, true); + + m_SliceWidthSelector.set_increments(1, 10); + m_SliceWidthSelector.set_numeric(); + m_SliceWidthSelector.signal_value_changed().connect(sigc::mem_fun(*this, &Render::slice_selector_changed)); + m_SliceWidthHBox.pack_start(m_SliceWidthLabel, true, true); + m_SliceWidthHBox.pack_start(m_SliceWidthSelector, true, true); + m_HBoxBottom.pack_start(m_SliceWidthHBox, false, true); + + m_SliceHeightSelector.set_increments(1, 10); + m_SliceHeightSelector.set_numeric(); + m_SliceHeightSelector.signal_value_changed().connect(sigc::mem_fun(*this, &Render::slice_selector_changed)); + m_SliceHeightHBox.pack_start(m_SliceHeightLabel, true, true); + m_SliceHeightHBox.pack_start(m_SliceHeightSelector, true, true); + m_HBoxBottom.pack_start(m_SliceHeightHBox, false, true); + + slice_selector_setup(); + + m_RenderButton.signal_clicked().connect(sigc::mem_fun(*this, &Render::start)); + m_HBoxBottom.pack_end(m_RenderButton, false, true); + + m_TimerLabel.set_markup("<i>No page rendered</i>"); + m_TimerLabel.set_alignment(1.0, 0.5); + + m_PropertiesVBox.pack_start(m_HBoxTop, true, true); + m_PropertiesVBox.pack_start(m_HBoxBottom, true, true); + m_PropertiesVBox.pack_start(m_TimerLabel, true, true); + + pack_start(m_PropertiesVBox, false, true, 6); + + m_DrawingArea.signal_draw().connect(sigc::mem_fun(*this, &Render::drawing_area_draw)); + m_ScrolledWin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + m_ScrolledWin.add(m_DrawingArea); + + pack_start(m_ScrolledWin, true, true); + + show_all(); +} + +void Render::slice_selector_setup() +{ + Glib::RefPtr<Poppler::Page> page = m_Document->get_page(m_Page); + if (!page) return; + + double width, height; + page->get_size(width, height); + + m_SliceXSelector.set_range(0, width); + m_SliceYSelector.set_range(0, height); + m_SliceWidthSelector.set_range(0, width); + m_SliceHeightSelector.set_range(0, height); + + m_SliceXSelector.set_value(0); + m_SliceYSelector.set_value(0); + m_SliceWidthSelector.set_value(width); + m_SliceHeightSelector.set_value(height); +} + +void Render::page_selector_changed() +{ + m_Page = m_PageSelector.get_value() - 1; + slice_selector_setup(); +} + +void Render::scale_selector_changed() +{ + m_Scale = m_ScaleSelector.get_value(); +} + +void Render::rotate_selector_changed() +{ + m_Rotate = m_RotateSelector.get_active_row_number() * 90; +} + +void Render::printing_selector_changed() +{ + m_Printing = m_PrintingSelector.get_active(); +} + +void Render::slice_selector_changed() +{ + m_Slice.set_x(m_SliceXSelector.get_value()); + m_Slice.set_y(m_SliceYSelector.get_value()); + m_Slice.set_width(m_SliceWidthSelector.get_value()); + m_Slice.set_height(m_SliceHeightSelector.get_value()); +} + +void Render::start() +{ + Glib::RefPtr<Poppler::Page> page = m_Document->get_page(m_Page); + if (!page) return; + + double page_width, page_height; + page->get_size(page_width, page_height); + + double width, height; + int x, y; + if (m_Rotate == 0 || m_Rotate == 180) + { + width = m_Slice.get_width() * m_Scale; + height = m_Slice.get_height() * m_Scale; + x = m_Slice.get_x() * m_Scale; + y = m_Slice.get_y() * m_Scale; + } + else + { + width = m_Slice.get_height() * m_Scale; + height = m_Slice.get_width() * m_Scale; + x = m_Slice.get_y() * m_Scale; + y = m_Slice.get_x() * m_Scale; + } + + Glib::Timer timer; + m_Surface = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, width, height); + Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(m_Surface); + + cr->save(); + + switch (m_Rotate) + { + case 90: + cr->translate(x + width, -y); + break; + case 180: + cr->translate(x + width, y + height); + break; + case 270: + cr->translate(-x, y + height); + break; + default: + cr->translate(-x, -y); + } + + if (m_Scale != 1.0) cr->scale(m_Scale, m_Scale); + if (m_Rotate != 0) cr->rotate(m_Rotate * G_PI / 180.0); + + if (m_Printing) page->render_for_printing(cr); + else page->render(cr); + + cr->restore(); + + cr->set_operator(Cairo::OPERATOR_DEST_OVER); + cr->set_source_rgb(1.0, 1.0, 1.0); + cr->paint(); + + timer.stop(); + + m_TimerLabel.set_markup(Glib::ustring::compose("<i>Page rendered in %1 seconds</i>", timer.elapsed())); + + m_DrawingArea.set_size_request(width, height); + m_DrawingArea.queue_draw(); +} + +bool Render::drawing_area_draw(const Cairo::RefPtr<Cairo::Context>& cr) +{ + if (!m_Surface) return false; + + cr->set_source(m_Surface, 0, 0); + cr->paint(); + + return true; +} + +} diff --git a/examples/demo/render.h b/examples/demo/render.h new file mode 100644 index 0000000..8d27a78 --- /dev/null +++ b/examples/demo/render.h @@ -0,0 +1,72 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _RENDER_H_ +#define _RENDER_H_ + +#include <poppler-glibmm/document.h> +#include <gtkmm/box.h> +#include <gtkmm/label.h> +#include <gtkmm/spinbutton.h> +#include <gtkmm/comboboxtext.h> +#include <gtkmm/checkbutton.h> +#include <gtkmm/drawingarea.h> +#include <gtkmm/scrolledwindow.h> + +namespace PGD +{ + +class Render : public Gtk::Box +{ + public: + Render(const Glib::RefPtr<Poppler::Document>& document); + + private: + bool drawing_area_draw(const Cairo::RefPtr<Cairo::Context>& cr); + void page_selector_changed(); + void scale_selector_changed(); + void rotate_selector_changed(); + void printing_selector_changed(); + void slice_selector_changed(); + void start(); + void slice_selector_setup(); + + const Glib::RefPtr<Poppler::Document> m_Document; + double m_Scale; + int m_Page, m_Rotate; + Gdk::Rectangle m_Slice; + bool m_Printing; + Cairo::RefPtr<Cairo::Surface> m_Surface; + + Gtk::Box m_PropertiesVBox, m_HBoxTop, m_HBoxBottom, m_PageHBox, m_ScaleHBox, m_RotateHBox, + m_SliceXHBox, m_SliceYHBox, m_SliceWidthHBox, m_SliceHeightHBox; + Gtk::Label m_PageLabel, m_PageNumLabel, m_ScaleLabel, m_RotateLabel, + m_SliceXLabel, m_SliceYLabel, m_SliceWidthLabel, m_SliceHeightLabel, + m_TimerLabel; + Gtk::SpinButton m_PageSelector, m_ScaleSelector, + m_SliceXSelector, m_SliceYSelector, m_SliceWidthSelector, m_SliceHeightSelector; + Gtk::ComboBoxText m_RotateSelector; + Gtk::CheckButton m_PrintingSelector; + Gtk::Button m_RenderButton; + Gtk::DrawingArea m_DrawingArea; + Gtk::ScrolledWindow m_ScrolledWin; +}; + +} + +#endif // _RENDER_H_ diff --git a/examples/demo/selections.cc b/examples/demo/selections.cc new file mode 100644 index 0000000..ca365c6 --- /dev/null +++ b/examples/demo/selections.cc @@ -0,0 +1,318 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "selections.h" + +#include <glibmm/main.h> +#include <gdkmm/general.h> +#include <gtkmm/tooltip.h> + +namespace PGD +{ + +Selections::Selections(const Glib::RefPtr<Poppler::Document>& document) : + Gtk::Box(Gtk::ORIENTATION_VERTICAL, 6), + m_Document(document), + m_Cursor(Gdk::LAST_CURSOR), + m_Scale(1.0), m_PageIndex(0), + m_PropertiesVBox(Gtk::ORIENTATION_VERTICAL, 6), + m_HBoxTop(Gtk::ORIENTATION_HORIZONTAL, 12), m_HBoxBottom(Gtk::ORIENTATION_HORIZONTAL, 12), + m_PageHBox(Gtk::ORIENTATION_HORIZONTAL, 6), m_ScaleHBox(Gtk::ORIENTATION_HORIZONTAL, 6), + m_FGColorHBox(Gtk::ORIENTATION_HORIZONTAL, 6), m_BGColorHBox(Gtk::ORIENTATION_HORIZONTAL, 6), + m_PageLabel("Page:"), m_ScaleLabel("Scale:"), + m_FGColorLabel("Foreground Color:"), m_BGColorLabel("Background Color:"), + m_ScaleSelector(0.1, 1), + m_RenderButton("Render"), + m_CopyButton("Copy") +{ + clear_selections(); + + int n_pages = document->get_n_pages(); + m_PageSelector.set_range(1, n_pages); + m_PageSelector.set_increments(1, 10); + m_PageSelector.set_numeric(); + m_PageSelector.signal_value_changed().connect(sigc::mem_fun(*this, &Selections::page_selector_changed)); + m_PageNumLabel.set_text(Glib::ustring::compose("of %1", n_pages)); + m_PageHBox.pack_start(m_PageLabel, true, true); + m_PageHBox.pack_start(m_PageSelector, true, true); + m_PageHBox.pack_start(m_PageNumLabel, true, true); + m_HBoxTop.pack_start(m_PageHBox, false, true); + + m_ScaleSelector.set_range(0.0, 10.0); + m_ScaleSelector.set_increments(0.1, 1.0); + m_ScaleSelector.set_value(1.0); + m_ScaleSelector.set_numeric(); + m_ScaleSelector.signal_value_changed().connect(sigc::mem_fun(*this, &Selections::scale_selector_changed)); + m_ScaleHBox.pack_start(m_ScaleLabel, true, true); + m_ScaleHBox.pack_start(m_ScaleSelector, true, true); + m_HBoxTop.pack_start(m_ScaleHBox, false, true); + + m_FGColorButton.signal_color_set().connect(sigc::mem_fun(*this, &Selections::fg_color_changed)); + m_FGColorHBox.pack_start(m_FGColorLabel, true, true); + m_FGColorHBox.pack_start(m_FGColorButton, true, true); + m_HBoxBottom.pack_start(m_FGColorHBox, false, true); + + m_BGColorButton.signal_color_set().connect(sigc::mem_fun(*this, &Selections::bg_color_changed)); + m_BGColorHBox.pack_start(m_BGColorLabel, true, true); + m_BGColorHBox.pack_start(m_BGColorButton, true, true); + m_HBoxBottom.pack_start(m_BGColorHBox, false, true); + + m_CopyButton.signal_clicked().connect(sigc::mem_fun(*this, &Selections::copy)); + m_CopyButton.set_sensitive(false); + m_HBoxBottom.pack_end(m_CopyButton, false, true); + + m_RenderButton.signal_clicked().connect(sigc::mem_fun(*this, &Selections::render)); + m_HBoxBottom.pack_end(m_RenderButton, false, true); + + m_PropertiesVBox.pack_start(m_HBoxTop, true, true); + m_PropertiesVBox.pack_start(m_HBoxBottom, true, true); + + pack_start(m_PropertiesVBox, false, true, 6); + + m_DrawingArea.signal_draw().connect(sigc::mem_fun(*this, &Selections::drawing_area_draw)); + m_DrawingArea.signal_button_press_event().connect(sigc::mem_fun(*this, &Selections::drawing_area_button_press)); + m_DrawingArea.signal_button_release_event().connect(sigc::mem_fun(*this, &Selections::drawing_area_button_release)); + m_DrawingArea.signal_motion_notify_event().connect(sigc::mem_fun(*this, &Selections::drawing_area_motion_notify)); + m_DrawingArea.signal_query_tooltip().connect(sigc::mem_fun(*this, &Selections::drawing_area_query_tooltip)); + m_ScrolledWin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + m_ScrolledWin.add(m_DrawingArea); + + m_DrawingArea.add_events(Gdk::POINTER_MOTION_HINT_MASK | Gdk::BUTTON1_MOTION_MASK | + Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); + m_DrawingArea.set_has_tooltip(); + + Glib::RefPtr<Gtk::StyleContext> style = m_DrawingArea.get_style_context(); + m_FGColorButton.set_rgba(style->get_color(Gtk::STATE_FLAG_SELECTED)); + m_BGColorButton.set_rgba(style->get_background_color(Gtk::STATE_FLAG_SELECTED)); + fg_color_changed(); + bg_color_changed(); + + pack_start(m_ScrolledWin, true, true); + + show_all(); +} + +void Selections::clear_selections() +{ + m_Start.set_x(-1); + + m_SelectionSurface.clear(); + m_SelectionRegion.clear(); + m_SelectedText.clear(); + m_SelectedRegion.clear(); + m_CopyButton.set_sensitive(false); +} + +void Selections::page_selector_changed() +{ + m_PageIndex = m_PageSelector.get_value() - 1; + if (m_Page) m_Page.reset(); +} + +void Selections::scale_selector_changed() +{ + m_Scale = m_ScaleSelector.get_value(); +} + +void Selections::fg_color_changed() +{ + Gdk::RGBA color = m_FGColorButton.get_rgba(); + m_GlyphColor.set_red(color.get_red_u()); + m_GlyphColor.set_green(color.get_green_u()); + m_GlyphColor.set_blue(color.get_blue_u()); +} + +void Selections::bg_color_changed() +{ + Gdk::RGBA color = m_BGColorButton.get_rgba(); + m_BackgroundColor.set_red(color.get_red_u()); + m_BackgroundColor.set_green(color.get_green_u()); + m_BackgroundColor.set_blue(color.get_blue_u()); +} + +bool Selections::drawing_area_draw(const Cairo::RefPtr<Cairo::Context>& cr) +{ + if (!m_Surface) return false; + + cr->set_source(m_Surface, 0, 0); + cr->paint(); + + if (m_SelectionSurface) + { + cr->set_source(m_SelectionSurface, 0, 0); + cr->paint(); + } + + return true; +} + +bool Selections::render_selections() +{ + if (!m_Page || m_Start.get_x() == -1) return false; + + double page_width, page_height; + m_Page->get_size(page_width, page_height); + page_width *= m_Scale; + page_height *= m_Scale; + + Poppler::Rectangle doc_area(m_Start.get_x() / m_Scale, m_Start.get_y() / m_Scale, + m_Stop.get_x() / m_Scale, m_Stop.get_y() / m_Scale); + + m_SelectionSurface = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, page_width, page_height); + Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(m_SelectionSurface); + + if (m_Scale != 1.0) cr->scale(m_Scale, m_Scale); + + m_Page->render_selection(cr, doc_area, m_DocArea, m_Style, m_GlyphColor, m_BackgroundColor); + m_DocArea = doc_area; + + m_DrawingArea.queue_draw(); + + return false; +} + +bool Selections::drawing_area_button_press(GdkEventButton* event) +{ + if (!m_Page || event->button != 1) return false; + + m_Start.set_x(event->x); + m_Start.set_y(event->y); + m_Stop = m_Start; + + switch (event->type) + { + case Gdk::DOUBLE_BUTTON_PRESS: + m_Style = Poppler::SELECTION_WORD; + break; + case Gdk::TRIPLE_BUTTON_PRESS: + m_Style = Poppler::SELECTION_LINE; + break; + default: + m_Style = Poppler::SELECTION_GLYPH; + } + + render_selections(); + + return true; +} + +bool Selections::drawing_area_button_release(GdkEventButton* event) +{ + if (!m_Page || event->button != 1) return false; + + if (m_Start.get_x() != -1) + { + m_SelectedRegion = m_Page->get_selected_region(1.0, m_Style, m_DocArea); + m_SelectedText.clear(); + Glib::ustring text = m_Page->get_selected_text(m_Style, m_DocArea); + if (text.size()) m_SelectedText = text.normalize(Glib::NORMALIZE_NFKC); + m_CopyButton.set_sensitive(m_SelectedText.size()); + } + + m_Start.set_x(-1); + + if (m_SelectionsIdle.connected()) m_SelectionsIdle.disconnect(); + + return true; +} + +bool Selections::drawing_area_motion_notify(GdkEventMotion* event) +{ + if (!m_Page) return false; + + if (m_Start.get_x() != -1) + { + m_Stop.set_x(event->x); + m_Stop.set_y(event->y); + if (m_SelectionsIdle.empty()) + m_SelectionsIdle = Glib::signal_idle().connect(sigc::mem_fun(*this, &Selections::render_selections)); + } + else + { + bool over_text = m_SelectionRegion->contains_point(event->x / m_Scale, event->y / m_Scale); + Gdk::CursorType cursor_type = over_text ? Gdk::XTERM : Gdk::LAST_CURSOR; + if (cursor_type != m_Cursor) + { + Glib::RefPtr<Gdk::Cursor> cursor; + + if (cursor_type != Gdk::LAST_CURSOR) + cursor = Gdk::Cursor::create(m_DrawingArea.get_display(), cursor_type); + + m_Cursor = cursor_type; + m_DrawingArea.get_window()->set_cursor(cursor); + Gdk::flush(); + } + } + + return true; +} + +bool Selections::drawing_area_query_tooltip(int x, int y, bool, const Glib::RefPtr<Gtk::Tooltip>& tooltip) +{ + if (m_SelectedText.empty() || !m_SelectedRegion || !m_SelectedRegion->contains_point(x / m_Scale, y / m_Scale)) + return false; + + tooltip->set_text(m_SelectedText); + + Cairo::RectangleInt selection_area = m_SelectedRegion->get_extents(); + tooltip->set_tip_area(Gdk::Rectangle(selection_area.x * m_Scale, selection_area.y * m_Scale, + selection_area.width * m_Scale, selection_area.height * m_Scale)); + + return true; +} + +void Selections::render() +{ + if (!m_Page) m_Page = m_Document->get_page(m_PageIndex); + if (!m_Page) return; + + clear_selections(); + + double page_width, page_height; + m_Page->get_size(page_width, page_height); + + m_SelectionRegion = + m_Page->get_selected_region(1.0, Poppler::SELECTION_GLYPH, Poppler::Rectangle(0, 0, page_width, page_height)); + + page_width *= m_Scale; + page_height *= m_Scale; + + m_Surface = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, page_width, page_height); + Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(m_Surface); + + cr->save(); + + if (m_Scale != 1.0) cr->scale(m_Scale, m_Scale); + m_Page->render(cr); + + cr->restore(); + + cr->set_operator(Cairo::OPERATOR_DEST_OVER); + cr->set_source_rgb(1.0, 1.0, 1.0); + cr->paint(); + + m_DrawingArea.set_size_request(page_width, page_height); + m_DrawingArea.queue_draw(); +} + +void Selections::copy() +{ + Gtk::Clipboard::get_for_display(Gdk::Display::get_default())->set_text(m_SelectedText); +} + +} diff --git a/examples/demo/selections.h b/examples/demo/selections.h new file mode 100644 index 0000000..1cc1077 --- /dev/null +++ b/examples/demo/selections.h @@ -0,0 +1,80 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _SELECTIONS_H_ +#define _SELECTIONS_H_ + +#include <poppler-glibmm/document.h> +#include <gtkmm/box.h> +#include <gtkmm/label.h> +#include <gtkmm/spinbutton.h> +#include <gtkmm/colorbutton.h> +#include <gtkmm/drawingarea.h> +#include <gtkmm/scrolledwindow.h> + +namespace PGD +{ + +class Selections : public Gtk::Box +{ + public: + Selections(const Glib::RefPtr<Poppler::Document>& document); + + private: + void clear_selections(); + void page_selector_changed(); + void scale_selector_changed(); + void fg_color_changed(); + void bg_color_changed(); + bool drawing_area_draw(const Cairo::RefPtr<Cairo::Context>& cr); + bool drawing_area_button_press(GdkEventButton* event); + bool drawing_area_button_release(GdkEventButton* event); + bool drawing_area_motion_notify(GdkEventMotion* event); + bool drawing_area_query_tooltip(int x, int y, bool keyboard_tip, const Glib::RefPtr<Gtk::Tooltip>& tooltip); + void render(); + bool render_selections(); + void copy(); + + const Glib::RefPtr<Poppler::Document> m_Document; + Glib::RefPtr<Poppler::Page> m_Page; + Poppler::Color m_GlyphColor, m_BackgroundColor; + Poppler::Rectangle m_DocArea; + Poppler::SelectionStyle m_Style; + Gdk::CursorType m_Cursor; + Gdk::Point m_Start, m_Stop; + Cairo::RefPtr<Cairo::Surface> m_Surface, m_SelectionSurface; + Cairo::RefPtr<Cairo::Region> m_SelectionRegion, m_SelectedRegion; + double m_Scale; + int m_PageIndex; + sigc::connection m_SelectionsIdle; + Glib::ustring m_SelectedText; + + Gtk::Box m_PropertiesVBox, m_HBoxTop, m_HBoxBottom, m_PageHBox, m_ScaleHBox, + m_FGColorHBox, m_BGColorHBox; + Gtk::Label m_PageLabel, m_PageNumLabel, m_ScaleLabel, + m_FGColorLabel, m_BGColorLabel; + Gtk::SpinButton m_PageSelector, m_ScaleSelector; + Gtk::Button m_RenderButton, m_CopyButton; + Gtk::ColorButton m_FGColorButton, m_BGColorButton; + Gtk::DrawingArea m_DrawingArea; + Gtk::ScrolledWindow m_ScrolledWin; +}; + +} + +#endif // _SELECTIONS_H_ diff --git a/examples/demo/text.cc b/examples/demo/text.cc new file mode 100644 index 0000000..632e0e4 --- /dev/null +++ b/examples/demo/text.cc @@ -0,0 +1,226 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "text.h" +#include "util.h" + +#include <glibmm/timer.h> +#include <iomanip> + +namespace PGD +{ + +TextAttribView::TextAttribView(const Glib::RefPtr<Poppler::Document>& document) : + m_Document(document), + m_Alignment(0.5, 0.5, 1, 1) +{ + set_shadow_type(Gtk::SHADOW_NONE); + m_Label.set_markup("<b>Text Attributes</b>"); + set_label_widget(m_Label); + + m_Alignment.set_padding(5, 5, 12, 5); + add(m_Alignment); + + m_Grid.set_column_spacing(6); + m_Grid.set_row_spacing(6); + + m_Grid.add_property_with_custom_widget("<b>Font Name:</b>", m_FontName); + m_Grid.add_property_with_custom_widget("<b>Font Size:</b>", m_FontSize); + m_Grid.add_property_with_custom_widget("<b>Underlined:</b>", m_IsUnderlined); + m_Grid.add_property_with_custom_widget("<b>Color:</b>", m_TextColor); + + m_Alignment.add(m_Grid); +} + +void TextAttribView::set_font_name(const Glib::ustring& name) +{ + m_FontName.set_text(name); +} + +void TextAttribView::set_font_size(const double size) +{ + m_FontSize.set_text(Glib::ustring::format(std::fixed, std::setprecision(2), size)); +} + +void TextAttribView::set_is_underlined(const bool is_underlined) +{ + m_IsUnderlined.set_text(is_underlined ? "Yes" : "No"); +} + +void TextAttribView::set_text_color(const Poppler::Color& color) +{ + Glib::RefPtr<Gdk::Pixbuf> pixbuf = pixbuf_new_for_color(color); + m_TextColor.set(pixbuf); +} + +Text::Text(const Glib::RefPtr<Poppler::Document>& document) : + Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12), + m_Document(document), + m_Page(0), + m_HBoxTop(Gtk::ORIENTATION_HORIZONTAL, 6), m_VBoxLeft(Gtk::ORIENTATION_VERTICAL, 12), + m_PageLabel("Page:"), + m_GetButton("Get Text"), + m_HPaned(Gtk::ORIENTATION_HORIZONTAL), + m_AttribView(document) +{ + int n_pages = m_Document->get_n_pages(); + m_PageSelector.set_range(1, n_pages); + m_PageSelector.set_increments(1, 10); + m_PageSelector.set_numeric(); + m_PageSelector.signal_value_changed().connect(sigc::mem_fun(*this, &Text::page_selector_changed)); + m_PageNumLabel.set_text(Glib::ustring::compose("of %1", n_pages)); + + m_GetButton.signal_clicked().connect(sigc::mem_fun(*this, &Text::get_text)); + + m_HBoxTop.pack_start(m_PageLabel, false, true); + m_HBoxTop.pack_start(m_PageSelector, false, true); + m_HBoxTop.pack_start(m_PageNumLabel, false, true); + m_HBoxTop.pack_end(m_GetButton, false, false); + + m_TimerLabel.set_markup("<i>No text found</i>"); + m_TimerLabel.set_alignment(1.0, 0.5); + + m_TreeWin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + + m_TextStore = Gtk::ListStore::create(m_StoreColumns); + m_TreeView.set_model(m_TextStore); + + m_TreeView.append_column_numeric("X1", m_StoreColumns.m_X1, "%.2f"); + m_TreeView.append_column_numeric("Y1", m_StoreColumns.m_Y1, "%.2f"); + m_TreeView.append_column_numeric("X2", m_StoreColumns.m_X2, "%.2f"); + m_TreeView.append_column_numeric("Y2", m_StoreColumns.m_Y2, "%.2f"); + m_TreeView.append_column_numeric("Offset", m_StoreColumns.m_Offset, "%d"); + + m_TreeView.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &Text::selection_changed)); + + m_TreeWin.add(m_TreeView); + + m_VBoxLeft.pack_start(m_TreeWin, true, true); + m_VBoxLeft.pack_start(m_AttribView, false, false, 12); + + m_BuffWin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + m_TextBuffer = Gtk::TextBuffer::create(); + m_TextView.set_has_tooltip(); + m_TextView.set_buffer(m_TextBuffer); + m_BuffWin.add(m_TextView); + m_TextView.signal_query_tooltip().connect(sigc::mem_fun(*this, &Text::view_query_tooltip)); + + m_HPaned.add1(m_VBoxLeft); + m_HPaned.add2(m_BuffWin); + m_HPaned.set_position(300); + + pack_start(m_HBoxTop, false, true); + pack_start(m_TimerLabel, false, true); + pack_start(m_HPaned, true, true); + + show_all(); +} + +void Text::page_selector_changed() +{ + m_Page = m_PageSelector.get_value() - 1; +} + +void Text::get_text() +{ + Glib::RefPtr<Poppler::Page> page = m_Document->get_page(m_Page); + if (!page) return; + + m_TextStore->clear(); + m_TextAttrs.clear(); + + Glib::Timer timer; + Glib::ustring text = page->get_text(); + timer.stop(); + + std::vector<Poppler::Rectangle> recs; + if (text.size()) + { + double text_elapsed = timer.elapsed(); + + timer.start(); + page->get_text_layout(recs); + timer.stop(); + double layout_elapsed = timer.elapsed(); + + timer.start(); + m_TextAttrs = page->get_text_attributes(); + timer.stop(); + + m_TimerLabel.set_markup(Glib::ustring::format(std::fixed, std::setprecision(4), + "<i>got text in ", text_elapsed, " seconds, text layout in ", + layout_elapsed, " seconds, text attrs in ", timer.elapsed()) + " seconds</i>"); + + m_TextBuffer->set_text(text); + } + else m_TimerLabel.set_markup("<i>No text found</i>"); + + for (std::vector<Poppler::Rectangle>::iterator rec = recs.begin(); + rec != recs.end(); ++rec) + { + Gtk::TreeRow tree_row = *(m_TextStore->append()); + tree_row[m_StoreColumns.m_X1] = rec->get_x1(); + tree_row[m_StoreColumns.m_Y1] = rec->get_y1(); + tree_row[m_StoreColumns.m_X2] = rec->get_x2(); + tree_row[m_StoreColumns.m_Y2] = rec->get_y2(); + tree_row[m_StoreColumns.m_Offset] = (rec - recs.begin()); + } +} + +void Text::selection_changed() +{ + Gtk::TreeIter iter = m_TreeView.get_selection()->get_selected(); + if (iter) + { + int offset = (*iter)[m_StoreColumns.m_Offset]; + Gtk::TextIter begin_iter = m_TextBuffer->get_iter_at_offset(offset); + Gtk::TextIter end_iter = begin_iter; + ++end_iter; + m_TextBuffer->select_range(begin_iter, end_iter); + for (std::vector<Poppler::TextAttributes>::iterator attrs = m_TextAttrs.begin(); + attrs != m_TextAttrs.end(); ++attrs) + { + if (offset >= attrs->get_start_index() && offset <= attrs->get_end_index()) + { + m_AttribView.set_font_name(attrs->get_font_name()); + m_AttribView.set_font_size(attrs->get_font_size()); + m_AttribView.set_is_underlined(attrs->get_is_underlined()); + m_AttribView.set_text_color(attrs->get_color()); + } + } + } +} + +bool Text::view_query_tooltip(int, int, bool, const Glib::RefPtr<Gtk::Tooltip>& tooltip) +{ + Gtk::TreeIter iter = m_TreeView.get_selection()->get_selected(); + if (iter) + { + Glib::RefPtr<Poppler::Page> page = m_Document->get_page(m_Page); + if (!page) return false; + + Poppler::Rectangle rect((*iter)[m_StoreColumns.m_X1], (*iter)[m_StoreColumns.m_Y1], + (*iter)[m_StoreColumns.m_X2], (*iter)[m_StoreColumns.m_Y2]); + tooltip->set_text(page->get_selected_text(Poppler::SELECTION_GLYPH, rect)); + + return true; + } + return false; +} + +} diff --git a/examples/demo/text.h b/examples/demo/text.h new file mode 100644 index 0000000..21a5606 --- /dev/null +++ b/examples/demo/text.h @@ -0,0 +1,102 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _TEXT_H_ +#define _TEXT_H_ + +#include "property-grid.h" + +#include <poppler-glibmm/document.h> +#include <gtkmm/box.h> +#include <gtkmm/label.h> +#include <gtkmm/button.h> +#include <gtkmm/spinbutton.h> +#include <gtkmm/scrolledwindow.h> +#include <gtkmm/paned.h> +#include <gtkmm/frame.h> +#include <gtkmm/liststore.h> +#include <gtkmm/treeview.h> +#include <gtkmm/alignment.h> +#include <gtkmm/textview.h> + +namespace PGD +{ + +class TextAttribView : public Gtk::Frame +{ + public: + TextAttribView(const Glib::RefPtr<Poppler::Document>& document); + void set_font_name(const Glib::ustring& name); + void set_font_size(const double size); + void set_is_underlined(const bool is_underlined); + void set_text_color(const Poppler::Color& color); + + private: + const Glib::RefPtr<Poppler::Document> m_Document; + + Gtk::Label m_Label, m_FontName, m_FontSize, m_IsUnderlined; + Gtk::Image m_TextColor; + Gtk::Alignment m_Alignment; + PropertyGrid m_Grid; +}; + +class Text : public Gtk::Box +{ + public: + Text(const Glib::RefPtr<Poppler::Document>& document); + + private: + void page_selector_changed(); + void get_text(); + void selection_changed(); + bool view_query_tooltip(int x, int y, bool keyboard_tooltip, const Glib::RefPtr<Gtk::Tooltip>& tooltip); + + const Glib::RefPtr<Poppler::Document> m_Document; + int m_Page; + std::vector<Poppler::TextAttributes> m_TextAttrs; + + class ModelColumns : public Gtk::TreeModel::ColumnRecord + { + public: + ModelColumns() { add(m_X1); add(m_Y1); add(m_X2); add(m_Y2); add(m_Offset); } + + Gtk::TreeModelColumn<double> m_X1; + Gtk::TreeModelColumn<double> m_Y1; + Gtk::TreeModelColumn<double> m_X2; + Gtk::TreeModelColumn<double> m_Y2; + Gtk::TreeModelColumn<int> m_Offset; + }; + + Gtk::Box m_HBoxTop, m_VBoxLeft; + Gtk::Label m_PageLabel, m_PageNumLabel, m_TimerLabel, m_AttribFrameLabel; + Gtk::SpinButton m_PageSelector; + Gtk::Button m_GetButton; + Gtk::ScrolledWindow m_TreeWin, m_BuffWin; + Gtk::Paned m_HPaned; + TextAttribView m_AttribView; + Glib::RefPtr<Gtk::TextBuffer> m_TextBuffer; + Gtk::TextView m_TextView; + + ModelColumns m_StoreColumns; + Gtk::TreeView m_TreeView; + Glib::RefPtr<Gtk::ListStore> m_TextStore; +}; + +} + +#endif // _TEXT_H_ diff --git a/examples/demo/transitions.cc b/examples/demo/transitions.cc new file mode 100644 index 0000000..b6a024f --- /dev/null +++ b/examples/demo/transitions.cc @@ -0,0 +1,149 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "transitions.h" + +#include <glibmm/main.h> +#include <gtkmm/main.h> + +namespace PGD +{ + +Transitions::Transitions(const Glib::RefPtr<Poppler::Document>& document) : + Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12), + m_Document(document), + m_HBoxTop(Gtk::ORIENTATION_HORIZONTAL, 6), + m_ScanButton("Scan") +{ + m_ProgressBar.set_ellipsize(Pango::ELLIPSIZE_END); + m_ProgressBar.set_show_text(); + m_ProgressBar.set_text(""); + m_ScanButton.signal_clicked().connect(sigc::mem_fun(*this, &Transitions::scan_button_clicked)); + m_HBoxTop.pack_start(m_ProgressBar, true, true); + m_HBoxTop.pack_end(m_ScanButton, false, false); + + pack_start(m_HBoxTop, false, true, 6); + + m_ScrolledWin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + + m_TransitionStore = Gtk::ListStore::create(m_StoreColumns); + m_TreeView.set_model(m_TransitionStore); + m_TreeView.set_headers_visible(); + m_TreeView.set_rules_hint(); + m_TreeView.get_selection()->set_mode(Gtk::SELECTION_NONE); + + m_TreeView.append_column_numeric("Page", m_StoreColumns.m_Page, "%d"); + m_TreeView.append_column("Type", m_StoreColumns.m_Type); + m_TreeView.append_column("Alignment", m_StoreColumns.m_Alignment); + m_TreeView.append_column("Direction", m_StoreColumns.m_Direction); + m_TreeView.append_column_numeric("Duration", m_StoreColumns.m_Duration, "%d"); + m_TreeView.append_column_numeric("Scale", m_StoreColumns.m_Scale, "%.2f"); + m_TreeView.append_column("Rectangular", m_StoreColumns.m_Rectangular); + + m_ScrolledWin.add(m_TreeView); + pack_start(m_ScrolledWin, true, true); + + show_all(); +} + +void Transitions::scan_button_clicked() +{ + Glib::signal_idle().connect_once(sigc::mem_fun(*this, &Transitions::fill_model)); +} + +static Glib::ustring transition_type_to_string(Poppler::PageTransitionType type) +{ + switch (type) + { + case Poppler::PAGE_TRANSITION_REPLACE: + return "Replace"; + case Poppler::PAGE_TRANSITION_SPLIT: + return "Split"; + case Poppler::PAGE_TRANSITION_BLINDS: + return "Blinds"; + case Poppler::PAGE_TRANSITION_BOX: + return "Box"; + case Poppler::PAGE_TRANSITION_WIPE: + return "Wipe"; + case Poppler::PAGE_TRANSITION_DISSOLVE: + return "Dissolve"; + case Poppler::PAGE_TRANSITION_GLITTER: + return "Glitter"; + case Poppler::PAGE_TRANSITION_FLY: + return "Fly"; + case Poppler::PAGE_TRANSITION_PUSH: + return "Push"; + case Poppler::PAGE_TRANSITION_COVER: + return "Cover"; + case Poppler::PAGE_TRANSITION_UNCOVER: + return "Uncover"; + case Poppler::PAGE_TRANSITION_FADE: + return "Fade"; + } + return "Unknown"; +} + +static Glib::ustring transition_alignment_to_string (Poppler::PageTransitionAlignment alignment) +{ + return alignment == Poppler::PAGE_TRANSITION_HORIZONTAL ? "Horizontal" : "Vertical"; +} + +static Glib::ustring transition_direction_to_string (Poppler::PageTransitionDirection direction) +{ + return direction == Poppler::PAGE_TRANSITION_INWARD ? "Inward" : "Outward"; +} + +void Transitions::fill_model() +{ + int n_pages = m_Document->get_n_pages(); + + for (int i = 0; i < n_pages; ++i) + { + update_progress(n_pages, i); + while (Gtk::Main::events_pending()) + Gtk::Main::iteration(); + + Glib::RefPtr<Poppler::Page> page = m_Document->get_page(i); + if (!page) continue; + + Poppler::PageTransition transition = page->get_transition(); + if (transition) + { + Gtk::TreeRow row = *(m_TransitionStore->append()); + row[m_StoreColumns.m_Page] = i + 1; + row[m_StoreColumns.m_Type] = transition_type_to_string(transition.get_transition_type()); + row[m_StoreColumns.m_Alignment] = transition_alignment_to_string(transition.get_alignment()); + row[m_StoreColumns.m_Direction] = transition_direction_to_string(transition.get_direction()); + row[m_StoreColumns.m_Duration] = transition.get_duration(); + row[m_StoreColumns.m_Angle] = transition.get_angle(); + row[m_StoreColumns.m_Scale] = transition.get_scale(); + row[m_StoreColumns.m_Rectangular] = transition.get_rectangular() ? "Yes" : "No"; + + } + + } + update_progress(n_pages, n_pages); +} + +void Transitions::update_progress(int n_pages, int scanned) +{ + m_ProgressBar.set_text(Glib::ustring::compose("Scanning transitions (%1%%)", std::min(scanned * 100 / n_pages, 100))); + m_ProgressBar.set_fraction(std::min((double)scanned / n_pages, 1.0)); +} + +} diff --git a/examples/demo/transitions.h b/examples/demo/transitions.h new file mode 100644 index 0000000..37c6f14 --- /dev/null +++ b/examples/demo/transitions.h @@ -0,0 +1,76 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <gtk/gtk.h> +#include <poppler.h> + +#ifndef _TRANSITIONS_H_ +#define _TRANSITIONS_H_ + +#include <poppler-glibmm/document.h> +#include <gtkmm/box.h> +#include <gtkmm/progressbar.h> +#include <gtkmm/button.h> +#include <gtkmm/scrolledwindow.h> +#include <gtkmm/liststore.h> +#include <gtkmm/treeview.h> + +namespace PGD +{ + +class Transitions : public Gtk::Box +{ + public: + Transitions(const Glib::RefPtr<Poppler::Document>& document); + + private: + void scan_button_clicked(); + void fill_model(); + void update_progress(int n_pages, int scanned); + + const Glib::RefPtr<Poppler::Document> m_Document; + + class ModelColumns : public Gtk::TreeModel::ColumnRecord + { + public: + ModelColumns() { add(m_Page); add(m_Type); add(m_Alignment); add(m_Direction); + add(m_Duration); add(m_Angle); add(m_Scale); add(m_Rectangular); } + + Gtk::TreeModelColumn<int> m_Page; + Gtk::TreeModelColumn<Glib::ustring> m_Type; + Gtk::TreeModelColumn<Glib::ustring> m_Alignment; + Gtk::TreeModelColumn<Glib::ustring> m_Direction; + Gtk::TreeModelColumn<int> m_Duration; + Gtk::TreeModelColumn<int> m_Angle; + Gtk::TreeModelColumn<float> m_Scale; + Gtk::TreeModelColumn<Glib::ustring> m_Rectangular; + }; + + Gtk::Box m_HBoxTop; + Gtk::ProgressBar m_ProgressBar; + Gtk::Button m_ScanButton; + Gtk::ScrolledWindow m_ScrolledWin; + + ModelColumns m_StoreColumns; + Gtk::TreeView m_TreeView; + Glib::RefPtr<Gtk::ListStore> m_TransitionStore; +}; + +} + +#endif // _TRANSITIONS_H_ diff --git a/examples/demo/util.cc b/examples/demo/util.cc new file mode 100644 index 0000000..7a7d96f --- /dev/null +++ b/examples/demo/util.cc @@ -0,0 +1,57 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "util.h" + +#include <glibmm/convert.h> +#include <glibmm/date.h> +#include <time.h> + +namespace PGD +{ + +Glib::ustring format_date(time_t utime) +{ + Glib::Date date; + date.set_time(utime); + return date.format_string("%c"); +} + +Glib::RefPtr<Gdk::Pixbuf> pixbuf_new_for_color(const Poppler::Color& poppler_color) +{ + Glib::RefPtr<Gdk::Pixbuf> pixbuf; + + if (!poppler_color) return pixbuf; + + pixbuf = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, false, 8, 64, 16); + + guint8* pixels = pixbuf->get_pixels(); + int num = pixbuf->get_width() * pixbuf->get_height(); + + for (int i = 0; i < num; ++i) + { + pixels[0] = poppler_color.get_red(); + pixels[1] = poppler_color.get_green(); + pixels[2] = poppler_color.get_blue(); + pixels += 3; + } + + return pixbuf; +} + +} diff --git a/examples/demo/util.h b/examples/demo/util.h new file mode 100644 index 0000000..7ee6ec1 --- /dev/null +++ b/examples/demo/util.h @@ -0,0 +1,35 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + + +#ifndef _UTIL_H_ +#define _UTIL_H_ + +#include <glibmm/ustring.h> +#include <gdkmm/pixbuf.h> +#include <poppler-glibmm/color.h> + +namespace PGD +{ + +Glib::ustring format_date(time_t utime); +Glib::RefPtr<Gdk::Pixbuf> pixbuf_new_for_color(const Poppler::Color& poppler_color); + +} + +#endif // _UTIL_H_ diff --git a/poppler-glib/poppler-glibmm-uninstalled.pc.in b/poppler-glib/poppler-glibmm-uninstalled.pc.in new file mode 100644 index 0000000..ff45372 --- /dev/null +++ b/poppler-glib/poppler-glibmm-uninstalled.pc.in @@ -0,0 +1,10 @@ +doxytagfile=${pc_top_builddir}/doc/reference/@POPPLER_GLIBMM_MODULE_NAME@.tag +htmlrefpub=http://library.gnome.org/devel/@PACKAGE_TARNAME@/unstable/ + +Name: poppler-glibmm +Description: C++ binding for poppler-glib, not installed +Version: @POPPLER_GLIBMM_VERSION@ +URL: http://www.gtkmm.org/ +Requires: @POPPLER_GLIBMM_MODULES@ +Libs: ${pc_top_builddir}/${pcfiledir}/poppler-glibmm/libpoppler-glibmm-@POPPLER_GLIBMM_API_VERSION@.la +Cflags: -I${pc_top_builddir}/${pcfiledir} -I${pc_top_builddir}/${pcfiledir}/@srcdir@ diff --git a/poppler-glib/poppler-glibmm.h b/poppler-glib/poppler-glibmm.h new file mode 100644 index 0000000..d2376ae --- /dev/null +++ b/poppler-glib/poppler-glibmm.h @@ -0,0 +1,125 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef POPPLER_GLIBMM_H_INCLUDED +#define POPPLER_GLIBMM_H_INCLUDED + +/** @mainpage poppler-glibmm Reference Manual + * + * @section description Description + * + * The poppler-glibmm C++ binding provides a C++ interface on top of the poppler-glib + * C library. + * + * @section overview Overview + * + * poppler-glibmm is a C++ interface for the poppler-glib library. poppler-glib is the Glib + * interface for Poppler, which is a PDF rendering library based on Xpdf PDF viewer. + * + * @section use Use + * + * To use poppler-glibmm in your C++ application, include the central header file + * <tt>\<poppler-glibmm.h\></tt>. The poppler-glibmm package ships a @c pkg-config + * file with the correct include path and link command-line for the compiler. + */ + +#include <poppler-glibmm/action.h> +#include <poppler-glibmm/annot.h> +#include <poppler-glibmm/annot_callout_line.h> +#include <poppler-glibmm/annot_mapping.h> +#include <poppler-glibmm/attachment.h> +#include <poppler-glibmm/color.h> +#include <poppler-glibmm/document.h> +#include <poppler-glibmm/error.h> +#include <poppler-glibmm/font_info.h> +#include <poppler-glibmm/fonts_iter.h> +#include <poppler-glibmm/form_field.h> +#include <poppler-glibmm/form_field_mapping.h> +#include <poppler-glibmm/image_mapping.h> +#include <poppler-glibmm/index_iter.h> +#include <poppler-glibmm/init.h> +#include <poppler-glibmm/layer.h> +#include <poppler-glibmm/layers_iter.h> +#include <poppler-glibmm/link_mapping.h> +#include <poppler-glibmm/media.h> +#include <poppler-glibmm/movie.h> +#include <poppler-glibmm/page.h> +#include <poppler-glibmm/page_transition.h> +#include <poppler-glibmm/ps_file.h> +#include <poppler-glibmm/rectangle.h> +#include <poppler-glibmm/text_attributes.h> +#include <poppler-glibmm/utility.h> + +/** @example demo/main.cc + */ + +/** @example demo/demo-window.cc + */ + +/** @example demo/info.cc + */ + +/** @example demo/fonts.cc + */ + +/** @example demo/render.cc + */ + +/** @example demo/selections.cc + */ + +/** @example demo/page-info.cc + */ + +/** @example demo/outline.cc + */ + +/** @example demo/links.cc + */ + +/** @example demo/links.cc + */ + +/** @example demo/forms.cc + */ + +/** @example demo/transitions.cc + */ + +/** @example demo/images.cc + */ + +/** @example demo/annots.cc + */ + +/** @example demo/attachments.cc + */ + +/** @example demo/layers.cc + */ + +/** @example demo/text.cc + */ + +/** @example demo/find.cc + */ + +/** @example demo/print.cc + */ + +#endif /* !POPPLER_GLIBMM_H_INCLUDED */ diff --git a/poppler-glib/poppler-glibmm.pc.in b/poppler-glib/poppler-glibmm.pc.in new file mode 100644 index 0000000..938fe81 --- /dev/null +++ b/poppler-glib/poppler-glibmm.pc.in @@ -0,0 +1,19 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +datarootdir=@datarootdir@ +datadir=@datadir@ +includedir=@includedir@ + +docdir=${datarootdir}/doc/@POPPLER_GLIBMM_MODULE_NAME@ +doxytagfile=${docdir}/reference/@POPPLER_GLIBMM_MODULE_NAME@.tag +htmlrefdir=${docdir}/reference/html +htmlrefpub=http://library.gnome.org/devel/@PACKAGE_TARNAME@/unstable/ + +Name: poppler-glibmm +Description: C++ binding for poppler-glib +Version: @POPPLER_GLIBMM_VERSION@ +URL: http://www.gtkmm.org/ +Requires: @POPPLER_GLIBMM_MODULES@ +Libs: -L${libdir} -lpoppler-glibmm-@POPPLER_GLIBMM_API_VERSION@ +Cflags: -I${includedir}/@POPPLER_GLIBMM_MODULE_NAME@ -I${libdir}/@POPPLER_GLIBMM_MODULE_NAME@/include diff --git a/poppler-glib/poppler-glibmm/Makefile.am b/poppler-glib/poppler-glibmm/Makefile.am new file mode 100644 index 0000000..66f5742 --- /dev/null +++ b/poppler-glib/poppler-glibmm/Makefile.am @@ -0,0 +1,31 @@ +## Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> +## +## This file is part of poppler-glibmm. +## +## poppler-glibmm is free software: you can redistribute it and/or modify it +## under the terms of the GNU Lesser General Public License as published +## by the Free Software Foundation, either version 2.1 of the License, +## or (at your option) any later version. +## +## poppler-glibmm is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +## See the GNU Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public License +## along with this program. If not, see <http://www.gnu.org/licenses/>. + +lib_LTLIBRARIES = libpoppler-glibmm-@POPPLER_GLIBMM_API_VERSION@.la + +include $(srcdir)/../src/filelist.am +include $(srcdir)/filelist.am +include $(top_srcdir)/build/compile-binding.am + +local_cppflags = $(binding_includes) $(binding_cppflags) -DPOPPLER_GLIBMM_BUILD=1 + +AM_CPPFLAGS = $(local_cppflags) $(GTHREAD_CFLAGS) $(POPPLER_GLIBMM_CFLAGS) +AM_CXXFLAGS = $(POPPLER_GLIBMM_WXXFLAGS) + +libpoppler_glibmm_@POPPLER_GLIBMM_API_VERSION@_la_SOURCES = $(binding_sources) +libpoppler_glibmm_@POPPLER_GLIBMM_API_VERSION@_la_LDFLAGS = -no-undefined -version-info $(POPPLER_GLIBMM_SO_VERSION) +libpoppler_glibmm_@POPPLER_GLIBMM_API_VERSION@_la_LIBADD = $(POPPLER_GLIBMM_LIBS) diff --git a/poppler-glib/poppler-glibmm/filelist.am b/poppler-glib/poppler-glibmm/filelist.am new file mode 100644 index 0000000..3a51f8c --- /dev/null +++ b/poppler-glib/poppler-glibmm/filelist.am @@ -0,0 +1,8 @@ +## This file is part of poppler-glibmm. + +files_built_cc = $(files_hg:.hg=.cc) wrap_init.cc +files_built_h = $(files_hg:.hg=.h) +files_built_ph = $(patsubst %.hg,private/%_p.h,$(files_hg)) +files_extra_cc = init.cc +files_extra_h = wrap_init.h init.h +files_extra_ph = diff --git a/poppler-glib/poppler-glibmm/init.cc b/poppler-glib/poppler-glibmm/init.cc new file mode 100644 index 0000000..6b6c0ae --- /dev/null +++ b/poppler-glib/poppler-glibmm/init.cc @@ -0,0 +1,35 @@ +// -*- c++ -*- +/* $Id: init.cc 89 2012-09-20 04:46:54Z glennricster $ */ + +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <glibmm/init.h> +#include <poppler-glibmm/wrap_init.h> + +namespace Poppler +{ + +void init() +{ + Glib::init(); + Poppler::wrap_init(); +} + +} // namespace Poppler + diff --git a/poppler-glib/poppler-glibmm/init.h b/poppler-glib/poppler-glibmm/init.h new file mode 100644 index 0000000..f3ceead --- /dev/null +++ b/poppler-glib/poppler-glibmm/init.h @@ -0,0 +1,37 @@ +// -*- c++ -*- +#ifndef _POPPLER_GLIBMMMM_INIT_H +#define _POPPLER_GLIBMMMM_INIT_H + +/* $Id: init.h 89 2012-09-20 04:46:54Z glennricster $ */ + +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +/** Initialize poppler-glibmm. + * You may call this more than once. + */ +void init(); + +} // namespace Poppler + +#endif // _POPPLER_GLIBMMMM_INIT_H + + diff --git a/poppler-glib/poppler-glibmm/wrap_init.cc b/poppler-glib/poppler-glibmm/wrap_init.cc new file mode 100644 index 0000000..d11fe3c --- /dev/null +++ b/poppler-glib/poppler-glibmm/wrap_init.cc @@ -0,0 +1,132 @@ +// Generated by generate_wrap_init.pl -- DO NOT MODIFY! + +#include <glibmm.h> + +// Disable the 'const' function attribute of the get_type() functions. +// GCC would optimize them out because we don't use the return value. +#undef G_GNUC_CONST +#define G_GNUC_CONST /* empty */ + +#include <poppler-glibmm/wrap_init.h> +#include <glibmm/error.h> +#include <glibmm/object.h> + +// #include the widget headers so that we can call the get_type() static methods: +#include "action.h" +#include "annot.h" +#include "annot_callout_line.h" +#include "annot_mapping.h" +#include "attachment.h" +#include "color.h" +#include "document.h" +#include "error.h" +#include "font_info.h" +#include "fonts_iter.h" +#include "form_field.h" +#include "form_field_mapping.h" +#include "image_mapping.h" +#include "index_iter.h" +#include "layer.h" +#include "layers_iter.h" +#include "link_mapping.h" +#include "media.h" +#include "movie.h" +#include "page.h" +#include "page_transition.h" +#include "ps_file.h" +#include "rectangle.h" +#include "text_attributes.h" +#include "utility.h" + +extern "C" +{ +//Declarations of the *_get_type() functions: + +GType poppler_annot_get_type(void); +GType poppler_annot_markup_get_type(void); +GType poppler_annot_text_get_type(void); +GType poppler_annot_free_text_get_type(void); +GType poppler_annot_file_attachment_get_type(void); +GType poppler_annot_movie_get_type(void); +GType poppler_annot_screen_get_type(void); +GType poppler_attachment_get_type(void); +GType poppler_document_get_type(void); +GType poppler_font_info_get_type(void); +GType poppler_form_field_get_type(void); +GType poppler_layer_get_type(void); +GType poppler_media_get_type(void); +GType poppler_movie_get_type(void); +GType poppler_page_get_type(void); +GType poppler_ps_file_get_type(void); + +//Declarations of the *_error_quark() functions: + +GQuark poppler_error_quark(void); +} // extern "C" + +namespace Poppler { + +//Declarations of the *_Class::wrap_new() methods, instead of including all the private headers: + +class Annot_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; +class AnnotMarkup_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; +class AnnotText_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; +class AnnotFreeText_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; +class AnnotFileAttachment_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; +class AnnotMovie_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; +class AnnotScreen_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; +class Attachment_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; +class Document_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; +class FontInfo_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; +class FormField_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; +class Layer_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; +class Media_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; +class Movie_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; +class Page_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; +class PSFile_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; + +void wrap_init() +{ + // Register Error domains in the main namespace: + Glib::Error::register_domain(poppler_error_quark(), &Error::throw_func); + + // Map gtypes to gtkmm wrapper-creation functions: + Glib::wrap_register(poppler_annot_get_type(), &Annot_Class::wrap_new); + Glib::wrap_register(poppler_annot_markup_get_type(), &AnnotMarkup_Class::wrap_new); + Glib::wrap_register(poppler_annot_text_get_type(), &AnnotText_Class::wrap_new); + Glib::wrap_register(poppler_annot_free_text_get_type(), &AnnotFreeText_Class::wrap_new); + Glib::wrap_register(poppler_annot_file_attachment_get_type(), &AnnotFileAttachment_Class::wrap_new); + Glib::wrap_register(poppler_annot_movie_get_type(), &AnnotMovie_Class::wrap_new); + Glib::wrap_register(poppler_annot_screen_get_type(), &AnnotScreen_Class::wrap_new); + Glib::wrap_register(poppler_attachment_get_type(), &Attachment_Class::wrap_new); + Glib::wrap_register(poppler_document_get_type(), &Document_Class::wrap_new); + Glib::wrap_register(poppler_font_info_get_type(), &FontInfo_Class::wrap_new); + Glib::wrap_register(poppler_form_field_get_type(), &FormField_Class::wrap_new); + Glib::wrap_register(poppler_layer_get_type(), &Layer_Class::wrap_new); + Glib::wrap_register(poppler_media_get_type(), &Media_Class::wrap_new); + Glib::wrap_register(poppler_movie_get_type(), &Movie_Class::wrap_new); + Glib::wrap_register(poppler_page_get_type(), &Page_Class::wrap_new); + Glib::wrap_register(poppler_ps_file_get_type(), &PSFile_Class::wrap_new); + + // Register the gtkmm gtypes: + Annot::get_type(); + AnnotMarkup::get_type(); + AnnotText::get_type(); + AnnotFreeText::get_type(); + AnnotFileAttachment::get_type(); + AnnotMovie::get_type(); + AnnotScreen::get_type(); + Attachment::get_type(); + Document::get_type(); + FontInfo::get_type(); + FormField::get_type(); + Layer::get_type(); + Media::get_type(); + Movie::get_type(); + Page::get_type(); + PSFile::get_type(); + +} // wrap_init() + +} // Poppler + diff --git a/poppler-glib/poppler-glibmm/wrap_init.h b/poppler-glib/poppler-glibmm/wrap_init.h new file mode 100644 index 0000000..d57f8c0 --- /dev/null +++ b/poppler-glib/poppler-glibmm/wrap_init.h @@ -0,0 +1,24 @@ +/* Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef POPPLER_GLIBMM_WRAP_INIT_H_INCLUDED +#define POPPLER_GLIBMM_WRAP_INIT_H_INCLUDED + +namespace Poppler { void wrap_init(); } + +#endif /* !POPPLER_GLIBMM_WRAP_INIT_H_INCLUDED */ diff --git a/poppler-glib/poppler-glibmmconfig.h.in b/poppler-glib/poppler-glibmmconfig.h.in new file mode 100644 index 0000000..89c98d6 --- /dev/null +++ b/poppler-glib/poppler-glibmmconfig.h.in @@ -0,0 +1,10 @@ +/* This file is part of poppler-glibmm. */ + +/* Major version number of poppler-glibmm. */ +#undef POPPLER_GLIBMM_MAJOR_VERSION + +/* Micro version number of poppler-glibmm. */ +#undef POPPLER_GLIBMM_MICRO_VERSION + +/* Minor version number of poppler-glibmm. */ +#undef POPPLER_GLIBMM_MINOR_VERSION diff --git a/poppler-glib/src/Makefile.am b/poppler-glib/src/Makefile.am new file mode 100644 index 0000000..d4c4d5b --- /dev/null +++ b/poppler-glib/src/Makefile.am @@ -0,0 +1,23 @@ +## Copyright (c) 2010 Glenn Rice <glennrister@gmail.com> +## +## This file is part of poppler-glibmm. +## +## poppler-glibmm is free software: you can redistribute it and/or modify it +## under the terms of the GNU Lesser General Public License as published +## by the Free Software Foundation, either version 2.1 of the License, +## or (at your option) any later version. +## +## poppler-glibmm is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +## See the GNU Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public License +## along with this program. If not, see <http://www.gnu.org/licenses/>. + +binding_name = poppler-glibmm +wrap_init_flags = --namespace=Poppler --parent_dir=poppler-glibmm + +include $(srcdir)/filelist.am +include $(top_srcdir)/codegen/m4/filelist.am +include $(top_srcdir)/build/generate-binding.am diff --git a/poppler-glib/src/action.ccg b/poppler-glib/src/action.ccg new file mode 100644 index 0000000..4ea64cb --- /dev/null +++ b/poppler-glib/src/action.ccg @@ -0,0 +1,35 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +ActionLayer::ActionLayer() +{ + GLIBMM_INITIALIZE_STRUCT(gobject_, PopplerActionLayer); +} + +ActionLayer::ActionLayer(const PopplerActionLayer* gobject) +{ + if(gobject) + gobject_ = *gobject; + else + GLIBMM_INITIALIZE_STRUCT(gobject_, PopplerActionLayer); +} + +} // namespace Poppler diff --git a/poppler-glib/src/action.hg b/poppler-glib/src/action.hg new file mode 100644 index 0000000..4c1ca51 --- /dev/null +++ b/poppler-glib/src/action.hg @@ -0,0 +1,167 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +#include <poppler-glibmm/media.h> +#include <poppler-glibmm/movie.h> +#include <poppler-glibmm/layer.h> +#include <poppler-action.h> + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef union _PopplerAction PopplerAction; } +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +namespace Poppler +{ + +_WRAP_ENUM(ActionType, PopplerActionType) +_WRAP_ENUM(DestType, PopplerDestType) +_WRAP_ENUM(ActionMovieOperation, PopplerActionMovieOperation) +_WRAP_ENUM(ActionLayerAction, PopplerActionLayerAction) + +/** Poppler::Dest is a structure for holding a destination + */ +class Dest +{ + _CLASS_BOXEDTYPE(Dest, PopplerDest, NONE, poppler_dest_copy, poppler_dest_free) + + public: + _MEMBER_GET(dest_type, type, DestType, PopplerDestType) + _MEMBER_SET(dest_type, type, DestType, PopplerDestType) + + _MEMBER_GET(page_num, page_num, int, int) + _MEMBER_SET(page_num, page_num, int, int) + + _MEMBER_GET(left, left, double, double) + _MEMBER_SET(left, left, double, double) + _MEMBER_GET(bottom, bottom, double, double) + _MEMBER_SET(bottom, bottom, double, double) + _MEMBER_GET(right, right, double, double) + _MEMBER_SET(right, right, double, double) + _MEMBER_GET(top, top, double, double) + _MEMBER_SET(top, top, double, double) + _MEMBER_GET(zoom, zoom, double, double) + _MEMBER_SET(zoom, zoom, double, double) + + _MEMBER_GET(named_dest, named_dest, Glib::ustring, gchar*) + _MEMBER_SET(named_dest, named_dest, Glib::ustring, gchar*) + + _MEMBER_GET(change_left, change_left, guint, guint) + _MEMBER_SET(change_left, change_left, guint, guint) + _MEMBER_GET(change_top, change_top, guint, guint) + _MEMBER_SET(change_top, change_top, guint, guint) + _MEMBER_GET(change_zoom, change_zoom, guint, guint) + _MEMBER_SET(change_zoom, change_zoom, guint, guint) + + /** Returns <tt>true</tt> if this Dest is valid, that is if the + * underlying instance is non-null. + * @return <tt>true</tt>, if the Dest is valid + */ + inline operator bool() const { return gobj() != NULL; }; +}; + +/** Poppler::ActionLayer - Layer actions + */ +class ActionLayer +{ + _CLASS_GENERIC(ActionLayer, PopplerActionLayer) + + public: + ActionLayer(); + + explicit ActionLayer(const PopplerActionLayer* gobject); // always takes a copy + + ///Provides access to the underlying C instance. + PopplerActionLayer* gobj() { return &gobject_; } + + ///Provides access to the underlying C instance. + const PopplerActionLayer* gobj() const { return &gobject_; } + + _MEMBER_GET(action, action, ActionLayerAction, PopplerActionLayerAction) +#m4 _CONVERSION(`Glist*',`std::vector< Glib::RefPtr<Layer> >', +#m4 `Glib::ListHandler< Glib::RefPtr<Layer> >::list_to_vector($3, Glib::OWNERSHIP_NONE)') + _MEMBER_GET(layers, layers, std::vector< Glib::RefPtr<Layer> >, GList*) + + protected: + PopplerActionLayer gobject_; +}; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +struct ActionLayerTraits +{ + typedef ActionLayer CppType; + typedef PopplerActionLayer* CType; + typedef PopplerActionLayer* CTypeNonConst; + + static CppType to_cpp_type(CType item) { return ActionLayer(item); } + static void release_c_type(CType) {}; +}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +/** Poppler::Action is a structure for holding an action + */ +class Action +{ + _CLASS_BOXEDTYPE(Action, PopplerAction, NONE, poppler_action_copy, poppler_action_free) + _CUSTOM_STRUCT_PROTOTYPE + + public: + _MEMBER_GET(action_type, type, ActionType, PopplerActionType) + _MEMBER_GET(title, any.title, Glib::ustring, gchar*) + + // PopplerActionGotoDest members + _MEMBER_GET(goto_dest_dest, goto_dest.dest, Dest, const PopplerDest*) + + // PopplerActionGotoRemote members + _MEMBER_GET(goto_remote_dest, goto_remote.dest, Dest, const PopplerDest*) + _MEMBER_GET(goto_remote_file_name, goto_remote.file_name, std::string, gchar*) + + // PopplerActionLaunch members + _MEMBER_GET(launch_file_name, launch.file_name, std::string, gchar*) + _MEMBER_GET(launch_params, launch.params, std::string, gchar*) + + // PopplerActionUri members + _MEMBER_GET(uri, uri.uri, std::string, gchar*) + + // PopplerActionNamed members + _MEMBER_GET(named_dest, named.named_dest, std::string, gchar*) + + // PopplerActionMovie members + _MEMBER_GET(movie_operation, movie.operation, ActionMovieOperation, PopplerActionMovieOperation) + _MEMBER_GET_GOBJECT(movie_movie, movie.movie, Movie, PopplerMovie*) + + // PopplerActionRendition members + _MEMBER_GET(rendition_op, rendition.op, int, gint) + _MEMBER_GET_GOBJECT(rendition_media, rendition.media, Media, PopplerMedia*) + + // PopplerActionOCGState members +#m4 _CONVERSION(`Glist*',`std::vector<ActionLayer>', +#m4 `Glib::ListHandler<ActionLayer,ActionLayerTraits>::list_to_vector($3, Glib::OWNERSHIP_NONE)') + _MEMBER_GET(ocg_state_list, ocg_state.state_list, std::vector<ActionLayer>, GList*) + + // PopplerActionJavascript members + _MEMBER_GET(javascript, javascript.script, std::string, gchar*) + + /** Returns <tt>true</tt> if this Action is valid, that is if the + * underlying instance is non-null. + * @return <tt>true</tt>, if the Action is valid + */ + inline operator bool() const { return gobj() != NULL; }; +}; + +} // namespace Poppler diff --git a/poppler-glib/src/annot.ccg b/poppler-glib/src/annot.ccg new file mode 100644 index 0000000..f63cee4 --- /dev/null +++ b/poppler-glib/src/annot.ccg @@ -0,0 +1,40 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +Glib::Date AnnotMarkup::get_date() const +{ + GDate* date = poppler_annot_markup_get_date(const_cast<PopplerAnnotMarkup*>(gobj())); + if (date) + { + Glib::Date ret_date(*date); + g_date_free(date); + return ret_date; + } + else return Glib::Date(); +} + +AnnotText::AnnotText(const Glib::RefPtr<Document>& document, const Rectangle& rect) +: + Poppler::AnnotMarkup((PopplerAnnotMarkup*)poppler_annot_text_new(document->gobj(), const_cast<PopplerRectangle*>(rect.gobj()))) +{ +} + +} // namespace Poppler diff --git a/poppler-glib/src/annot.hg b/poppler-glib/src/annot.hg new file mode 100644 index 0000000..fb62f61 --- /dev/null +++ b/poppler-glib/src/annot.hg @@ -0,0 +1,175 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +_PINCLUDE(glibmm/private/object_p.h) +#include <glibmm/date.h> +#include <poppler-glibmm/color.h> +#include <poppler-glibmm/rectangle.h> +#include <poppler-glibmm/movie.h> +#include <poppler-glibmm/action.h> +#include <poppler-glibmm/attachment.h> +#include <poppler-glibmm/annot_callout_line.h> +_CC_INCLUDE(poppler-annot.h) +_CC_INCLUDE(poppler-glibmm/document.h) + +namespace Poppler +{ + +_WRAP_ENUM(AnnotType, PopplerAnnotType) +_WRAP_ENUM(AnnotFlag, PopplerAnnotFlag) +_WRAP_ENUM(AnnotExternalDataType, PopplerAnnotExternalDataType) +_WRAP_ENUM(AnnotMarkupReplyType, PopplerAnnotMarkupReplyType) +_WRAP_ENUM(AnnotTextState, PopplerAnnotTextState) +_WRAP_ENUM(AnnotFreeTextQuadding, PopplerAnnotFreeTextQuadding) + +class Document; + +/** Poppler::Annot - Annotations + */ +class Annot : public Glib::Object +{ + _CLASS_GOBJECT(Annot, PopplerAnnot, POPPLER_ANNOT, Glib::Object, GObject) + + protected: + _CTOR_DEFAULT + + public: + _WRAP_METHOD(AnnotType get_annot_type() const, poppler_annot_get_annot_type) + _WRAP_METHOD(AnnotFlag get_flags() const, poppler_annot_get_flags) + _WRAP_METHOD(Glib::ustring get_name() const, poppler_annot_get_name) + _WRAP_METHOD(int get_page_index() const, poppler_annot_get_page_index) + _WRAP_METHOD(Color get_color() const, poppler_annot_get_color) + _WRAP_METHOD(void set_color(const Color& color) const, poppler_annot_set_color) + _WRAP_METHOD(Glib::ustring get_contents() const, poppler_annot_get_contents) + _WRAP_METHOD(void set_contents(const Glib::ustring& contents) const, poppler_annot_set_contents) + _WRAP_METHOD(Glib::ustring get_modified() const, poppler_annot_get_modified) +}; + +/** Poppler::AnnotMarkup - Markup Annotations + */ +class AnnotMarkup : public Annot +{ + _CLASS_GOBJECT(AnnotMarkup, PopplerAnnotMarkup, POPPLER_ANNOT_MARKUP, Poppler::Annot, PopplerAnnot) + + protected: + _CTOR_DEFAULT + + public: + _WRAP_METHOD(Glib::ustring get_label() const, poppler_annot_markup_get_label) + _WRAP_METHOD(void set_label(const Glib::ustring& label) const, poppler_annot_markup_set_label) + _WRAP_METHOD(Glib::ustring get_subject() const, poppler_annot_markup_get_subject) + _WRAP_METHOD(double get_opacity() const, poppler_annot_markup_get_opacity) + _WRAP_METHOD(void set_opacity(double opacity) const, poppler_annot_markup_set_opacity) + _WRAP_METHOD(bool has_popup() const, poppler_annot_markup_has_popup) + _WRAP_METHOD(void set_popup(const Rectangle& popup_rect) const, poppler_annot_markup_set_popup) + _WRAP_METHOD(bool get_popup_is_open() const, poppler_annot_markup_get_popup_is_open) + _WRAP_METHOD(void set_popup_is_open(bool is_open = true) const, poppler_annot_markup_set_popup_is_open) + _WRAP_METHOD(void get_popup_rectangle(Rectangle& popup_rect) const, poppler_annot_markup_get_popup_rectangle) + + _WRAP_METHOD_DOCS_ONLY(poppler_annot_markup_get_date) + Glib::Date get_date() const; + + _WRAP_METHOD(AnnotExternalDataType get_external_data() const, poppler_annot_markup_get_external_data) + _WRAP_METHOD(AnnotMarkupReplyType get_reply_to() const, poppler_annot_markup_get_reply_to) +}; + +/** Poppler::AnnotText - Text Annotations + */ +class AnnotText : public AnnotMarkup +{ + _CLASS_GOBJECT(AnnotText, PopplerAnnotText, POPPLER_ANNOT_TEXT, Poppler::AnnotMarkup, PopplerAnnotMarkup) + + protected: + _CTOR_DEFAULT + + /** Constructs a new text annotation that will be located on @a rect when + * added to a page. See Poppler::Page::add_annot() + * @param doc The document the text annotation will be added to. + * @param rect The location of the text annotation on the page. + */ + AnnotText(const Glib::RefPtr<Document>& document, const Rectangle& rect); + + public: + _WRAP_METHOD_DOCS_ONLY(poppler_annot_text_new) + _WRAP_CREATE(const Glib::RefPtr<Document>& document, const Rectangle& rect) + + _WRAP_METHOD(Glib::ustring get_icon() const, poppler_annot_text_get_icon) + _WRAP_METHOD(void set_icon(const Glib::ustring& icon) const, poppler_annot_text_set_icon) + _WRAP_METHOD(bool get_is_open() const, poppler_annot_text_get_is_open) + _WRAP_METHOD(void set_is_open(bool is_open = true) const, poppler_annot_text_set_is_open) + _WRAP_METHOD(AnnotTextState get_state() const, poppler_annot_text_get_state) +}; + +/** Poppler::AnnotFreeText - Text Annotations + */ +class AnnotFreeText : public AnnotMarkup +{ + _CLASS_GOBJECT(AnnotFreeText, PopplerAnnotFreeText, POPPLER_ANNOT_FREE_TEXT, Poppler::AnnotMarkup, PopplerAnnotMarkup) + + protected: + _CTOR_DEFAULT + + public: + _WRAP_METHOD(AnnotCalloutLine get_callout_line() const, poppler_annot_free_text_get_callout_line) + _WRAP_METHOD(AnnotFreeTextQuadding get_quadding() const, poppler_annot_free_text_get_quadding) +}; + +/** Poppler::AnnotFileAttachment - File Attachment Annotations +*/ +class AnnotFileAttachment : public AnnotMarkup +{ + _CLASS_GOBJECT(AnnotFileAttachment, PopplerAnnotFileAttachment, POPPLER_ANNOT_FILE_ATTACHMENT, Poppler::AnnotMarkup, PopplerAnnotMarkup) + + protected: + _CTOR_DEFAULT + + public: + _WRAP_METHOD(Glib::RefPtr<Attachment> get_attachment() const, poppler_annot_file_attachment_get_attachment) + _WRAP_METHOD(Glib::ustring get_name() const, poppler_annot_file_attachment_get_name) +}; + +/** Poppler::AnnotMovie - Movie Annotations +*/ +class AnnotMovie : public Annot +{ + _CLASS_GOBJECT(AnnotMovie, PopplerAnnotMovie, POPPLER_ANNOT_MOVIE, Poppler::Annot, PopplerAnnot) + + protected: + _CTOR_DEFAULT + + public: + _WRAP_METHOD(Glib::ustring get_title() const, poppler_annot_movie_get_title) + _WRAP_METHOD(Glib::RefPtr<Movie> get_movie() const, poppler_annot_movie_get_movie, refreturn) +}; + +/** Poppler::AnnotScreen - Screen Annotations +*/ +class AnnotScreen : public Annot +{ + _CLASS_GOBJECT(AnnotScreen, PopplerAnnotScreen, POPPLER_ANNOT_SCREEN, Poppler::Annot, PopplerAnnot) + + protected: + _CTOR_DEFAULT + + public: +#m4 _CONVERSION(`PopplerAction*',`Action',`Glib::wrap($3, true)') + _WRAP_METHOD(Action get_action() const, poppler_annot_screen_get_action) +}; + +} // namespace Poppler diff --git a/poppler-glib/src/annot_callout_line.ccg b/poppler-glib/src/annot_callout_line.ccg new file mode 100644 index 0000000..1b22934 --- /dev/null +++ b/poppler-glib/src/annot_callout_line.ccg @@ -0,0 +1,22 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +} // namespace Poppler diff --git a/poppler-glib/src/annot_callout_line.hg b/poppler-glib/src/annot_callout_line.hg new file mode 100644 index 0000000..8e56c99 --- /dev/null +++ b/poppler-glib/src/annot_callout_line.hg @@ -0,0 +1,55 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +_CC_INCLUDE(poppler-annot.h) + +namespace Poppler +{ + +/** Poppler::AnnotCalloutLine - Annotation callout line + */ +class AnnotCalloutLine +{ + _CLASS_BOXEDTYPE(AnnotCalloutLine, PopplerAnnotCalloutLine, poppler_annot_callout_line_new, + poppler_annot_callout_line_copy, poppler_annot_callout_line_free) + + public: + _MEMBER_GET(multiline, multiline, bool, gboolean) + _MEMBER_SET(multiline, multiline, bool, gboolean) + + _MEMBER_GET(x1, x1, double, gdouble) + _MEMBER_SET(x1, x1, double, gdouble) + _MEMBER_GET(y1, y1, double, gdouble) + _MEMBER_SET(y1, y1, double, gdouble) + _MEMBER_GET(x2, x2, double, gdouble) + _MEMBER_SET(x2, x2, double, gdouble) + _MEMBER_GET(y2, y2, double, gdouble) + _MEMBER_SET(y2, y2, double, gdouble) + _MEMBER_GET(x3, x3, double, gdouble) + _MEMBER_GET(y3, y3, double, gdouble) + _MEMBER_SET(y3, y3, double, gdouble) + + /** Returns <tt>true</tt> if this AnnotCalloutLine is valid, that is if the + * underlying instance is non-null. + * @return <tt>true</tt>, if the AnnotCalloutLine is valid + */ + inline operator bool() const { return gobj() != NULL; }; +}; + +} // namespace Poppler diff --git a/poppler-glib/src/annot_mapping.ccg b/poppler-glib/src/annot_mapping.ccg new file mode 100644 index 0000000..4a44d0d --- /dev/null +++ b/poppler-glib/src/annot_mapping.ccg @@ -0,0 +1,24 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +void AnnotMappingTraits::release_c_type(CType item) { poppler_annot_mapping_free(item); } + +} // namespace Poppler diff --git a/poppler-glib/src/annot_mapping.hg b/poppler-glib/src/annot_mapping.hg new file mode 100644 index 0000000..69d300c --- /dev/null +++ b/poppler-glib/src/annot_mapping.hg @@ -0,0 +1,50 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +#include <poppler-glibmm/rectangle.h> +#include <poppler-glibmm/annot.h> +_CC_INCLUDE(poppler.h) + +namespace Poppler +{ + + /** A Poppler::AnnotMapping structure represents an annotation and its location on a page. + */ +class AnnotMapping +{ + _CLASS_BOXEDTYPE(AnnotMapping, PopplerAnnotMapping, poppler_annot_mapping_new, poppler_annot_mapping_copy, poppler_annot_mapping_free) + +public: + _MEMBER_GET(area, area, Rectangle, PopplerRectangle) + _MEMBER_GET_GOBJECT(annot, annot, Annot, PopplerAnnot*) +}; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +struct AnnotMappingTraits +{ + typedef AnnotMapping CppType; + typedef PopplerAnnotMapping* CType; + typedef PopplerAnnotMapping* CTypeNonConst; + + static CppType to_cpp_type(CType item) { return AnnotMapping(item); } + static void release_c_type(CType item); +}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Poppler diff --git a/poppler-glib/src/attachment.ccg b/poppler-glib/src/attachment.ccg new file mode 100644 index 0000000..3c08949 --- /dev/null +++ b/poppler-glib/src/attachment.ccg @@ -0,0 +1,59 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +static gboolean SignalProxy_attachment_save_callback(const gchar* buf, gsize count, gpointer data, GError**) +{ + Poppler::Attachment::SlotAttachmentSave* the_slot = static_cast<Poppler::Attachment::SlotAttachmentSave*>(data); + + try + { + return (*the_slot)(buf, count); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + return false; +} + +namespace Poppler +{ + +bool Attachment::save(const SlotAttachmentSave& slot) const +{ + GError* gerror = 0; + bool res; + + // Create a copy of the slot. + // A pointer to it will be passed through the callback's data parameter and + // deleted in the callback. + SlotAttachmentSave* slot_copy = new SlotAttachmentSave(slot); + + res = poppler_attachment_save_to_callback(const_cast<PopplerAttachment*>(gobj()), + &SignalProxy_attachment_save_callback, slot_copy, &gerror); + + delete slot_copy; + + if (gerror) + ::Glib::Error::throw_exception(gerror); + + return res; +} + +} // namespace Poppler diff --git a/poppler-glib/src/attachment.hg b/poppler-glib/src/attachment.hg new file mode 100644 index 0000000..1b078f1 --- /dev/null +++ b/poppler-glib/src/attachment.hg @@ -0,0 +1,68 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +_PINCLUDE(glibmm/private/object_p.h) +_CC_INCLUDE(poppler-attachment.h) + +namespace Poppler +{ + +/** Poppler::Attachment - Attachments + */ +class Attachment : public Glib::Object +{ + _CLASS_GOBJECT(Attachment, PopplerAttachment, POPPLER_ATTACHMENT, Glib::Object, GObject) + + protected: + _CTOR_DEFAULT + + public: + /** A signal handler would be, for instance: + * bool on_attachment_save(const gchar* buf, gsize count); + */ + typedef sigc::slot<bool, const gchar*, gsize> SlotAttachmentSave; + + /** Saves attachment to a file indicated by @a filename. If an error + * occurs, <tt>false</tt> will be returned. + * @newin{0,14} + * @param filename Name of file to save. + * @return <tt>true</tt>, if the file successfully saved. + * @throws Glib::FileError + */ + _WRAP_METHOD(bool save(const std::string& filename) const, poppler_attachment_save, errthrow) + + _MEMBER_GET(name, name, Glib::ustring, const gchar*) + _MEMBER_GET(description, description, Glib::ustring, const gchar*) + _MEMBER_GET(size, size, gsize, gsize) + _MEMBER_GET(mtime, mtime, GTime, GTime) + _MEMBER_GET(ctime, ctime, GTime, GTime) + _MEMBER_GET(checksum, checksum->str, std::string, gchar*) + + /** Saves attachment by feeding the produced data to the slot save + * function. Can be used when you want to store the attachment to something + * other than a file, such as an in-memory buffer or a socket. If an error + * occurs, <tt>false</tt> will be returned. + * @param slot A function that is called to save each block of data that the save routine generates. + * @return <tt>true</tt>, if the save successfully completed. + */ + bool save(const SlotAttachmentSave& slot) const; + _IGNORE(poppler_attachment_save_to_callback) +}; + +} // namespace Poppler diff --git a/poppler-glib/src/color.ccg b/poppler-glib/src/color.ccg new file mode 100644 index 0000000..50e9d2d --- /dev/null +++ b/poppler-glib/src/color.ccg @@ -0,0 +1,32 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +Color::Color(guint16 red, guint16 green, guint16 blue) +: + gobject_(poppler_color_new()) +{ + gobj()->red = red; + gobj()->green = green; + gobj()->blue = blue; +} + + +} // namespace Poppler diff --git a/poppler-glib/src/color.hg b/poppler-glib/src/color.hg new file mode 100644 index 0000000..49f96e1 --- /dev/null +++ b/poppler-glib/src/color.hg @@ -0,0 +1,50 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +_CC_INCLUDE(poppler.h) + +namespace Poppler +{ + +/** A Poppler::Color describes a RGB color. Color components are values between 0 and 65535 + */ +class Color +{ + _CLASS_BOXEDTYPE(Color, PopplerColor, poppler_color_new, poppler_color_copy, poppler_color_free) + + public: + /** Creates a new color instance with the given red, green, and blue color components. + */ + Color(guint16 red, guint16 green, guint16 blue); + + _MEMBER_GET(red, red, guint16, guint16) + _MEMBER_SET(red, red, guint16, guint16) + _MEMBER_GET(green, green, guint16, guint16) + _MEMBER_SET(green, green, guint16, guint16) + _MEMBER_GET(blue, blue, guint16, guint16) + _MEMBER_SET(blue, blue, guint16, guint16) + + /** Returns <tt>true</tt> if this Color is valid, that is if the + * underlying instance is non-null. + * @return <tt>true</tt>, if the Color is valid + */ + inline operator bool() const { return gobj() != NULL; }; +}; + +} // namespace Poppler diff --git a/poppler-glib/src/document.ccg b/poppler-glib/src/document.ccg new file mode 100644 index 0000000..1000b35 --- /dev/null +++ b/poppler-glib/src/document.ccg @@ -0,0 +1,53 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +Glib::RefPtr<Document> Document::new_from_data(const std::string& data, const std::string& password) +{ + // poppler_document_new_from_data does not copy the data and the data must exist + // for the entire life of the document so we duplicate and store it here. + Glib::ScopedPtr<char> tmp_str; + *(tmp_str.addr()) = g_strdup(data.c_str()); + GError* gerror = 0; + Glib::RefPtr<Document> retvalue = Glib::wrap(poppler_document_new_from_data(tmp_str.get(), + data.size(), password.c_str(), &gerror)); + if(gerror) + ::Glib::Error::throw_exception(gerror); + + if (retvalue) std::swap(*(retvalue->m_PDFString.addr()), *(tmp_str.addr())); + + return retvalue; +} + +bool Document::get_id(Glib::ustring& permanent_id, Glib::ustring& update_id) const +{ + Glib::ScopedPtr<gchar> permanent_id_array, update_id_array; + bool ret = poppler_document_get_id(const_cast<PopplerDocument*>(gobj()), permanent_id_array.addr(), update_id_array.addr()); + + if (ret) + { + permanent_id.assign(permanent_id_array.get(), permanent_id_array.get() + 32); + update_id.assign(update_id_array.get(), update_id_array.get() + 32); + } + + return ret; +} + +} // namespace Poppler diff --git a/poppler-glib/src/document.hg b/poppler-glib/src/document.hg new file mode 100644 index 0000000..594811e --- /dev/null +++ b/poppler-glib/src/document.hg @@ -0,0 +1,148 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +_CONFIGINCLUDE(poppler-glibmmconfig.h) +_PINCLUDE(glibmm/private/object_p.h) + +#include <glibmm/object.h> +#include <poppler-glibmm/page.h> +#include <poppler-glibmm/action.h> +#include <poppler-glibmm/attachment.h> +#include <poppler-glibmm/form_field.h> +#include <poppler-glibmm/font_info.h> +#include <poppler-glibmm/ps_file.h> +#include <poppler-glibmm/index_iter.h> +#include <poppler-glibmm/layers_iter.h> +_CC_INCLUDE(poppler-document.h) + +namespace Poppler +{ + +_WRAP_ENUM(PageLayout, PopplerPageLayout) +_WRAP_ENUM(PageMode, PopplerPageMode) +_WRAP_ENUM(ViewerPreferences, PopplerViewerPreferences) +_WRAP_ENUM(Permissions, PopplerPermissions) + +/** Poppler::Document is a class that provides access to information about a + * document + */ +class Document : public Glib::Object +{ + _CLASS_GOBJECT(Document, PopplerDocument, POPPLER_DOCUMENT, Glib::Object, GObject) + +protected: + _CTOR_DEFAULT + +public: + /** Creates a new Poppler::Document. If <tt>0</tt> is returned, then an exception will be thrown. + * @param uri Uri of the file to load. + * @param password Password to unlock the file with, or <tt>0</tt>. + * @return A newly created Poppler::Document, or <tt>0</tt>. + * @throws Poppler::Error and Glib::FileError + */ + _WRAP_METHOD(static Glib::RefPtr<Document> new_from_file(const std::string& uri, const std::string& password = ""), + poppler_document_new_from_file, errthrow) + + /** Creates a new Poppler::Document. If <tt>0</tt> is returned, then an exception will be thrown. + * @param data The pdf data contained in a string. + * @param password Password to unlock the file with. + * @return A newly created Poppler::Document, or <tt>0</tt>. + * @throws Poppler::Error and Glib::FileError + */ + static Glib::RefPtr<Document> new_from_data(const std::string& data, const std::string& password = ""); + + /** Saves document. Any change made in the document such as form fields + * filled, annotations added or modified will be saved. + * If an error occurs, <tt>false</tt> will be returned. + * @param uri Uri of file to save. + * @return <tt>true</tt>, if the document was successfully saved. + * @throws Glib::FileError + */ + _WRAP_METHOD(bool save(const std::string& uri) const, poppler_document_save, errthrow) + + /** Saves a copy of the original @a document. Any change made in the + * document such as form fields filled by the user will not be saved. + * If an error occurs, <tt>false</tt> will be returned. + * @param uri Uri of file to save. + * @return <tt>true</tt>, if the document was successfully saved. + * @throws Glib::FileError + */ + _WRAP_METHOD(bool save_a_copy(const std::string& uri) const, poppler_document_save_a_copy, errthrow) + + _WRAP_METHOD_DOCS_ONLY(poppler_document_get_id) + bool get_id(Glib::ustring& permanent_id, Glib::ustring& update_id) const; + + _WRAP_METHOD(Glib::ustring get_pdf_version_string() const, poppler_document_get_pdf_version_string) + _WRAP_METHOD(void get_pdf_version(guint& major_version, guint& minor_version) const, poppler_document_get_pdf_version) + _WRAP_METHOD(Glib::ustring get_title() const, poppler_document_get_title) + _WRAP_METHOD(Glib::ustring get_author() const, poppler_document_get_author) + _WRAP_METHOD(Glib::ustring get_subject() const, poppler_document_get_subject) + _WRAP_METHOD(Glib::ustring get_keywords() const, poppler_document_get_keywords) + _WRAP_METHOD(Glib::ustring get_creator() const, poppler_document_get_creator) + _WRAP_METHOD(Glib::ustring get_producer() const, poppler_document_get_producer) + _WRAP_METHOD(time_t get_creation_date() const, poppler_document_get_creation_date) + _WRAP_METHOD(time_t get_modification_date() const, poppler_document_get_modification_date) + _WRAP_METHOD(PageLayout get_page_layout() const, poppler_document_get_page_layout) + _WRAP_METHOD(PageMode get_page_mode() const, poppler_document_get_page_mode) + _WRAP_METHOD(Permissions get_permissions() const, poppler_document_get_permissions) + _WRAP_METHOD(Glib::ustring get_metadata() const, poppler_document_get_metadata) + _WRAP_METHOD(bool is_linearized() const, poppler_document_is_linearized) + _WRAP_METHOD(int get_n_pages() const, poppler_document_get_n_pages) + _WRAP_METHOD(Glib::RefPtr<Page> get_page(int index) const, poppler_document_get_page) + _WRAP_METHOD(Glib::RefPtr<Page> get_page_by_label(const Glib::ustring& label) const, poppler_document_get_page_by_label) + _WRAP_METHOD(Dest find_dest(const Glib::ustring& link_name) const, poppler_document_find_dest) + _WRAP_METHOD(guint get_n_attachments() const, poppler_document_get_n_attachments) + _WRAP_METHOD(bool has_attachments() const, poppler_document_has_attachments) + +#m4 _CONVERSION(`Glist*',`std::vector< Glib::RefPtr<Attachment> >', +#m4 `Glib::ListHandler< Glib::RefPtr<Attachment> >::list_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(std::vector< Glib::RefPtr<Attachment> > get_attachments() const, poppler_document_get_attachments) + + _WRAP_METHOD(Glib::RefPtr<FormField> get_form_field(int id) const, poppler_document_get_form_field) + _WRAP_METHOD(IndexIter index_iter_new() const, poppler_index_iter_new) + _WRAP_METHOD(Glib::RefPtr<FontInfo> get_font_info() const, poppler_font_info_new) + _WRAP_METHOD(LayersIter layers_iter_new() const, poppler_layers_iter_new) + _WRAP_METHOD(Glib::RefPtr<PSFile> ps_file_new(const std::string& filename, int first_page, int n_pages) const, + poppler_ps_file_new) + + _WRAP_PROPERTY("author", Glib::ustring) + _WRAP_PROPERTY("creation_date", int) + _WRAP_PROPERTY("creator", Glib::ustring) + _WRAP_PROPERTY("format", Glib::ustring) + _WRAP_PROPERTY("format_major", unsigned int) + _WRAP_PROPERTY("format_minor", unsigned int) + _WRAP_PROPERTY("keywords", Glib::ustring) + _WRAP_PROPERTY("linearized", bool) + _WRAP_PROPERTY("metadata", Glib::ustring) + _WRAP_PROPERTY("mod_date", int) + _WRAP_PROPERTY("page_layout", PageLayout) + _WRAP_PROPERTY("page_mode", PageMode) + _WRAP_PROPERTY("permissions", Permissions) + _WRAP_PROPERTY("producer", Glib::ustring) + _WRAP_PROPERTY("subject", Glib::ustring) + _WRAP_PROPERTY("title", Glib::ustring) + _WRAP_PROPERTY("viewer_preferences", ViewerPreferences) + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +private: + Glib::ScopedPtr<char> m_PDFString; +#endif +}; + +} // namespace Poppler diff --git a/poppler-glib/src/error.ccg b/poppler-glib/src/error.ccg new file mode 100644 index 0000000..1b22934 --- /dev/null +++ b/poppler-glib/src/error.ccg @@ -0,0 +1,22 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +} // namespace Poppler diff --git a/poppler-glib/src/error.hg b/poppler-glib/src/error.hg new file mode 100644 index 0000000..e680f97 --- /dev/null +++ b/poppler-glib/src/error.hg @@ -0,0 +1,29 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +_CC_INCLUDE(poppler.h) + +namespace Poppler +{ + +/** Error codes returned by Poppler::Document + */ +_WRAP_GERROR(Error, PopplerError, POPPLER_ERROR) + +} // namespace Poppler diff --git a/poppler-glib/src/filelist.am b/poppler-glib/src/filelist.am new file mode 100644 index 0000000..31d9489 --- /dev/null +++ b/poppler-glib/src/filelist.am @@ -0,0 +1,38 @@ +## This file is part of poppler-glibmm. + +files_defs = \ + poppler-glib.defs \ + poppler-glib_enum.defs \ + poppler-glib_extra.defs \ + poppler-glib_method.defs \ + poppler-glib_docs.xml \ + poppler-glib_docs_override.xml + +files_hg = \ + action.hg \ + annot.hg \ + annot_callout_line.hg \ + annot_mapping.hg \ + attachment.hg \ + color.hg \ + document.hg \ + error.hg \ + font_info.hg \ + fonts_iter.hg \ + form_field.hg \ + form_field_mapping.hg \ + image_mapping.hg \ + index_iter.hg \ + layer.hg \ + layers_iter.hg \ + link_mapping.hg \ + media.hg \ + movie.hg \ + page.hg \ + page_transition.hg \ + ps_file.hg \ + rectangle.hg \ + text_attributes.hg \ + utility.hg + +files_ccg = $(files_hg:.hg=.ccg) diff --git a/poppler-glib/src/font_info.ccg b/poppler-glib/src/font_info.ccg new file mode 100644 index 0000000..1c53a7d --- /dev/null +++ b/poppler-glib/src/font_info.ccg @@ -0,0 +1,31 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +bool FontInfo::scan(int n_pages, FontsIter& iter) const +{ + PopplerFontsIter* iter_ptr; + bool ret = poppler_font_info_scan(const_cast<PopplerFontInfo*>(gobj()), n_pages, &iter_ptr); + FontsIter temp(iter_ptr, false); + iter.swap(temp); + return ret; +} + +} // namespace Poppler diff --git a/poppler-glib/src/font_info.hg b/poppler-glib/src/font_info.hg new file mode 100644 index 0000000..702c7aa --- /dev/null +++ b/poppler-glib/src/font_info.hg @@ -0,0 +1,65 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +_PINCLUDE(glibmm/private/object_p.h) +#include <poppler-glibmm/fonts_iter.h> +_CC_INCLUDE(poppler.h) + +namespace Poppler +{ + +/** A Poppler::FontInfo is used to scan for the fonts contained in a document + * + * Here is a simple example of code to scan fonts in a document + * + * @code + * Glib::RefPtr<Poppler::FontInfo> font_info = document->get_font_info(); + * Poppler::FontsIter fonts_iter; + * while (font_info->scan(20, fonts_iter)) + * { + * if (!fonts_iter) continue; // No fonts found in these 20 pages + * do + * { + * // Do something with font iter + * std::cout << "Font Name: " << fonts_iter.get_name() << std::endl; + * } while (fonst_iter.next()); + * } + * @endcode + */ +class FontInfo : public Glib::Object +{ + _CLASS_GOBJECT(FontInfo, PopplerFontInfo, POPPLER_FONT_INFO, Glib::Object, GObject) + + protected: + _CTOR_DEFAULT + + public: + /** Scans the document associated with @a FontInfo for fonts. At most + * @a n_pages will be scanned starting from the current iterator. @a iter will + * point to the first font scanned. + * @param n_pages Number of pages to scan. + * @param iter Return location for a Poppler::FontsIter. + * @return <tt>true</tt>, if there are more fonts left to scan. + */ + bool scan(int n_pages, FontsIter& iter) const; + + _IGNORE(poppler_font_info_free, poppler_font_info_scan) +}; + +} // namespace Poppler diff --git a/poppler-glib/src/fonts_iter.ccg b/poppler-glib/src/fonts_iter.ccg new file mode 100644 index 0000000..1b22934 --- /dev/null +++ b/poppler-glib/src/fonts_iter.ccg @@ -0,0 +1,22 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +} // namespace Poppler diff --git a/poppler-glib/src/fonts_iter.hg b/poppler-glib/src/fonts_iter.hg new file mode 100644 index 0000000..1691cc0 --- /dev/null +++ b/poppler-glib/src/fonts_iter.hg @@ -0,0 +1,52 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +_CC_INCLUDE(poppler.h) + +namespace Poppler +{ + +_WRAP_ENUM(FontType, PopplerFontType) + +/** Poppler::FontsIter is used to iterate through the fonts found in a document + */ +class FontsIter +{ + _CLASS_BOXEDTYPE(FontsIter, PopplerFontsIter, NONE, poppler_fonts_iter_copy, poppler_fonts_iter_free) + _IGNORE(poppler_fonts_iter_copy, poppler_fonts_iter_free) + + public: + _WRAP_METHOD(Glib::ustring get_name() const, poppler_fonts_iter_get_name) + _WRAP_METHOD(Glib::ustring get_full_name() const, poppler_fonts_iter_get_full_name) + _WRAP_METHOD(FontType get_font_type() const, poppler_fonts_iter_get_font_type) + _WRAP_METHOD(Glib::ustring get_file_name() const, poppler_fonts_iter_get_file_name) + _WRAP_METHOD(bool is_embedded() const, poppler_fonts_iter_is_embedded) + _WRAP_METHOD(bool is_subset() const, poppler_fonts_iter_is_subset) + _WRAP_METHOD(bool next() const, poppler_fonts_iter_next) + _WRAP_METHOD(Glib::ustring get_substitute_name() const, poppler_fonts_iter_get_substitute_name) + _WRAP_METHOD(Glib::ustring get_encoding() const, poppler_fonts_iter_get_encoding) + + /** Returns <tt>true</tt> if this FontsIter points to fonts found in the + * associated document. + * @return <tt>true</tt>, if the FontsIter is valid + */ + inline operator bool() const { return gobj() != NULL; }; +}; + +} // namespace Poppler diff --git a/poppler-glib/src/form_field.ccg b/poppler-glib/src/form_field.ccg new file mode 100644 index 0000000..1b22934 --- /dev/null +++ b/poppler-glib/src/form_field.ccg @@ -0,0 +1,22 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +} // namespace Poppler diff --git a/poppler-glib/src/form_field.hg b/poppler-glib/src/form_field.hg new file mode 100644 index 0000000..e38d420 --- /dev/null +++ b/poppler-glib/src/form_field.hg @@ -0,0 +1,81 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +_PINCLUDE(glibmm/private/object_p.h) +#include <poppler-glibmm/action.h> +_CC_INCLUDE(poppler-form-field.h) + +namespace Poppler +{ + +_WRAP_ENUM(FormFieldType, PopplerFormFieldType) +_WRAP_ENUM(FormButtonType, PopplerFormButtonType) +_WRAP_ENUM(FormTextType, PopplerFormTextType) +_WRAP_ENUM(FormChoiceType, PopplerFormChoiceType) + +/** Poppler::FormField is used to find information about and manipulate form fields in pdf documents + */ +class FormField : public Glib::Object +{ + _CLASS_GOBJECT(FormField, PopplerFormField, POPPLER_FORM_FIELD, Glib::Object, GObject) + + protected: + _CTOR_DEFAULT + + public: + _WRAP_METHOD(FormFieldType get_field_type() const, poppler_form_field_get_field_type) + _WRAP_METHOD(int get_id() const, poppler_form_field_get_id) + _WRAP_METHOD(bool is_read_only() const, poppler_form_field_is_read_only) + _WRAP_METHOD(double get_font_size() const, poppler_form_field_get_font_size) + _WRAP_METHOD(Glib::ustring get_partial_name() const, poppler_form_field_get_partial_name) + _WRAP_METHOD(Glib::ustring get_mapping_name() const, poppler_form_field_get_mapping_name) + _WRAP_METHOD(Glib::ustring get_name() const, poppler_form_field_get_name) + +#m4 _CONVERSION(`PopplerAction*',`Action',`Glib::wrap($3, true)') + _WRAP_METHOD(Action get_action() const, poppler_form_field_get_action) + + _WRAP_METHOD(FormButtonType button_get_button_type() const, poppler_form_field_button_get_button_type) + _WRAP_METHOD(bool button_get_state() const, poppler_form_field_button_get_state) + _WRAP_METHOD(void button_set_state(bool state) const, poppler_form_field_button_set_state) + + _WRAP_METHOD(FormChoiceType choice_get_choice_type() const, poppler_form_field_choice_get_choice_type) + _WRAP_METHOD(bool choice_can_select_multiple() const, poppler_form_field_choice_can_select_multiple) + _WRAP_METHOD(bool choice_commit_on_change() const, poppler_form_field_choice_commit_on_change) + _WRAP_METHOD(bool choice_do_spell_check() const, poppler_form_field_choice_do_spell_check) + _WRAP_METHOD(Glib::ustring choice_get_item(int index) const, poppler_form_field_choice_get_item) + _WRAP_METHOD(int choice_get_n_items() const, poppler_form_field_choice_get_n_items) + _WRAP_METHOD(Glib::ustring choice_get_text() const, poppler_form_field_choice_get_text) + _WRAP_METHOD(void choice_set_text(const Glib::ustring& text) const, poppler_form_field_choice_set_text) + _WRAP_METHOD(bool choice_is_editable() const, poppler_form_field_choice_is_editable) + _WRAP_METHOD(bool choice_is_item_selected(int index) const, poppler_form_field_choice_is_item_selected) + _WRAP_METHOD(void choice_select_item(int index) const, poppler_form_field_choice_select_item) + _WRAP_METHOD(void choice_toggle_item(int index) const, poppler_form_field_choice_toggle_item) + _WRAP_METHOD(void choice_unselect_all() const, poppler_form_field_choice_unselect_all) + + _WRAP_METHOD(FormTextType text_get_text_type() const, poppler_form_field_text_get_text_type) + _WRAP_METHOD(Glib::ustring text_get_text() const, poppler_form_field_text_get_text) + _WRAP_METHOD(void text_set_text(const Glib::ustring& text) const, poppler_form_field_text_set_text) + _WRAP_METHOD(int text_get_max_len() const, poppler_form_field_text_get_max_len) + _WRAP_METHOD(bool text_do_scroll() const, poppler_form_field_text_do_scroll) + _WRAP_METHOD(bool text_do_spell_check() const, poppler_form_field_text_do_spell_check) + _WRAP_METHOD(bool text_is_password() const, poppler_form_field_text_is_password) + _WRAP_METHOD(bool text_is_rich_text() const, poppler_form_field_text_is_rich_text) +}; + +} // namespace Poppler diff --git a/poppler-glib/src/form_field_mapping.ccg b/poppler-glib/src/form_field_mapping.ccg new file mode 100644 index 0000000..631d66c --- /dev/null +++ b/poppler-glib/src/form_field_mapping.ccg @@ -0,0 +1,24 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +void FormFieldMappingTraits::release_c_type(CType item) { poppler_form_field_mapping_free(item); } + +} // namespace Poppler diff --git a/poppler-glib/src/form_field_mapping.hg b/poppler-glib/src/form_field_mapping.hg new file mode 100644 index 0000000..e1472e8 --- /dev/null +++ b/poppler-glib/src/form_field_mapping.hg @@ -0,0 +1,50 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +#include <poppler-glibmm/rectangle.h> +#include <poppler-glibmm/form_field.h> +_CC_INCLUDE(poppler.h) + +namespace Poppler +{ + + /** A Poppler::FormFieldMapping structure represents a field and its location on a page. + */ +class FormFieldMapping +{ + _CLASS_BOXEDTYPE(FormFieldMapping, PopplerFormFieldMapping, poppler_form_field_mapping_new, poppler_form_field_mapping_copy, poppler_form_field_mapping_free) + +public: + _MEMBER_GET(area, area, Rectangle, PopplerRectangle) + _MEMBER_GET_GOBJECT(field, field, FormField, PopplerFormField*) +}; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +struct FormFieldMappingTraits +{ + typedef FormFieldMapping CppType; + typedef PopplerFormFieldMapping* CType; + typedef PopplerFormFieldMapping* CTypeNonConst; + + static CppType to_cpp_type(CType item) { return FormFieldMapping(item); } + static void release_c_type(CType item); +}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Poppler diff --git a/poppler-glib/src/image_mapping.ccg b/poppler-glib/src/image_mapping.ccg new file mode 100644 index 0000000..c2f8674 --- /dev/null +++ b/poppler-glib/src/image_mapping.ccg @@ -0,0 +1,24 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +void ImageMappingTraits::release_c_type(CType item) { poppler_image_mapping_free(item); } + +} // namespace Poppler diff --git a/poppler-glib/src/image_mapping.hg b/poppler-glib/src/image_mapping.hg new file mode 100644 index 0000000..e3c41df --- /dev/null +++ b/poppler-glib/src/image_mapping.hg @@ -0,0 +1,49 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +#include <poppler-glibmm/rectangle.h> +_CC_INCLUDE(poppler.h) + +namespace Poppler +{ + + /** A Poppler::ImageMapping structure represents an image and its location on a page. + */ +class ImageMapping +{ + _CLASS_BOXEDTYPE(ImageMapping, PopplerImageMapping, poppler_image_mapping_new, poppler_image_mapping_copy, poppler_image_mapping_free) + +public: + _MEMBER_GET(area, area, Rectangle, PopplerRectangle) + _MEMBER_GET(image_id, image_id, int, gint) +}; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +struct ImageMappingTraits +{ + typedef ImageMapping CppType; + typedef PopplerImageMapping* CType; + typedef PopplerImageMapping* CTypeNonConst; + + static CppType to_cpp_type(CType item) { return ImageMapping(item); } + static void release_c_type(CType item); +}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Poppler diff --git a/poppler-glib/src/index_iter.ccg b/poppler-glib/src/index_iter.ccg new file mode 100644 index 0000000..1b22934 --- /dev/null +++ b/poppler-glib/src/index_iter.ccg @@ -0,0 +1,22 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +} // namespace Poppler diff --git a/poppler-glib/src/index_iter.hg b/poppler-glib/src/index_iter.hg new file mode 100644 index 0000000..e54b021 --- /dev/null +++ b/poppler-glib/src/index_iter.hg @@ -0,0 +1,72 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +_CC_INCLUDE(poppler.h) +#include <poppler-glibmm/action.h> + +namespace Poppler +{ + +/** Poppler::IndexIter is used to iterate through the index of a document + * + * Certain documents have an index associated with them. This index can be + * used to help the user navigate the document, and is similar to a table of + * contents. Each node in the index will contain a Poppler::Action that can be + * displayed to the user - typically a Poppler::ACTION_GOTO_DEST or a + * Poppler::ACTION_URI. + * + * Here is a simple example of some code that walks the full index: + * + * @code + * void walk_index(const Poppler::IndexIter& iter) + * { + * do + * { + * // Get the the action and do something with it + * IndexIter child = iter.get_child(); + * if (child) walk_index(child); + * } + * while (iter.next()); + * } + * ... + * { + * IndexIter iter = document->index_iter_new(); + * if (iter) walk_index(iter); + * } + * @endcode + **/ +class IndexIter +{ + _CLASS_BOXEDTYPE(IndexIter, PopplerIndexIter, NONE, poppler_index_iter_copy, poppler_index_iter_free) + _IGNORE(poppler_index_iter_copy, poppler_index_iter_free) + + public: + _WRAP_METHOD(IndexIter get_child() const, poppler_index_iter_get_child) + _WRAP_METHOD(bool is_open() const, poppler_index_iter_is_open) + _WRAP_METHOD(Action get_action() const, poppler_index_iter_get_action) + _WRAP_METHOD(bool next() const, poppler_index_iter_next) + + /** Returns <tt>true</tt> if this IndexIter points contains valid + * information about indices of the associated document. + * @return <tt>true</tt>, if the IndexIter is valid + */ + inline operator bool() const { return gobj() != NULL; }; +}; + +} // namespace Poppler diff --git a/poppler-glib/src/layer.ccg b/poppler-glib/src/layer.ccg new file mode 100644 index 0000000..1b22934 --- /dev/null +++ b/poppler-glib/src/layer.ccg @@ -0,0 +1,22 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +} // namespace Poppler diff --git a/poppler-glib/src/layer.hg b/poppler-glib/src/layer.hg new file mode 100644 index 0000000..5aebdfe --- /dev/null +++ b/poppler-glib/src/layer.hg @@ -0,0 +1,44 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +_PINCLUDE(glibmm/private/object_p.h) +_CC_INCLUDE(poppler-layer.h) + +namespace Poppler +{ + +/** Poppler::Layer - Layers + */ +class Layer : public Glib::Object +{ + _CLASS_GOBJECT(Layer, PopplerLayer, POPPLER_LAYER, Glib::Object, GObject) + + protected: + _CTOR_DEFAULT + + public: + _WRAP_METHOD(Glib::ustring get_title() const, poppler_layer_get_title) + _WRAP_METHOD(bool is_visible() const, poppler_layer_is_visible) + _WRAP_METHOD(void show() const, poppler_layer_show) + _WRAP_METHOD(void hide() const, poppler_layer_hide) + _WRAP_METHOD(bool is_parent() const, poppler_layer_is_parent) + _WRAP_METHOD(int get_radio_button_group_id() const, poppler_layer_get_radio_button_group_id) +}; + +} // namespace Poppler diff --git a/poppler-glib/src/layers_iter.ccg b/poppler-glib/src/layers_iter.ccg new file mode 100644 index 0000000..1b22934 --- /dev/null +++ b/poppler-glib/src/layers_iter.ccg @@ -0,0 +1,22 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +} // namespace Poppler diff --git a/poppler-glib/src/layers_iter.hg b/poppler-glib/src/layers_iter.hg new file mode 100644 index 0000000..4080be4 --- /dev/null +++ b/poppler-glib/src/layers_iter.hg @@ -0,0 +1,46 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +#include <poppler-glibmm/layer.h> +_CC_INCLUDE(poppler.h) + +namespace Poppler +{ + +/** Poppler::LayersIter is used to iterate through the layers of a document + */ +class LayersIter +{ + _CLASS_BOXEDTYPE(LayersIter, PopplerLayersIter, NONE, poppler_layers_iter_copy, poppler_layers_iter_free) + _IGNORE(poppler_layers_iter_copy, poppler_layers_iter_free) + + public: + _WRAP_METHOD(LayersIter get_child() const, poppler_layers_iter_get_child) + _WRAP_METHOD(Glib::RefPtr<Layer> get_layer() const, poppler_layers_iter_get_layer) + _WRAP_METHOD(Glib::ustring get_title() const, poppler_layers_iter_get_title) + _WRAP_METHOD(bool next() const, poppler_layers_iter_next) + + /** Returns <tt>true</tt> if this LayersIter contains valid information + * about layers in the associated document. + * @return <tt>true</tt>, if the LayersIter is valid + */ + inline operator bool() const { return gobj() != NULL; }; +}; + +} // namespace Poppler diff --git a/poppler-glib/src/link_mapping.ccg b/poppler-glib/src/link_mapping.ccg new file mode 100644 index 0000000..3fceffb --- /dev/null +++ b/poppler-glib/src/link_mapping.ccg @@ -0,0 +1,24 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +void LinkMappingTraits::release_c_type(CType item) { poppler_link_mapping_free(item); } + +} // namespace Poppler diff --git a/poppler-glib/src/link_mapping.hg b/poppler-glib/src/link_mapping.hg new file mode 100644 index 0000000..9690345 --- /dev/null +++ b/poppler-glib/src/link_mapping.hg @@ -0,0 +1,50 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +#include <poppler-glibmm/rectangle.h> +#include <poppler-glibmm/action.h> +_CC_INCLUDE(poppler.h) + +namespace Poppler +{ + + /** A Poppler::LinkMapping structure represents an action and its location on a page. + */ +class LinkMapping +{ + _CLASS_BOXEDTYPE(LinkMapping, PopplerLinkMapping, poppler_link_mapping_new, poppler_link_mapping_copy, poppler_link_mapping_free) + +public: + _MEMBER_GET(area, area, Rectangle, PopplerRectangle) + _MEMBER_GET(action, action, Action, const PopplerAction*) +}; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +struct LinkMappingTraits +{ + typedef LinkMapping CppType; + typedef PopplerLinkMapping* CType; + typedef PopplerLinkMapping* CTypeNonConst; + + static CppType to_cpp_type(CType item) { return LinkMapping(item); } + static void release_c_type(CType item); +}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Poppler diff --git a/poppler-glib/src/media.ccg b/poppler-glib/src/media.ccg new file mode 100644 index 0000000..a340a21 --- /dev/null +++ b/poppler-glib/src/media.ccg @@ -0,0 +1,59 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +static gboolean SignalProxy_media_save_callback(const gchar* buf, gsize count, gpointer data, GError**) +{ + Poppler::Media::SlotMediaSave* the_slot = static_cast<Poppler::Media::SlotMediaSave*>(data); + + try + { + return (*the_slot)(buf, count); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + return false; +} + +namespace Poppler +{ + +bool Media::save(const SlotMediaSave& slot) const +{ + GError* gerror = 0; + bool res; + + // Create a copy of the slot. + // A pointer to it will be passed through the callback's data parameter and + // deleted in the callback. + SlotMediaSave* slot_copy = new SlotMediaSave(slot); + + res = poppler_media_save_to_callback(const_cast<PopplerMedia*>(gobj()), + &SignalProxy_media_save_callback, slot_copy, &gerror); + + delete slot_copy; + + if (gerror) + ::Glib::Error::throw_exception(gerror); + + return res; +} + +} // namespace Poppler diff --git a/poppler-glib/src/media.hg b/poppler-glib/src/media.hg new file mode 100644 index 0000000..99e34ca --- /dev/null +++ b/poppler-glib/src/media.hg @@ -0,0 +1,67 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +_PINCLUDE(glibmm/private/object_p.h) +_CC_INCLUDE(poppler-media.h) + +namespace Poppler +{ + +/** Poppler::Media - Media + */ +class Media : public Glib::Object +{ + _CLASS_GOBJECT(Media, PopplerMedia, POPPLER_MEDIA, Glib::Object, GObject) + + protected: + _CTOR_DEFAULT + + public: + _WRAP_METHOD(std::string get_filename() const, poppler_media_get_filename) + _WRAP_METHOD(std::string get_mime_type() const, poppler_media_get_mime_type) + _WRAP_METHOD(bool is_embedded() const, poppler_media_is_embedded) + + /** A signal handler would be, for instance: + * bool on_media_save(const gchar* buf, gsize count); + */ + typedef sigc::slot<bool, const gchar*, gsize> SlotMediaSave; + + /** Saves embedded stream of media to a file indicated by @a filename. If + * an error occurs, <tt>false</tt> will be returned. + * @newin{0,14} + * @param filename Name of file to save. + * @return <tt>true</tt>, if the file successfully saved. + * @throws Glib::FileError + */ + _WRAP_METHOD(bool save(const std::string& filename) const, poppler_media_save, errthrow) + + /** Saves embedded stream of media by feeding the produced data to slot save function. Can be used + * when you want to store the media clip stream to something other than a file, such as + * an in-memory buffer or a socket. If an error occurs, <tt>false</tt> will be + * returned. + * @newin{0,14} + * @param slot A function that is called to save each block of data that the save routine generates. + * @return <tt>true</tt>, if the save successfully completed. + * @throws Glib::FileError and any thrown by the save function + */ + bool save(const SlotMediaSave& slot) const; + _IGNORE(poppler_media_save_to_callback) +}; + +} // namespace Poppler diff --git a/poppler-glib/src/movie.ccg b/poppler-glib/src/movie.ccg new file mode 100644 index 0000000..1b22934 --- /dev/null +++ b/poppler-glib/src/movie.ccg @@ -0,0 +1,22 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +} // namespace Poppler diff --git a/poppler-glib/src/movie.hg b/poppler-glib/src/movie.hg new file mode 100644 index 0000000..643da50 --- /dev/null +++ b/poppler-glib/src/movie.hg @@ -0,0 +1,41 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +_PINCLUDE(glibmm/private/object_p.h) +_CC_INCLUDE(poppler-movie.h) + +namespace Poppler +{ + +/** Poppler::Movie - Movies + */ +class Movie : public Glib::Object +{ + _CLASS_GOBJECT(Movie, PopplerMovie, POPPLER_MOVIE, Glib::Object, GObject) + + protected: + _CTOR_DEFAULT + + public: + _WRAP_METHOD(std::string get_filename() const, poppler_movie_get_filename) + _WRAP_METHOD(bool need_poster() const, poppler_movie_need_poster) + _WRAP_METHOD(bool show_controls() const, poppler_movie_show_controls) +}; + +} // namespace Poppler diff --git a/poppler-glib/src/page.ccg b/poppler-glib/src/page.ccg new file mode 100644 index 0000000..108b9e8 --- /dev/null +++ b/poppler-glib/src/page.ccg @@ -0,0 +1,47 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +Cairo::RefPtr<Cairo::ImageSurface> Page::get_thumbnail() const +{ + cairo_surface_t* thumbnail = poppler_page_get_thumbnail(const_cast<PopplerPage*>(gobj())); + return thumbnail ? Cairo::RefPtr<Cairo::ImageSurface>(new Cairo::ImageSurface(thumbnail)) : + Cairo::RefPtr<Cairo::ImageSurface>(); +} + +Cairo::RefPtr<Cairo::ImageSurface> Page::get_image(int image_id) const +{ + cairo_surface_t* image = poppler_page_get_image(const_cast<PopplerPage*>(gobj()), image_id); + return image ? Cairo::RefPtr<Cairo::ImageSurface>(new Cairo::ImageSurface(image)) : + Cairo::RefPtr<Cairo::ImageSurface>(); +} + +bool Page::get_text_layout(std::vector<Rectangle>& rectangles) const +{ + Glib::ScopedPtr<PopplerRectangle> rect_array; + guint num_rects = 0; + bool ret = poppler_page_get_text_layout(const_cast<PopplerPage*>(gobj()), rect_array.addr(), &num_rects); + rectangles.reserve(num_rects * sizeof(Rectangle)); + for (guint i = 0; i < num_rects; ++i) + rectangles.push_back(Glib::wrap(&(rect_array.get())[i], true)); + return ret; +} + +} // namespace Poppler diff --git a/poppler-glib/src/page.hg b/poppler-glib/src/page.hg new file mode 100644 index 0000000..554b467 --- /dev/null +++ b/poppler-glib/src/page.hg @@ -0,0 +1,125 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +_PINCLUDE(glibmm/private/object_p.h) + +#include <cairomm/context.h> +#include <cairomm/region.h> +#include <poppler-glibmm/rectangle.h> +#include <poppler-glibmm/page_transition.h> +#include <poppler-glibmm/ps_file.h> +#include <poppler-glibmm/color.h> +#include <poppler-glibmm/text_attributes.h> +#include <poppler-glibmm/link_mapping.h> +#include <poppler-glibmm/image_mapping.h> +#include <poppler-glibmm/form_field_mapping.h> +#include <poppler-glibmm/annot_mapping.h> +_CC_INCLUDE(poppler-page.h) + +namespace Poppler +{ + +class Annot; + +_WRAP_ENUM(PrintFlags, PopplerPrintFlags) +_WRAP_ENUM(SelectionStyle, PopplerSelectionStyle) + +/** Poppler::Page is a class that provides access to information about a page + * in a document + */ +class Page : public Glib::Object +{ + _CLASS_GOBJECT(Page, PopplerPage, POPPLER_PAGE, Glib::Object, GObject) + +protected: + _CTOR_DEFAULT + +public: + _WRAP_METHOD(int get_index() const, poppler_page_get_index) + _WRAP_METHOD(Glib::ustring get_label() const, poppler_page_get_label) + _WRAP_METHOD(void get_size(double& width, double& height) const, poppler_page_get_size) + _WRAP_METHOD(void get_crop_box(Rectangle& rect) const, poppler_page_get_crop_box) + _WRAP_METHOD(double get_duration() const, poppler_page_get_duration) + _WRAP_METHOD(PageTransition get_transition() const, poppler_page_get_transition) + _WRAP_METHOD(bool get_thumbnail_size(int& width, int& height) const, poppler_page_get_thumbnail_size) + + _WRAP_METHOD_DOCS_ONLY(poppler_page_get_thumbnail) + Cairo::RefPtr<Cairo::ImageSurface> get_thumbnail() const; + + _WRAP_METHOD(void render(const Cairo::RefPtr<Cairo::Context>& cr) const, poppler_page_render) + _WRAP_METHOD(void render_for_printing(const Cairo::RefPtr<Cairo::Context>& cr) const, poppler_page_render_for_printing) + _WRAP_METHOD(void render_for_printing_with_options(const Cairo::RefPtr<Cairo::Context>& cr, PrintFlags options) const, + poppler_page_render_for_printing_with_options) + _WRAP_METHOD(void render_to_ps(const Glib::RefPtr<PSFile>& ps_file) const, poppler_page_render_to_ps) + _WRAP_METHOD(void render_selection(const Cairo::RefPtr<Cairo::Context>& cr, + const Rectangle& selection, const Rectangle& old_selection, SelectionStyle style, + const Color& glyph_color, const Color& background_color) const, + poppler_page_render_selection) + _WRAP_METHOD(Cairo::RefPtr<Cairo::Region> get_selected_region(double scale, SelectionStyle style, + const Rectangle& selection) const, + poppler_page_get_selected_region) + + _IGNORE(poppler_page_get_selection_region) // Deprecated + + _WRAP_METHOD(Glib::ustring get_selected_text(SelectionStyle style, const Rectangle& rectangle) const, + poppler_page_get_selected_text) + +#m4 _CONVERSION(`GList*',`std::vector<Rectangle>', +#m4 `Glib::ListHandler<Rectangle,RectangleTraits>::list_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(std::vector<Rectangle> find_text(const Glib::ustring& text) const, poppler_page_find_text) + + _WRAP_METHOD(Glib::ustring get_text() const, poppler_page_get_text) + + _WRAP_METHOD_DOCS_ONLY(poppler_page_get_text_layout) + bool get_text_layout(std::vector<Rectangle>& rectangles) const; + +#m4 _CONVERSION(`GList*',`std::vector<TextAttributes>', +#m4 `Glib::ListHandler<TextAttributes,TextAttributesTraits>::list_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(std::vector<TextAttributes> get_text_attributes() const, poppler_page_get_text_attributes) + _IGNORE(poppler_page_free_text_attributes) + +#m4 _CONVERSION(`GList*',`std::vector<LinkMapping>', +#m4 `Glib::ListHandler<LinkMapping,LinkMappingTraits>::list_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(std::vector<LinkMapping> get_link_mapping() const, poppler_page_get_link_mapping) + _IGNORE(poppler_page_free_link_mapping) + +#m4 _CONVERSION(`GList*',`std::vector<ImageMapping>', +#m4 `Glib::ListHandler<ImageMapping,ImageMappingTraits>::list_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(std::vector<ImageMapping> get_image_mapping() const, poppler_page_get_image_mapping) + _IGNORE(poppler_page_free_image_mapping) + + _WRAP_METHOD_DOCS_ONLY(poppler_page_get_image) + Cairo::RefPtr<Cairo::ImageSurface> get_image(int image_id) const; + +#m4 _CONVERSION(`GList*',`std::vector<FormFieldMapping>', +#m4 `Glib::ListHandler<FormFieldMapping,FormFieldMappingTraits>::list_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(std::vector<FormFieldMapping> get_form_field_mapping() const, poppler_page_get_form_field_mapping) + _IGNORE(poppler_page_free_form_field_mapping) + +#m4 _CONVERSION(`GList*',`std::vector<AnnotMapping>', +#m4 `Glib::ListHandler<AnnotMapping,AnnotMappingTraits>::list_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(std::vector<AnnotMapping> get_annot_mapping() const, poppler_page_get_annot_mapping) + _IGNORE(poppler_page_free_annot_mapping) + + _WRAP_METHOD(void add_annot(const Glib::RefPtr<Annot>& annot) const, poppler_page_add_annot) + + _WRAP_PROPERTY("label", Glib::ustring) +}; + +} // namespace Poppler diff --git a/poppler-glib/src/page_transition.ccg b/poppler-glib/src/page_transition.ccg new file mode 100644 index 0000000..1b22934 --- /dev/null +++ b/poppler-glib/src/page_transition.ccg @@ -0,0 +1,22 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +} // namespace Poppler diff --git a/poppler-glib/src/page_transition.hg b/poppler-glib/src/page_transition.hg new file mode 100644 index 0000000..5191ddf --- /dev/null +++ b/poppler-glib/src/page_transition.hg @@ -0,0 +1,60 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +_CC_INCLUDE(poppler-page.h) + +namespace Poppler +{ + +_WRAP_ENUM(PageTransitionType, PopplerPageTransitionType) +_WRAP_ENUM(PageTransitionAlignment, PopplerPageTransitionAlignment) +_WRAP_ENUM(PageTransitionDirection, PopplerPageTransitionDirection) + +/** Poppler::PageTransition is a structure that describes a visual transition + * to use when moving between pages during a presentation + */ +class PageTransition +{ + _CLASS_BOXEDTYPE(PageTransition, PopplerPageTransition, NONE, poppler_page_transition_copy, poppler_page_transition_free) + + public: + _MEMBER_GET(transition_type, type, PageTransitionType, PopplerPageTransitionType) + _MEMBER_SET(transition_type, type, PageTransitionType, PopplerPageTransitionType) + _MEMBER_GET(alignment, alignment, PageTransitionAlignment, PopplerPageTransitionAlignment) + _MEMBER_SET(alignment, alignment, PageTransitionAlignment, PopplerPageTransitionAlignment) + _MEMBER_GET(direction, direction, PageTransitionDirection, PopplerPageTransitionDirection) + _MEMBER_SET(direction, direction, PageTransitionDirection, PopplerPageTransitionDirection) + + _MEMBER_GET(duration, duration, int, int) + _MEMBER_SET(duration, duration, int, int) + _MEMBER_GET(angle, angle, int, int) + _MEMBER_SET(angle, angle, int, int) + _MEMBER_GET(scale, scale, double, double) + _MEMBER_SET(scale, scale, double, double) + _MEMBER_GET(rectangular, rectangular, bool, gboolean) + _MEMBER_SET(rectangular, rectangular, bool, gboolean) + + /** Returns <tt>true</tt> if this PageTransition is valid, that is if the + * underlying instance is non-null. + * @return <tt>true</tt>, if the PageTransition is valid + */ + inline operator bool() const { return gobj() != NULL; }; +}; + +} // namespace Poppler diff --git a/poppler-glib/src/poppler-glib.defs b/poppler-glib/src/poppler-glib.defs new file mode 100644 index 0000000..66466ec --- /dev/null +++ b/poppler-glib/src/poppler-glib.defs @@ -0,0 +1,4 @@ +;; Include generated API definition files +(include poppler-glib_enum.defs) +(include poppler-glib_method.defs) +(include poppler-glib_extra.defs) diff --git a/poppler-glib/src/poppler-glib_docs.xml b/poppler-glib/src/poppler-glib_docs.xml new file mode 100644 index 0000000..9ddb0a7 --- /dev/null +++ b/poppler-glib/src/poppler-glib_docs.xml @@ -0,0 +1,3782 @@ +<root> +<function name="poppler_action_copy"> +<description> +Copies @action, creating an identical #PopplerAction. + + +</description> +<parameters> +<parameter name="action"> +<parameter_description> a #PopplerAction +</parameter_description> +</parameter> +</parameters> +<return> a new action identical to @action +</return> +</function> + +<function name="poppler_action_free"> +<description> +Frees @action + +</description> +<parameters> +<parameter name="action"> +<parameter_description> a #PopplerAction +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_annot_callout_line_copy"> +<description> +It does copy @callout to a new #PopplerAnnotCalloutLine. + + +</description> +<parameters> +<parameter name="callout"> +<parameter_description> the #PopplerAnnotCalloutLine to be copied. +</parameter_description> +</parameter> +</parameters> +<return> a new allocated #PopplerAnnotCalloutLine as exact copy of +@callout, %NULL in other case. It must be freed when done. +</return> +</function> + +<function name="poppler_annot_callout_line_free"> +<description> +Frees the memory used by #PopplerAnnotCalloutLine. + +</description> +<parameters> +<parameter name="callout"> +<parameter_description> a #PopplerAnnotCalloutLine +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_annot_callout_line_new"> +<description> +Creates a new empty #PopplerAnnotCalloutLine. + + +</description> +<parameters> +</parameters> +<return> a new allocated #PopplerAnnotCalloutLine, %NULL in other case. +It must be freed when done. +</return> +</function> + +<function name="poppler_annot_file_attachment_get_attachment"> +<description> +Creates a #PopplerAttachment for the file of the file attachment annotation @annot. +The #PopplerAttachment must be unrefed with g_object_unref by the caller. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotFileAttachment +</parameter_description> +</parameter> +</parameters> +<return> @PopplerAttachment + +</return> +</function> + +<function name="poppler_annot_file_attachment_get_name"> +<description> +Retrieves the name of @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotFileAttachment +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string with the name of @poppler_annot. It must +be freed with g_free() when done. +</return> +</function> + +<function name="poppler_annot_free_text_get_callout_line"> +<description> +Retrieves a #PopplerAnnotCalloutLine of four or six numbers specifying a callout +line attached to the @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotFreeText +</parameter_description> +</parameter> +</parameters> +<return> a new allocated #PopplerAnnotCalloutLine if the annot has a callout +line, %NULL in other case. It must be freed with g_free() when +done. +</return> +</function> + +<function name="poppler_annot_free_text_get_quadding"> +<description> +Retrieves the justification of the text of @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotFreeText +</parameter_description> +</parameter> +</parameters> +<return> #PopplerAnnotFreeTextQuadding of @poppler_annot. +</return> +</function> + +<function name="poppler_annot_get_annot_type"> +<description> +Gets the type of @poppler_annot + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnot +</parameter_description> +</parameter> +</parameters> +<return> #PopplerAnnotType of @poppler_annot. +</return> +</function> + +<function name="poppler_annot_get_color"> +<description> +Retrieves the color of @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnot +</parameter_description> +</parameter> +</parameters> +<return> a new allocated #PopplerColor with the color values of +@poppler_annot, or %NULL. It must be freed with g_free() when done. +</return> +</function> + +<function name="poppler_annot_get_contents"> +<description> +Retrieves the contents of @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnot +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string with the contents of @poppler_annot. It +must be freed with g_free() when done. +</return> +</function> + +<function name="poppler_annot_get_flags"> +<description> +Retrieves the flag field specifying various characteristics of the +@poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnot +</parameter_description> +</parameter> +</parameters> +<return> the flag field of @poppler_annot. +</return> +</function> + +<function name="poppler_annot_get_modified"> +<description> +Retrieves the last modification data of @poppler_annot. The returned +string will be either a PDF format date or a text string. +See also #poppler_date_parse() + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnot +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string with the last modification data of +@poppler_annot. It must be freed with g_free() when done. +</return> +</function> + +<function name="poppler_annot_get_name"> +<description> +Retrieves the name of @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnot +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string with the name of @poppler_annot. It must +be freed with g_free() when done. +</return> +</function> + +<function name="poppler_annot_get_page_index"> +<description> +Returns the page index to which @poppler_annot is associated, or -1 if unknown + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnot +</parameter_description> +</parameter> +</parameters> +<return> page index or -1 + +</return> +</function> + +<function name="poppler_annot_mapping_copy"> +<description> +Creates a copy of @mapping + + +</description> +<parameters> +<parameter name="mapping"> +<parameter_description> a #PopplerAnnotMapping to copy +</parameter_description> +</parameter> +</parameters> +<return> a new allocated copy of @mapping +</return> +</function> + +<function name="poppler_annot_mapping_free"> +<description> +Frees the given #PopplerAnnotMapping + +</description> +<parameters> +<parameter name="mapping"> +<parameter_description> a #PopplerAnnotMapping +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_annot_mapping_new"> +<description> +Creates a new #PopplerAnnotMapping + + +</description> +<parameters> +</parameters> +<return> a new #PopplerAnnotMapping, use poppler_annot_mapping_free() to free it +</return> +</function> + +<function name="poppler_annot_markup_get_date"> +<description> +Returns the date and time when the annotation was created + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMarkup +</parameter_description> +</parameter> +</parameters> +<return> a #GDate representing the date and time +when the annotation was created, or %NULL +</return> +</function> + +<function name="poppler_annot_markup_get_external_data"> +<description> +Gets the external data type of @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMarkup +</parameter_description> +</parameter> +</parameters> +<return> #PopplerAnnotExternalDataType of @poppler_annot. +</return> +</function> + +<function name="poppler_annot_markup_get_label"> +<description> +Retrieves the label text of @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMarkup +</parameter_description> +</parameter> +</parameters> +<return> the label text of @poppler_annot. +</return> +</function> + +<function name="poppler_annot_markup_get_opacity"> +<description> +Retrieves the opacity value of @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMarkup +</parameter_description> +</parameter> +</parameters> +<return> the opacity value of @poppler_annot, +between 0 (transparent) and 1 (opaque) +</return> +</function> + +<function name="poppler_annot_markup_get_popup_is_open"> +<description> +Retrieves the state of the popup window related to @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMarkup +</parameter_description> +</parameter> +</parameters> +<return> the state of @poppler_annot. %TRUE if it's open, %FALSE in +other case. +</return> +</function> + +<function name="poppler_annot_markup_get_popup_rectangle"> +<description> +Retrieves the rectangle of the popup window related to @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMarkup +</parameter_description> +</parameter> +<parameter name="poppler_rect"> +<parameter_description> a #PopplerRectangle to store the popup rectangle +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if #PopplerRectangle was correctly filled, %FALSE otherwise + +</return> +</function> + +<function name="poppler_annot_markup_get_reply_to"> +<description> +Gets the reply type of @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMarkup +</parameter_description> +</parameter> +</parameters> +<return> #PopplerAnnotMarkupReplyType of @poppler_annot. +</return> +</function> + +<function name="poppler_annot_markup_get_subject"> +<description> +Retrives the subject text of @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMarkup +</parameter_description> +</parameter> +</parameters> +<return> the subject text of @poppler_annot. +</return> +</function> + +<function name="poppler_annot_markup_has_popup"> +<description> +Return %TRUE if the markup annotation has a popup window associated + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMarkup +</parameter_description> +</parameter> +</parameters> +<return> %TRUE, if @poppler_annot has popup, %FALSE otherwise + +</return> +</function> + +<function name="poppler_annot_markup_set_label"> +<description> +Sets the label text of @poppler_annot, replacing the current one + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMarkup +</parameter_description> +</parameter> +<parameter name="label"> +<parameter_description> a text string containing the new label, or %NULL +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_annot_markup_set_opacity"> +<description> +Sets the opacity of @poppler_annot. This value applies to +all visible elements of @poppler_annot in its closed state, +but not to the pop-up window that appears when it's openened + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMarkup +</parameter_description> +</parameter> +<parameter name="opacity"> +<parameter_description> a constant opacity value, between 0 (transparent) and 1 (opaque) +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_annot_markup_set_popup"> +<description> +Associates a new popup window for editing contents of @poppler_annot. +Popup window shall be displayed by viewers at @popup_rect on the page. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMarkup +</parameter_description> +</parameter> +<parameter name="popup_rect"> +<parameter_description> a #PopplerRectangle +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_annot_markup_set_popup_is_open"> +<description> +Sets the state of the popup window related to @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMarkup +</parameter_description> +</parameter> +<parameter name="is_open"> +<parameter_description> whether popup window should initially be displayed open +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_annot_movie_get_movie"> +<description> +Retrieves the movie object (PopplerMovie) stored in the @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMovie +</parameter_description> +</parameter> +</parameters> +<return> the movie object stored in the @poppler_annot. The returned +object is owned by #PopplerAnnotMovie and should not be freed + +</return> +</function> + +<function name="poppler_annot_movie_get_title"> +<description> +Retrieves the movie title of @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMovie +</parameter_description> +</parameter> +</parameters> +<return> the title text of @poppler_annot. + +</return> +</function> + +<function name="poppler_annot_screen_get_action"> +<description> +Retrieves the action (#PopplerAction) that shall be performed when @poppler_annot is activated + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotScreen +</parameter_description> +</parameter> +</parameters> +<return> the action to perform. The returned +object is owned by @poppler_annot and should not be freed + +</return> +</function> + +<function name="poppler_annot_set_color"> +<description> +Sets the color of @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnot +</parameter_description> +</parameter> +<parameter name="poppler_color"> +<parameter_description> a #PopplerColor, or %NULL +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_annot_set_contents"> +<description> +Sets the contents of @poppler_annot to the given value, +replacing the current contents. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnot +</parameter_description> +</parameter> +<parameter name="contents"> +<parameter_description> a text string containing the new contents +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_annot_text_get_icon"> +<description> +Gets name of the icon of @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotText +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string containing the icon name +</return> +</function> + +<function name="poppler_annot_text_get_is_open"> +<description> +Retrieves the state of @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotText +</parameter_description> +</parameter> +</parameters> +<return> the state of @poppler_annot. %TRUE if it's open, %FALSE in +other case. +</return> +</function> + +<function name="poppler_annot_text_get_state"> +<description> +Retrieves the state of @poppler_annot. + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotText +</parameter_description> +</parameter> +</parameters> +<return> #PopplerAnnotTextState of @poppler_annot. +</return> +</function> + +<function name="poppler_annot_text_new"> +<description> +Creates a new Text annotation that will be +located on @rect when added to a page. See +poppler_page_add_annot() + + +</description> +<parameters> +<parameter name="doc"> +<parameter_description> a #PopplerDocument +</parameter_description> +</parameter> +<parameter name="rect"> +<parameter_description> a #PopplerRectangle +</parameter_description> +</parameter> +</parameters> +<return> A newly created #PopplerAnnotText annotation + +</return> +</function> + +<function name="poppler_annot_text_set_icon"> +<description> +Sets the icon of @poppler_annot. The following predefined +icons are currently supported: +<variablelist> +<varlistentry> +<term>#POPPLER_ANNOT_TEXT_ICON_NOTE</term> +</varlistentry> +<varlistentry> +<term>#POPPLER_ANNOT_TEXT_ICON_COMMENT</term> +</varlistentry> +<varlistentry> +<term>#POPPLER_ANNOT_TEXT_ICON_KEY</term> +</varlistentry> +<varlistentry> +<term>#POPPLER_ANNOT_TEXT_ICON_HELP</term> +</varlistentry> +<varlistentry> +<term>#POPPLER_ANNOT_TEXT_ICON_NEW_PARAGRAPH</term> +</varlistentry> +<varlistentry> +<term>#POPPLER_ANNOT_TEXT_ICON_PARAGRAPH</term> +</varlistentry> +<varlistentry> +<term>#POPPLER_ANNOT_TEXT_ICON_INSERT</term> +</varlistentry> +<varlistentry> +<term>#POPPLER_ANNOT_TEXT_ICON_CROSS</term> +</varlistentry> +<varlistentry> +<term>#POPPLER_ANNOT_TEXT_ICON_CIRCLE</term> +</varlistentry> +</variablelist> + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotText +</parameter_description> +</parameter> +<parameter name="icon"> +<parameter_description> the name of an icon +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_annot_text_set_is_open"> +<description> +Sets whether @poppler_annot should initially be displayed open + + +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotText +</parameter_description> +</parameter> +<parameter name="is_open"> +<parameter_description> whether annotation should initially be displayed open +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_attachment_save"> +<description> +Saves @attachment to a file indicated by @filename. If @error is set, %FALSE +will be returned. Possible errors include those in the #G_FILE_ERROR domain +and whatever the save function generates. + + +</description> +<parameters> +<parameter name="attachment"> +<parameter_description> A #PopplerAttachment. +</parameter_description> +</parameter> +<parameter name="filename"> +<parameter_description> name of file to save +</parameter_description> +</parameter> +<parameter name="error"> +<parameter_description> return location for error, or %NULL. +</parameter_description> +</parameter> +</parameters> +<return> %TRUE, if the file successfully saved +</return> +</function> + +<function name="poppler_attachment_save_to_callback"> +<description> +Saves @attachment by feeding the produced data to @save_func. Can be used +when you want to store the attachment to something other than a file, such as +an in-memory buffer or a socket. If @error is set, %FALSE will be +returned. Possible errors include those in the #G_FILE_ERROR domain and +whatever the save function generates. + + +</description> +<parameters> +<parameter name="attachment"> +<parameter_description> A #PopplerAttachment. +</parameter_description> +</parameter> +<parameter name="save_func"> +<parameter_description> a function that is called to save each block of data that the save routine generates. +</parameter_description> +</parameter> +<parameter name="user_data"> +<parameter_description> user data to pass to the save function. +</parameter_description> +</parameter> +<parameter name="error"> +<parameter_description> return location for error, or %NULL. +</parameter_description> +</parameter> +</parameters> +<return> %TRUE, if the save successfully completed +</return> +</function> + +<function name="poppler_color_copy"> +<description> +Creates a copy of @color + + +</description> +<parameters> +<parameter name="color"> +<parameter_description> a #PopplerColor to copy +</parameter_description> +</parameter> +</parameters> +<return> a new allocated copy of @color +</return> +</function> + +<function name="poppler_color_free"> +<description> +Frees the given #PopplerColor + +</description> +<parameters> +<parameter name="color"> +<parameter_description> a #PopplerColor +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_color_new"> +<description> +Creates a new #PopplerColor + + +</description> +<parameters> +</parameters> +<return> a new #PopplerColor, use poppler_color_free() to free it +</return> +</function> + +<function name="poppler_date_parse"> +<description> +Parses a PDF format date string and converts it to a #time_t. Returns #FALSE +if the parsing fails or the input string is not a valid PDF format date string + + +</description> +<parameters> +<parameter name="date"> +<parameter_description> string to parse +</parameter_description> +</parameter> +<parameter name="timet"> +<parameter_description> an uninitialized #time_t +</parameter_description> +</parameter> +</parameters> +<return> #TRUE, if @timet was set + +</return> +</function> + +<function name="poppler_dest_copy"> +<description> +Copies @dest, creating an identical #PopplerDest. + + +</description> +<parameters> +<parameter name="dest"> +<parameter_description> a #PopplerDest +</parameter_description> +</parameter> +</parameters> +<return> a new destination identical to @dest +</return> +</function> + +<function name="poppler_dest_free"> +<description> +Frees @dest + +</description> +<parameters> +<parameter name="dest"> +<parameter_description> a #PopplerDest +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_document_find_dest"> +<description> +Finds named destination @link_name in @document + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +<parameter name="link_name"> +<parameter_description> a named destination +</parameter_description> +</parameter> +</parameters> +<return> The #PopplerDest destination or %NULL if +@link_name is not a destination. Returned value must +be freed with #poppler_dest_free +</return> +</function> + +<function name="poppler_document_get_attachments"> +<description> +Returns a #GList containing #PopplerAttachment<!-- -->s. These attachments +are unowned, and must be unreffed, and the list must be freed with +g_list_free(). + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> a list of available attachments. +</return> +</function> + +<function name="poppler_document_get_author"> +<description> +Returns the author of the document + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string containing the author +of @document, or %NULL + +</return> +</function> + +<function name="poppler_document_get_creation_date"> +<description> +Returns the date the document was created as seconds since the Epoch + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> the date the document was created, or -1 + +</return> +</function> + +<function name="poppler_document_get_creator"> +<description> +Returns the creator of the document. If the document was converted +from another format, the creator is the name of the product +that created the original document from which it was converted. + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string containing the creator +of @document, or %NULL + +</return> +</function> + +<function name="poppler_document_get_form_field"> +<description> +Returns the #PopplerFormField for the given @id. It must be freed with +g_object_unref() + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> a #PopplerDocument +</parameter_description> +</parameter> +<parameter name="id"> +<parameter_description> an id of a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> a new #PopplerFormField or %NULL if +not found +</return> +</function> + +<function name="poppler_document_get_id"> +<description> +Returns the PDF file identifier represented as two byte string arrays of size 32. +@permanent_id is the permanent identifier that is built based on the file +contents at the time it was originally created, so that this identifer +never changes. @update_id is the update identifier that is built based on +the file contents at the time it was last updated. + +Note that returned strings are not null-terminated, they have a fixed +size of 32 bytes. + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +<parameter name="permanent_id"> +<parameter_description> location to store an allocated string, use g_free() to free the returned string +</parameter_description> +</parameter> +<parameter name="update_id"> +<parameter_description> location to store an allocated string, use g_free() to free the returned string +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if the @document contains an id, %FALSE otherwise + +</return> +</function> + +<function name="poppler_document_get_keywords"> +<description> +Returns the keywords associated to the document + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string containing keywords associated +to @document, or %NULL + +</return> +</function> + +<function name="poppler_document_get_metadata"> +<description> +Returns the XML metadata string of the document + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string containing the XML +metadata, or %NULL + +</return> +</function> + +<function name="poppler_document_get_modification_date"> +<description> +Returns the date the document was most recently modified as seconds since the Epoch + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> the date the document was most recently modified, or -1 + +</return> +</function> + +<function name="poppler_document_get_n_attachments"> +<description> +Returns the number of attachments in a loaded document. +See also poppler_document_get_attachments() + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> Number of attachments + +</return> +</function> + +<function name="poppler_document_get_n_pages"> +<description> +Returns the number of pages in a loaded document. + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> Number of pages +</return> +</function> + +<function name="poppler_document_get_page"> +<description> +Returns the #PopplerPage indexed at @index. This object is owned by the +caller. + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +<parameter name="index"> +<parameter_description> a page index +</parameter_description> +</parameter> +</parameters> +<return> The #PopplerPage at @index +</return> +</function> + +<function name="poppler_document_get_page_by_label"> +<description> +Returns the #PopplerPage reference by @label. This object is owned by the +caller. @label is a human-readable string representation of the page number, +and can be document specific. Typically, it is a value such as "iii" or "3". + +By default, "1" refers to the first page. + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +<parameter name="label"> +<parameter_description> a page label +</parameter_description> +</parameter> +</parameters> +<return>The #PopplerPage referenced by @label +</return> +</function> + +<function name="poppler_document_get_page_layout"> +<description> +Returns the page layout that should be used when the document is opened + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> a #PopplerPageLayout that should be used when the document is opened + +</return> +</function> + +<function name="poppler_document_get_page_mode"> +<description> +Returns a #PopplerPageMode representing how the document should +be initially displayed when opened. + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> a #PopplerPageMode that should be used when document is opened + +</return> +</function> + +<function name="poppler_document_get_pdf_version"> +<description> + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +<parameter name="major_version"> +<parameter_description> return location for the PDF major version number +</parameter_description> +</parameter> +<parameter name="minor_version"> +<parameter_description> return location for the PDF minor version number +</parameter_description> +</parameter> +</parameters> +<return> the major and minor PDF version numbers + +</return> +</function> + +<function name="poppler_document_get_pdf_version_string"> +<description> +Returns the PDF version of @document as a string (e.g. PDF-1.6) + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string containing the PDF version +of @document, or %NULL + +</return> +</function> + +<function name="poppler_document_get_permissions"> +<description> +Returns the flags specifying which operations are permitted when the document is opened. + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> a set of falgs from #PopplerPermissions enumeration + +</return> +</function> + +<function name="poppler_document_get_producer"> +<description> +Returns the producer of the document. If the document was converted +from another format, the producer is the name of the product +that converted it to PDF + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string containing the producer +of @document, or %NULL + +</return> +</function> + +<function name="poppler_document_get_subject"> +<description> +Returns the subject of the document + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string containing the subject +of @document, or %NULL + +</return> +</function> + +<function name="poppler_document_get_title"> +<description> +Returns the document's title + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string containing the title +of @document, or %NULL + +</return> +</function> + +<function name="poppler_document_has_attachments"> +<description> +Returns %TRUE of @document has any attachments. + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> %TRUE, if @document has attachments. +</return> +</function> + +<function name="poppler_document_is_linearized"> +<description> +Returns whether @document is linearized or not. Linearization of PDF +enables efficient incremental access of the PDF file in a network environment. + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if @document is linearized, %FALSE otherwhise + +</return> +</function> + +<function name="poppler_document_new_from_data"> +<description> +Creates a new #PopplerDocument. If %NULL is returned, then @error will be +set. Possible errors include those in the #POPPLER_ERROR and #G_FILE_ERROR +domains. + + +</description> +<parameters> +<parameter name="data"> +<parameter_description> the pdf data contained in a char array +</parameter_description> +</parameter> +<parameter name="length"> +<parameter_description> the length of #data +</parameter_description> +</parameter> +<parameter name="password"> +<parameter_description> password to unlock the file with, or %NULL +</parameter_description> +</parameter> +<parameter name="error"> +<parameter_description> Return location for an error, or %NULL +</parameter_description> +</parameter> +</parameters> +<return> A newly created #PopplerDocument, or %NULL +</return> +</function> + +<function name="poppler_document_new_from_file"> +<description> +Creates a new #PopplerDocument. If %NULL is returned, then @error will be +set. Possible errors include those in the #POPPLER_ERROR and #G_FILE_ERROR +domains. + + +</description> +<parameters> +<parameter name="uri"> +<parameter_description> uri of the file to load +</parameter_description> +</parameter> +<parameter name="password"> +<parameter_description> password to unlock the file with, or %NULL +</parameter_description> +</parameter> +<parameter name="error"> +<parameter_description> Return location for an error, or %NULL +</parameter_description> +</parameter> +</parameters> +<return> A newly created #PopplerDocument, or %NULL +</return> +</function> + +<function name="poppler_document_save"> +<description> +Saves @document. Any change made in the document such as +form fields filled, annotations added or modified +will be saved. +If @error is set, %FALSE will be returned. Possible errors +include those in the #G_FILE_ERROR domain. + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> a #PopplerDocument +</parameter_description> +</parameter> +<parameter name="uri"> +<parameter_description> uri of file to save +</parameter_description> +</parameter> +<parameter name="error"> +<parameter_description> return location for an error, or %NULL +</parameter_description> +</parameter> +</parameters> +<return> %TRUE, if the document was successfully saved +</return> +</function> + +<function name="poppler_document_save_a_copy"> +<description> +Saves a copy of the original @document. +Any change made in the document such as +form fields filled by the user will not be saved. +If @error is set, %FALSE will be returned. Possible errors +include those in the #G_FILE_ERROR domain. + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> a #PopplerDocument +</parameter_description> +</parameter> +<parameter name="uri"> +<parameter_description> uri of file to save +</parameter_description> +</parameter> +<parameter name="error"> +<parameter_description> return location for an error, or %NULL +</parameter_description> +</parameter> +</parameters> +<return> %TRUE, if the document was successfully saved +</return> +</function> + +<function name="poppler_font_info_new"> +<description> +Creates a new #PopplerFontInfo object + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> a #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> a new #PopplerFontInfo instance +</return> +</function> + +<function name="poppler_font_info_scan"> +<description> +Scans the document associated with @font_info for fonts. At most +@n_pages will be scanned starting from the current iterator. @iter will +point to the first font scanned. + +Here is a simple example of code to scan fonts in a document + +<informalexample><programlisting> +font_info = poppler_font_info_new (document); +while (poppler_font_info_scan (font_info, 20, &fonts_iter)) { +if (!fonts_iter) +continue; /<!-- -->* No fonts found in these 20 pages *<!-- -->/ +do { +/<!-- -->* Do something with font iter *<!-- -->/ +g_print ("Font Name: %s\n", poppler_fonts_iter_get_name (fonts_iter)); +} while (poppler_fonts_iter_next (fonts_iter)); +poppler_fonts_iter_free (fonts_iter); +} +</programlisting></informalexample> + + +</description> +<parameters> +<parameter name="font_info"> +<parameter_description> a #PopplerFontInfo +</parameter_description> +</parameter> +<parameter name="n_pages"> +<parameter_description> number of pages to scan +</parameter_description> +</parameter> +<parameter name="iter"> +<parameter_description> return location for a #PopplerFontsIter +</parameter_description> +</parameter> +</parameters> +<return> %TRUE, if there are more fonts left to scan +</return> +</function> + +<function name="poppler_fonts_iter_copy"> +<description> +Creates a copy of @iter + + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerFontsIter to copy +</parameter_description> +</parameter> +</parameters> +<return> a new allocated copy of @iter +</return> +</function> + +<function name="poppler_fonts_iter_free"> +<description> +Frees the given #PopplerFontsIter + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerFontsIter +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_fonts_iter_get_file_name"> +<description> +The filename of the font associated with @iter or %NULL if +the font is embedded + + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerFontsIter +</parameter_description> +</parameter> +</parameters> +<return> the filename of the font or %NULL y font is emebedded +</return> +</function> + +<function name="poppler_fonts_iter_get_font_type"> +<description> +Returns the type of the font associated with @iter + + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerFontsIter +</parameter_description> +</parameter> +</parameters> +<return> the font type +</return> +</function> + +<function name="poppler_fonts_iter_get_full_name"> +<description> +Returns the full name of the font associated with @iter + + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerFontsIter +</parameter_description> +</parameter> +</parameters> +<return> the font full name +</return> +</function> + +<function name="poppler_fonts_iter_get_name"> +<description> +Returns the name of the font associated with @iter + + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerFontsIter +</parameter_description> +</parameter> +</parameters> +<return> the font name +</return> +</function> + +<function name="poppler_fonts_iter_is_embedded"> +<description> +Returns whether the font associated with @iter is embedded in the document + + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerFontsIter +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if font is emebdded, %FALSE otherwise +</return> +</function> + +<function name="poppler_fonts_iter_is_subset"> +<description> +Returns whether the font associated with @iter is a subset of another font + + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerFontsIter +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if font is a subset, %FALSE otherwise +</return> +</function> + +<function name="poppler_fonts_iter_next"> +<description> +Sets @iter to point to the next font + + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerFontsIter +</parameter_description> +</parameter> +</parameters> +<return> %TRUE, if @iter was set to the next font +</return> +</function> + +<function name="poppler_form_field_button_get_button_type"> +<description> +Gets the button type of @field + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> #PopplerFormButtonType of @field +</return> +</function> + +<function name="poppler_form_field_button_get_state"> +<description> +Queries a #PopplerFormField and returns its current state. Returns %TRUE if +@field is pressed in and %FALSE if it is raised. + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> current state of @field +</return> +</function> + +<function name="poppler_form_field_button_set_state"> +<description> +Sets the status of @field. Set to %TRUE if you want the #PopplerFormField +to be 'pressed in', and %FALSE to raise it. + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +<parameter name="state"> +<parameter_description> %TRUE or %FALSE +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_form_field_choice_can_select_multiple"> +<description> +Checks whether @field allows multiple choices to be selected + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if @field allows multiple choices to be selected +</return> +</function> + +<function name="poppler_form_field_choice_do_spell_check"> +<description> +Checks whether spell checking should be done for the contents of @field + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if spell checking should be done for @field +</return> +</function> + +<function name="poppler_form_field_choice_get_choice_type"> +<description> +Gets the choice type of @field + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> #PopplerFormChoiceType of @field +</return> +</function> + +<function name="poppler_form_field_choice_get_item"> +<description> +Returns the contents of the item on @field at the given index + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +<parameter name="index"> +<parameter_description> the index of the item +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string. It must be freed with g_free() when done. +</return> +</function> + +<function name="poppler_form_field_choice_get_n_items"> +<description> +Returns the number of items on @field + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> the number of items on @field +</return> +</function> + +<function name="poppler_form_field_choice_get_text"> +<description> +Retrieves the contents of @field. + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string. It must be freed with g_free() when done. +</return> +</function> + +<function name="poppler_form_field_choice_is_editable"> +<description> +Checks whether @field is editable + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if @field is editable +</return> +</function> + +<function name="poppler_form_field_choice_is_item_selected"> +<description> +Checks whether the item at the given index on @field is currently selected + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +<parameter name="index"> +<parameter_description> the index of the item +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if item at @index is currently selected +</return> +</function> + +<function name="poppler_form_field_choice_select_item"> +<description> +Selects the item at the given index on @field + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +<parameter name="index"> +<parameter_description> the index of the item +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_form_field_choice_set_text"> +<description> +Sets the text in @field to the given value, replacing the current contents + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +<parameter name="text"> +<parameter_description> the new text +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_form_field_choice_toggle_item"> +<description> +Changes the state of the item at the given index + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +<parameter name="index"> +<parameter_description> the index of the item +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_form_field_choice_unselect_all"> +<description> +Unselects all the items on @field + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_form_field_get_action"> +<description> +Retrieves the action (#PopplerAction) that shall be +performed when @field is activated, or %NULL + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> the action to perform. The returned +object is owned by @field and should not be freed + +</return> +</function> + +<function name="poppler_form_field_get_field_type"> +<description> +Gets the type of @field + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> #PopplerFormFieldType of @field +</return> +</function> + +<function name="poppler_form_field_get_font_size"> +<description> +Gets the font size of @field + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> the font size of @field +</return> +</function> + +<function name="poppler_form_field_get_id"> +<description> +Gets the id of @field + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> the id of @field +</return> +</function> + +<function name="poppler_form_field_get_mapping_name"> +<description> +Gets the mapping name of @field that is used when +exporting interactive form field data from the document + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string. It must be freed with g_free() when done. + +</return> +</function> + +<function name="poppler_form_field_get_name"> +<description> +Gets the fully qualified name of @field. It's constructed by concatenating +the partial field names of the field and all of its ancestors. + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string. It must be freed with g_free() when done. + +</return> +</function> + +<function name="poppler_form_field_get_partial_name"> +<description> +Gets the partial name of @field. + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string. It must be freed with g_free() when done. + +</return> +</function> + +<function name="poppler_form_field_is_read_only"> +<description> +Checks whether @field is read only + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if @field is read only +</return> +</function> + +<function name="poppler_form_field_mapping_copy"> +<description> +Creates a copy of @mapping + + +</description> +<parameters> +<parameter name="mapping"> +<parameter_description> a #PopplerFormFieldMapping to copy +</parameter_description> +</parameter> +</parameters> +<return> a new allocated copy of @mapping +</return> +</function> + +<function name="poppler_form_field_mapping_free"> +<description> +Frees the given #PopplerFormFieldMapping + +</description> +<parameters> +<parameter name="mapping"> +<parameter_description> a #PopplerFormFieldMapping +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_form_field_mapping_new"> +<description> +Creates a new #PopplerFormFieldMapping + + +</description> +<parameters> +</parameters> +<return> a new #PopplerFormFieldMapping, use poppler_form_field_mapping_free() to free it +</return> +</function> + +<function name="poppler_form_field_text_do_spell_check"> +<description> +Checks whether spell checking should be done for the contents of @field + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if spell checking should be done for @field +</return> +</function> + +<function name="poppler_form_field_text_get_max_len"> +<description> +Retrieves the maximum allowed length of the text in @field + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> the maximum allowed number of characters in @field, or -1 if there is no maximum. +</return> +</function> + +<function name="poppler_form_field_text_get_text"> +<description> +Retrieves the contents of @field. + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string. It must be freed with g_free() when done. +</return> +</function> + +<function name="poppler_form_field_text_get_text_type"> +<description> +Gets the text type of @field. + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> #PopplerFormTextType of @field +</return> +</function> + +<function name="poppler_form_field_text_is_password"> +<description> +Checks whether content of @field is a password and it must be hidden + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if the content of @field is a password +</return> +</function> + +<function name="poppler_form_field_text_is_rich_text"> +<description> +Checks whether the contents of @field are rich text + + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if the contents of @field are rich text +</return> +</function> + +<function name="poppler_form_field_text_set_text"> +<description> +Sets the text in @field to the given value, replacing the current contents. + +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +<parameter name="text"> +<parameter_description> the new text +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_get_backend"> +<description> +Returns the backend compiled into the poppler library. + + +</description> +<parameters> +</parameters> +<return> The backend used by poppler +</return> +</function> + +<function name="poppler_get_version"> +<description> +Returns the version of poppler in use. This result is not to be freed. + + +</description> +<parameters> +</parameters> +<return> the version of poppler. +</return> +</function> + +<function name="poppler_image_mapping_copy"> +<description> +Creates a copy of @mapping + + +</description> +<parameters> +<parameter name="mapping"> +<parameter_description> a #PopplerImageMapping to copy +</parameter_description> +</parameter> +</parameters> +<return> a new allocated copy of @mapping +</return> +</function> + +<function name="poppler_image_mapping_free"> +<description> +Frees the given #PopplerImageMapping + +</description> +<parameters> +<parameter name="mapping"> +<parameter_description> a #PopplerImageMapping +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_image_mapping_new"> +<description> +Creates a new #PopplerImageMapping + + +</description> +<parameters> +</parameters> +<return> a new #PopplerImageMapping, use poppler_image_mapping_free() to free it +</return> +</function> + +<function name="poppler_index_iter_copy"> +<description> +Creates a new #PopplerIndexIter as a copy of @iter. This must be freed with +poppler_index_iter_free(). + + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerIndexIter +</parameter_description> +</parameter> +</parameters> +<return> a new #PopplerIndexIter +</return> +</function> + +<function name="poppler_index_iter_free"> +<description> +Frees @iter. + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerIndexIter +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_index_iter_get_action"> +<description> +Returns the #PopplerAction associated with @iter. It must be freed with +poppler_action_free(). + + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerIndexIter +</parameter_description> +</parameter> +</parameters> +<return> a new #PopplerAction +</return> +</function> + +<function name="poppler_index_iter_get_child"> +<description> +Returns a newly created child of @parent, or %NULL if the iter has no child. +See poppler_index_iter_new() for more information on this function. + + +</description> +<parameters> +<parameter name="parent"> +<parameter_description> a #PopplerIndexIter +</parameter_description> +</parameter> +</parameters> +<return> a new #PopplerIndexIter +</return> +</function> + +<function name="poppler_index_iter_is_open"> +<description> +Returns whether this node should be expanded by default to the user. The +document can provide a hint as to how the document's index should be expanded +initially. + + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerIndexIter +</parameter_description> +</parameter> +</parameters> +<return> %TRUE, if the document wants @iter to be expanded +</return> +</function> + +<function name="poppler_index_iter_new"> +<description> +Returns the root #PopplerIndexIter for @document, or %NULL. This must be +freed with poppler_index_iter_free(). + +Certain documents have an index associated with them. This index can be used +to help the user navigate the document, and is similar to a table of +contents. Each node in the index will contain a #PopplerAction that can be +displayed to the user — typically a #POPPLER_ACTION_GOTO_DEST or a +#POPPLER_ACTION_URI<!-- -->. + +Here is a simple example of some code that walks the full index: + +<informalexample><programlisting> +static void +walk_index (PopplerIndexIter *iter) +{ +do +{ +/<!-- -->* Get the the action and do something with it *<!-- -->/ +PopplerIndexIter *child = poppler_index_iter_get_child (iter); +if (child) +walk_index (child); +poppler_index_iter_free (child); +} +while (poppler_index_iter_next (iter)); +} +... +{ +iter = poppler_index_iter_new (document); +walk_index (iter); +poppler_index_iter_free (iter); +} +</programlisting></informalexample> + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> a #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> a new #PopplerIndexIter +</return> +</function> + +<function name="poppler_index_iter_next"> +<description> +Sets @iter to point to the next action at the current level, if valid. See +poppler_index_iter_new() for more information. + + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerIndexIter +</parameter_description> +</parameter> +</parameters> +<return> %TRUE, if @iter was set to the next action +</return> +</function> + +<function name="poppler_layer_get_radio_button_group_id"> +<description> +Returns the numeric ID the radio button group associated with @layer. + + +</description> +<parameters> +<parameter name="layer"> +<parameter_description> a #PopplerLayer +</parameter_description> +</parameter> +</parameters> +<return> the ID of the radio button group associated with @layer, +or 0 if the layer is not associated to any radio button group + +</return> +</function> + +<function name="poppler_layer_get_title"> +<description> +Returns the name of the layer suitable for +presentation as a title in a viewer's GUI + + +</description> +<parameters> +<parameter name="layer"> +<parameter_description> a #PopplerLayer +</parameter_description> +</parameter> +</parameters> +<return> a string containing the title of the layer + +</return> +</function> + +<function name="poppler_layer_hide"> +<description> +Hides @layer. If @layer is the parent of other nested layers, +such layers will be also hidden and will be blocked until @layer +is shown again + + +</description> +<parameters> +<parameter name="layer"> +<parameter_description> a #PopplerLayer +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_layer_is_parent"> +<description> +Returns whether @layer is parent of other nested layers. + + +</description> +<parameters> +<parameter name="layer"> +<parameter_description> a #PopplerLayer +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if @layer is a parent layer + +</return> +</function> + +<function name="poppler_layer_is_visible"> +<description> +Returns whether @layer is visible + + +</description> +<parameters> +<parameter name="layer"> +<parameter_description> a #PopplerLayer +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if @layer is visible + +</return> +</function> + +<function name="poppler_layer_show"> +<description> +Shows @layer + + +</description> +<parameters> +<parameter name="layer"> +<parameter_description> a #PopplerLayer +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_layers_iter_copy"> +<description> +Creates a new #PopplerLayersIter as a copy of @iter. This must be freed with +poppler_layers_iter_free(). + + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerLayersIter +</parameter_description> +</parameter> +</parameters> +<return> a new #PopplerLayersIter + +Since 0.12 +</return> +</function> + +<function name="poppler_layers_iter_free"> +<description> +Frees @iter. + + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerLayersIter +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_layers_iter_get_child"> +<description> +Returns a newly created child of @parent, or %NULL if the iter has no child. +See poppler_layers_iter_new() for more information on this function. + + +</description> +<parameters> +<parameter name="parent"> +<parameter_description> a #PopplerLayersIter +</parameter_description> +</parameter> +</parameters> +<return> a new #PopplerLayersIter, or %NULL + +</return> +</function> + +<function name="poppler_layers_iter_get_layer"> +<description> +Returns the #PopplerLayer associated with @iter. + + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerLayersIter +</parameter_description> +</parameter> +</parameters> +<return> a new #PopplerLayer, or %NULL if +there isn't any layer associated with @iter + +</return> +</function> + +<function name="poppler_layers_iter_get_title"> +<description> +Returns the title associated with @iter. It must be freed with +g_free(). + + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerLayersIter +</parameter_description> +</parameter> +</parameters> +<return> a new string containing the @iter's title or %NULL if @iter doesn't have a title. +The returned string should be freed with g_free() when no longer needed. + +</return> +</function> + +<function name="poppler_layers_iter_new"> +<description> + +</description> +<parameters> +<parameter name="document"> +<parameter_description> a #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_layers_iter_next"> +<description> +Sets @iter to point to the next action at the current level, if valid. See +poppler_layers_iter_new() for more information. + + +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerLayersIter +</parameter_description> +</parameter> +</parameters> +<return> %TRUE, if @iter was set to the next action + +</return> +</function> + +<function name="poppler_link_mapping_copy"> +<description> +Creates a copy of @mapping + + +</description> +<parameters> +<parameter name="mapping"> +<parameter_description> a #PopplerLinkMapping to copy +</parameter_description> +</parameter> +</parameters> +<return> a new allocated copy of @mapping +</return> +</function> + +<function name="poppler_link_mapping_free"> +<description> +Frees the given #PopplerLinkMapping + +</description> +<parameters> +<parameter name="mapping"> +<parameter_description> a #PopplerLinkMapping +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_link_mapping_new"> +<description> +Creates a new #PopplerLinkMapping + + +</description> +<parameters> +</parameters> +<return> a new #PopplerLinkMapping, use poppler_link_mapping_free() to free it +</return> +</function> + +<function name="poppler_media_get_filename"> +<description> +Returns the media clip filename, in case of non-embedded media. filename might be +a local relative or absolute path or a URI + + +</description> +<parameters> +<parameter name="poppler_media"> +<parameter_description> a #PopplerMedia +</parameter_description> +</parameter> +</parameters> +<return> a filename, return value is owned by #PopplerMedia and should not be freed + +</return> +</function> + +<function name="poppler_media_get_mime_type"> +<description> +Returns the media clip mime-type + + +</description> +<parameters> +<parameter name="poppler_media"> +<parameter_description> a #PopplerMedia +</parameter_description> +</parameter> +</parameters> +<return> the mime-type, return value is owned by #PopplerMedia and should not be freed + +</return> +</function> + +<function name="poppler_media_is_embedded"> +<description> +Whether the media clip is embedded in the PDF. If the result is %TRUE, the embedded stream +can be saved with poppler_media_save() or poppler_media_save_to_callback() function. +If the result is %FALSE, the media clip filename can be retrieved with +poppler_media_get_filename() function. + + +</description> +<parameters> +<parameter name="poppler_media"> +<parameter_description> a #PopplerMedia +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if media clip is embedded, %FALSE otherwise + +</return> +</function> + +<function name="poppler_media_save"> +<description> +Saves embedded stream of @poppler_media to a file indicated by @filename. +If @error is set, %FALSE will be returned. +Possible errors include those in the #G_FILE_ERROR domain +and whatever the save function generates. + + +</description> +<parameters> +<parameter name="poppler_media"> +<parameter_description> a #PopplerMedia +</parameter_description> +</parameter> +<parameter name="filename"> +<parameter_description> name of file to save +</parameter_description> +</parameter> +<parameter name="error"> +<parameter_description> return location for error, or %NULL. +</parameter_description> +</parameter> +</parameters> +<return> %TRUE, if the file successfully saved + +</return> +</function> + +<function name="poppler_media_save_to_callback"> +<description> +Saves embedded stream of @poppler_media by feeding the produced data to @save_func. Can be used +when you want to store the media clip stream to something other than a file, such as +an in-memory buffer or a socket. If @error is set, %FALSE will be +returned. Possible errors include those in the #G_FILE_ERROR domain and +whatever the save function generates. + + +</description> +<parameters> +<parameter name="poppler_media"> +<parameter_description> a #PopplerMedia +</parameter_description> +</parameter> +<parameter name="save_func"> +<parameter_description> a function that is called to save each block of data that the save routine generates. +</parameter_description> +</parameter> +<parameter name="user_data"> +<parameter_description> user data to pass to the save function. +</parameter_description> +</parameter> +<parameter name="error"> +<parameter_description> return location for error, or %NULL. +</parameter_description> +</parameter> +</parameters> +<return> %TRUE, if the save successfully completed + +</return> +</function> + +<function name="poppler_movie_get_filename"> +<description> +Returns the local filename identifying a self-describing movie file + + +</description> +<parameters> +<parameter name="poppler_movie"> +<parameter_description> a #PopplerMovie +</parameter_description> +</parameter> +</parameters> +<return> a local filename, return value is owned by #PopplerMovie and +should not be freed + +</return> +</function> + +<function name="poppler_movie_need_poster"> +<description> +Returns whether a poster image representing the Movie +shall be displayed. The poster image must be retrieved +from the movie file. + + +</description> +<parameters> +<parameter name="poppler_movie"> +<parameter_description> a #PopplerMovie +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if move needs a poster image, %FALSE otherwise + +</return> +</function> + +<function name="poppler_movie_show_controls"> +<description> +Returns whether to display a movie controller bar while playing the movie + + +</description> +<parameters> +<parameter name="poppler_movie"> +<parameter_description> a #PopplerMovie +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if controller bar should be displayed, %FALSE otherwise + +</return> +</function> + +<function name="poppler_page_add_annot"> +<description> +Adds annotation @annot to @page. + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> a #PopplerPage +</parameter_description> +</parameter> +<parameter name="annot"> +<parameter_description> a #PopplerAnnot to add +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_page_find_text"> +<description> +A #GList of rectangles for each occurance of the text on the page. +The coordinates are in PDF points. + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> a #PopplerPage +</parameter_description> +</parameter> +<parameter name="text"> +<parameter_description> the text to search for (UTF-8 encoded) +</parameter_description> +</parameter> +</parameters> +<return> a #GList of #PopplerRectangle, +</return> +</function> + +<function name="poppler_page_free_annot_mapping"> +<description> +Frees a list of #PopplerAnnotMapping<!-- -->s allocated by +poppler_page_get_annot_mapping(). It also unreferences the #PopplerAnnot<!-- -->s +that each mapping contains, so if you want to keep them around, you need to +reference them with g_object_ref(). + +</description> +<parameters> +<parameter name="list"> +<parameter_description> A list of +#PopplerAnnotMapping<!-- -->s +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_page_free_form_field_mapping"> +<description> +Frees a list of #PopplerFormFieldMapping<!-- -->s allocated by +poppler_page_get_form_field_mapping(). + +</description> +<parameters> +<parameter name="list"> +<parameter_description> A list of +#PopplerFormFieldMapping<!-- -->s +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_page_free_image_mapping"> +<description> +Frees a list of #PopplerImageMapping<!-- -->s allocated by +poppler_page_get_image_mapping(). + +</description> +<parameters> +<parameter name="list"> +<parameter_description> A list of +#PopplerImageMapping<!-- -->s +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_page_free_link_mapping"> +<description> +Frees a list of #PopplerLinkMapping<!-- -->s allocated by +poppler_page_get_link_mapping(). It also frees the #PopplerAction<!-- -->s +that each mapping contains, so if you want to keep them around, you need to +copy them with poppler_action_copy(). + +</description> +<parameters> +<parameter name="list"> +<parameter_description> A list of +#PopplerLinkMapping<!-- -->s +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_page_free_text_attributes"> +<description> +Frees a list of #PopplerTextAttributes<!-- -->s allocated by +poppler_page_get_text_attributes(). + + +</description> +<parameters> +<parameter name="list"> +<parameter_description> A list of +#PopplerTextAttributes<!-- -->s +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_page_get_annot_mapping"> +<description> +Returns a list of #PopplerAnnotMapping items that map from a location on +@page to a #PopplerAnnot. This list must be freed with +poppler_page_free_annot_mapping() when done. + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> A #PopplerPage +</parameter_description> +</parameter> +</parameters> +<return> A #GList of #PopplerAnnotMapping +</return> +</function> + +<function name="poppler_page_get_crop_box"> +<description> +Retrurns the crop box of @page + +</description> +<parameters> +<parameter name="page"> +<parameter_description> a #PopplerPage +</parameter_description> +</parameter> +<parameter name="rect"> +<parameter_description> a #PopplerRectangle to fill +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_page_get_duration"> +<description> +Returns the duration of @page + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> a #PopplerPage +</parameter_description> +</parameter> +</parameters> +<return> duration in seconds of @page or -1. +</return> +</function> + +<function name="poppler_page_get_form_field_mapping"> +<description> +Returns a list of #PopplerFormFieldMapping items that map from a +location on @page to a form field. This list must be freed +with poppler_page_free_form_field_mapping() when done. + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> A #PopplerPage +</parameter_description> +</parameter> +</parameters> +<return> A #GList of #PopplerFormFieldMapping +</return> +</function> + +<function name="poppler_page_get_image"> +<description> +Returns a cairo surface for the image of the @page + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> A #PopplerPage +</parameter_description> +</parameter> +<parameter name="image_id"> +<parameter_description> The image identificator +</parameter_description> +</parameter> +</parameters> +<return> A cairo surface for the image +</return> +</function> + +<function name="poppler_page_get_image_mapping"> +<description> +Returns a list of #PopplerImageMapping items that map from a +location on @page to an image of the page. This list must be freed +with poppler_page_free_image_mapping() when done. + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> A #PopplerPage +</parameter_description> +</parameter> +</parameters> +<return> A #GList of #PopplerImageMapping +</return> +</function> + +<function name="poppler_page_get_index"> +<description> +Returns the index of @page + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> a #PopplerPage +</parameter_description> +</parameter> +</parameters> +<return> index value of @page +</return> +</function> + +<function name="poppler_page_get_label"> +<description> +Returns the label of @page. Note that page labels +and page indices might not coincide. + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> a #PopplerPage +</parameter_description> +</parameter> +</parameters> +<return> a new allocated string containing the label of @page, +or %NULL if @page doesn't have a label + +</return> +</function> + +<function name="poppler_page_get_link_mapping"> +<description> +Returns a list of #PopplerLinkMapping items that map from a +location on @page to a #PopplerAction. This list must be freed +with poppler_page_free_link_mapping() when done. + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> A #PopplerPage +</parameter_description> +</parameter> +</parameters> +<return> A #GList of #PopplerLinkMapping +</return> +</function> + +<function name="poppler_page_get_selected_region"> +<description> +Returns a region containing the area that would be rendered by +poppler_page_render_selection(). +The returned region must be freed with cairo_region_destroy() + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> a #PopplerPage +</parameter_description> +</parameter> +<parameter name="scale"> +<parameter_description> scale specified as pixels per point +</parameter_description> +</parameter> +<parameter name="style"> +<parameter_description> a #PopplerSelectionStyle +</parameter_description> +</parameter> +<parameter name="selection"> +<parameter_description> start and end point of selection as a rectangle +</parameter_description> +</parameter> +</parameters> +<return> a cairo_region_t + +</return> +</function> + +<function name="poppler_page_get_selected_text"> +<description> +Retrieves the contents of the specified @selection as text. + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> a #PopplerPage +</parameter_description> +</parameter> +<parameter name="style"> +<parameter_description> a #PopplerSelectionStyle +</parameter_description> +</parameter> +<parameter name="selection"> +<parameter_description> the #PopplerRectangle including the text +</parameter_description> +</parameter> +</parameters> +<return> a pointer to the contents of the @selection +as a string +</return> +</function> + +<function name="poppler_page_get_selection_region"> +<description> +Returns a region containing the area that would be rendered by +poppler_page_render_selection() as a #GList of +#PopplerRectangle. The returned list must be freed with +poppler_page_selection_region_free(). + +Deprecated: 0.16: Use poppler_page_get_selected_region() instead. + +</description> +<parameters> +<parameter name="page"> +<parameter_description> a #PopplerPage +</parameter_description> +</parameter> +<parameter name="scale"> +<parameter_description> scale specified as pixels per point +</parameter_description> +</parameter> +<parameter name="style"> +<parameter_description> a #PopplerSelectionStyle +</parameter_description> +</parameter> +<parameter name="selection"> +<parameter_description> start and end point of selection as a rectangle +</parameter_description> +</parameter> +</parameters> +<return> a #GList of #PopplerRectangle + +</return> +</function> + +<function name="poppler_page_get_size"> +<description> +Gets the size of @page at the current scale and rotation. + +</description> +<parameters> +<parameter name="page"> +<parameter_description> A #PopplerPage +</parameter_description> +</parameter> +<parameter name="width"> +<parameter_description> return location for the width of @page +</parameter_description> +</parameter> +<parameter name="height"> +<parameter_description> return location for the height of @page +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_page_get_text"> +<description> +Retrieves the text of @page. + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> a #PopplerPage +</parameter_description> +</parameter> +</parameters> +<return> a pointer to the text of the @page +as a string +</return> +</function> + +<function name="poppler_page_get_text_attributes"> +<description> +Obtains the attributes of the text as a GList of #PopplerTextAttributes. +This list must be freed with poppler_page_free_text_attributes() when done. + +Each list element is a #PopplerTextAttributes struct where start_index and +end_index indicates the range of text (as returned by poppler_page_get_text()) +to which text attributes apply. + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> A #PopplerPage +</parameter_description> +</parameter> +</parameters> +<return> A #GList of #PopplerTextAttributes + +</return> +</function> + +<function name="poppler_page_get_text_layout"> +<description> +Obtains the layout of the text as a list of #PopplerRectangle +This array must be freed with g_free () when done. + +The position in the array represents an offset in the text returned by +poppler_page_get_text() + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> A #PopplerPage +</parameter_description> +</parameter> +<parameter name="rectangles"> +<parameter_description> return location for an array of #PopplerRectangle +</parameter_description> +</parameter> +<parameter name="n_rectangles"> +<parameter_description> (out) length of returned array +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if the page contains text, %FALSE otherwise + +</return> +</function> + +<function name="poppler_page_get_thumbnail"> +<description> +Get the embedded thumbnail for the specified page. If the document +doesn't have an embedded thumbnail for the page, this function +returns %NULL. + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> the #PopplerPage to get the thumbnail for +</parameter_description> +</parameter> +</parameters> +<return> the tumbnail as a cairo_surface_t or %NULL if the document +doesn't have a thumbnail for this page. +</return> +</function> + +<function name="poppler_page_get_thumbnail_size"> +<description> +Returns %TRUE if @page has a thumbnail associated with it. It also +fills in @width and @height with the width and height of the +thumbnail. The values of width and height are not changed if no +appropriate thumbnail exists. + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> A #PopplerPage +</parameter_description> +</parameter> +<parameter name="width"> +<parameter_description> (out) return location for width +</parameter_description> +</parameter> +<parameter name="height"> +<parameter_description> (out) return location for height +</parameter_description> +</parameter> +</parameters> +<return> %TRUE, if @page has a thumbnail associated with it. +</return> +</function> + +<function name="poppler_page_get_transition"> +<description> +Returns the transition effect of @page + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> a #PopplerPage +</parameter_description> +</parameter> +</parameters> +<return> a #PopplerPageTransition or %NULL. +</return> +</function> + +<function name="poppler_page_render"> +<description> +Render the page to the given cairo context. This function +is for rendering a page that will be displayed. If you want +to render a page that will be printed use +poppler_page_render_for_printing() instead + +</description> +<parameters> +<parameter name="page"> +<parameter_description> the page to render from +</parameter_description> +</parameter> +<parameter name="cairo"> +<parameter_description> cairo context to render to +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_page_render_for_printing"> +<description> +Render the page to the given cairo context for printing. + +</description> +<parameters> +<parameter name="page"> +<parameter_description> the page to render from +</parameter_description> +</parameter> +<parameter name="cairo"> +<parameter_description> cairo context to render to +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_page_render_for_printing_with_options"> +<description> +Render the page to the given cairo context for printing +with the specified options + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> the page to render from +</parameter_description> +</parameter> +<parameter name="cairo"> +<parameter_description> cairo context to render to +</parameter_description> +</parameter> +<parameter name="options"> +<parameter_description> print options +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_page_render_selection"> +<description> +Render the selection specified by @selection for @page to +the given cairo context. The selection will be rendered, using +@glyph_color for the glyphs and @background_color for the selection +background. + +If non-NULL, @old_selection specifies the selection that is already +rendered to @cairo, in which case this function will (some day) +only render the changed part of the selection. + +</description> +<parameters> +<parameter name="page"> +<parameter_description> the #PopplerPage for which to render selection +</parameter_description> +</parameter> +<parameter name="cairo"> +<parameter_description> cairo context to render to +</parameter_description> +</parameter> +<parameter name="selection"> +<parameter_description> start and end point of selection as a rectangle +</parameter_description> +</parameter> +<parameter name="old_selection"> +<parameter_description> previous selection +</parameter_description> +</parameter> +<parameter name="style"> +<parameter_description> a #PopplerSelectionStyle +</parameter_description> +</parameter> +<parameter name="glyph_color"> +<parameter_description> color to use for drawing glyphs +</parameter_description> +</parameter> +<parameter name="background_color"> +<parameter_description> color to use for the selection background +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_page_render_to_ps"> +<description> +Render the page on a postscript file + + +</description> +<parameters> +<parameter name="page"> +<parameter_description> a #PopplerPage +</parameter_description> +</parameter> +<parameter name="ps_file"> +<parameter_description> the PopplerPSFile to render to +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_page_selection_region_free"> +<description> +Frees @region + +Deprecated: 0.16 + +</description> +<parameters> +<parameter name="region"> +<parameter_description> a #GList of +#PopplerRectangle +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_page_transition_copy"> +<description> +Creates a copy of @transition + + +</description> +<parameters> +<parameter name="transition"> +<parameter_description> a #PopplerPageTransition to copy +</parameter_description> +</parameter> +</parameters> +<return> a new allocated copy of @transition +</return> +</function> + +<function name="poppler_page_transition_free"> +<description> +Frees the given #PopplerPageTransition + +</description> +<parameters> +<parameter name="transition"> +<parameter_description> a #PopplerPageTransition +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_page_transition_new"> +<description> +Creates a new #PopplerPageTransition + + +</description> +<parameters> +</parameters> +<return> a new #PopplerPageTransition, use poppler_page_transition_free() to free it +</return> +</function> + +<function name="poppler_ps_file_free"> +<description> +Frees @ps_file + + +</description> +<parameters> +<parameter name="ps_file"> +<parameter_description> a PopplerPSFile +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_ps_file_new"> +<description> +Create a new postscript file to render to + + +</description> +<parameters> +<parameter name="document"> +<parameter_description> a #PopplerDocument +</parameter_description> +</parameter> +<parameter name="filename"> +<parameter_description> the path of the output filename +</parameter_description> +</parameter> +<parameter name="first_page"> +<parameter_description> the first page to print +</parameter_description> +</parameter> +<parameter name="n_pages"> +<parameter_description> the number of pages to print +</parameter_description> +</parameter> +</parameters> +<return> a PopplerPSFile +</return> +</function> + +<function name="poppler_ps_file_set_duplex"> +<description> +Enable or disable Duplex printing. + + +</description> +<parameters> +<parameter name="ps_file"> +<parameter_description> a PopplerPSFile which was not yet printed to +</parameter_description> +</parameter> +<parameter name="duplex"> +<parameter_description> whether to force duplex printing (on printers which support this) +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_ps_file_set_paper_size"> +<description> +Set the output paper size. These values will end up in the +DocumentMedia, the BoundingBox DSC comments and other places in the +generated PostScript. + + +</description> +<parameters> +<parameter name="ps_file"> +<parameter_description> a PopplerPSFile which was not yet printed to. +</parameter_description> +</parameter> +<parameter name="width"> +<parameter_description> the paper width in 1/72 inch +</parameter_description> +</parameter> +<parameter name="height"> +<parameter_description> the paper height in 1/72 inch +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_rectangle_copy"> +<description> +Creates a copy of @rectangle + + +</description> +<parameters> +<parameter name="rectangle"> +<parameter_description> a #PopplerRectangle to copy +</parameter_description> +</parameter> +</parameters> +<return> a new allocated copy of @rectangle +</return> +</function> + +<function name="poppler_rectangle_free"> +<description> +Frees the given #PopplerRectangle + +</description> +<parameters> +<parameter name="rectangle"> +<parameter_description> a #PopplerRectangle +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_rectangle_new"> +<description> +Creates a new #PopplerRectangle + + +</description> +<parameters> +</parameters> +<return> a new #PopplerRectangle, use poppler_rectangle_free() to free it +</return> +</function> + +<function name="poppler_text_attributes_copy"> +<description> +Creates a copy of @text_attrs + + +</description> +<parameters> +<parameter name="text_attrs"> +<parameter_description> a #PopplerTextAttributes to copy +</parameter_description> +</parameter> +</parameters> +<return> a new allocated copy of @text_attrs + +</return> +</function> + +<function name="poppler_text_attributes_free"> +<description> +Frees the given #PopplerTextAttributes + + +</description> +<parameters> +<parameter name="text_attrs"> +<parameter_description> a #PopplerTextAttributes +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_text_attributes_new"> +<description> +Creates a new #PopplerTextAttributes + + +</description> +<parameters> +</parameters> +<return> a new #PopplerTextAttributes, use poppler_text_attributes_free() to free it + +</return> +</function> + +</root> diff --git a/poppler-glib/src/poppler-glib_docs_override.xml b/poppler-glib/src/poppler-glib_docs_override.xml new file mode 100644 index 0000000..3cb2ddf --- /dev/null +++ b/poppler-glib/src/poppler-glib_docs_override.xml @@ -0,0 +1,783 @@ +<root> + +<function name="poppler_document_get_id"> +<description> +Returns the PDF file identifier represented as two byte strings of size 32. +@permanent_id is the permanent identifier that is built based on the file contents at the +time it was originally created, so that this identifer never changes. @update_id is the +update identifier that is built based on the file contents at the time it was last +updated. +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +<parameter name="permanent_id"> +<parameter_description> Location to store the permanent id array +</parameter_description> +</parameter> +<parameter name="update_id"> +<parameter_description> Location to store the update id array +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if the @document contains an id, %FALSE otherwise +</return> +</function> + +<function name="poppler_document_find_dest"> +<description> +Finds named destination @link_name in @document +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +<parameter name="link_name"> +<parameter_description> a named destination +</parameter_description> +</parameter> +</parameters> +<return> The #PopplerDest destination or %NULL if @link_name is not a destination. +</return> +</function> + +<function name="poppler_document_get_attachments"> +<description> +Returns a vector containing #PopplerAttachment's. +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> a vector of available attachments. +</return> +</function> + +<function name="poppler_document_get_n_attachments"> +<description> +Returns the number of attachments in a loaded document. +See also Poppler::Document::get_attachments() +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +</parameters> +<return> Number of attachments +</return> +</function> + +<function name="poppler_document_get_form_field"> +<description> +Returns the #PopplerFormField for the given @id. +</description> +<parameters> +<parameter name="document"> +<parameter_description> a #PopplerDocument +</parameter_description> +</parameter> +<parameter name="id"> +<parameter_description> an id of a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> a new #PopplerFormField or %NULL if not found +</return> +</function> + +<function name="poppler_form_field_get_action"> +<description> +Retrieves the action (#PopplerAction) that shall be +performed when the field is activated, or %NULL +</description> +<parameters> +<parameter name="field"> +<parameter_description> a #PopplerFormField +</parameter_description> +</parameter> +</parameters> +<return> The action to perform. +</return> +</function> + +<function name="poppler_document_get_page"> +<description> +Returns the #PopplerPage indexed at @index. +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +<parameter name="index"> +<parameter_description> a page index +</parameter_description> +</parameter> +</parameters> +<return> The #PopplerPage at @index +</return> +</function> + +<function name="poppler_document_get_page_by_label"> +<description> +Returns the #PopplerPage reference by @label. @label is a human-readable string +representation of the page number, and can be document specific. Typically, it is a value +such as "iii" or "3". + +By default, "1" refers to the first page. +</description> +<parameters> +<parameter name="document"> +<parameter_description> A #PopplerDocument +</parameter_description> +</parameter> +<parameter name="label"> +<parameter_description> a page label +</parameter_description> +</parameter> +</parameters> +<return>The #PopplerPage referenced by @label +</return> +</function> + +<function name="poppler_index_iter_new"> +<description> +Returns the root #PopplerIndexIter for a document, or %NULL. +</description> +<return> a new #PopplerIndexIter +</return> +</function> + +<function name="poppler_index_iter_next"> +<description> +Sets the index of the iter to point to the next action at the current level, if valid. +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerIndexIter +</parameter_description> +</parameter> +</parameters> +<return> %TRUE, if @iter was set to the next action +</return> +</function> + +<function name="poppler_index_iter_get_child"> +<description> +Returns a newly created child of the iter, or %NULL if the iter has no child. +</description> +<parameters> +<parameter name="parent"> +<parameter_description> a #PopplerIndexIter +</parameter_description> +</parameter> +</parameters> +<return> a new #PopplerIndexIter +</return> +</function> + +<function name="poppler_index_iter_get_action"> +<description> +Returns the #PopplerAction associated with the current iter. +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerIndexIter +</parameter_description> +</parameter> +</parameters> +<return> a new #PopplerAction +</return> +</function> + +<function name="poppler_layers_iter_get_title"> +<description> +Returns the title associated with the iter. +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerLayersIter +</parameter_description> +</parameter> +</parameters> +<return> A string containing the iter's title or %NULL if iter doesn't have a title. +</return> +</function> + +<function name="poppler_layers_iter_next"> +<description> +Sets the index of the iter to point to the next action at the current level, if valid. +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerLayersIter +</parameter_description> +</parameter> +</parameters> +<return> %TRUE, if @iter was set to the next action +</return> +</function> + +<function name="poppler_layers_iter_get_child"> +<description> +Returns a newly created child of the iter, or %NULL if the iter has no child. +</description> +<parameters> +<parameter name="parent"> +<parameter_description> a #PopplerLayersIter +</parameter_description> +</parameter> +</parameters> +<return> a new #PopplerLayersIter, or %NULL +</return> +</function> + +<function name="poppler_media_get_filename"> +<description> +Returns the media clip filename, in case of non-embedded media. filename might be +a local relative or absolute path or a URI +</description> +<parameters> +<parameter name="poppler_media"> +<parameter_description> a #PopplerMedia +</parameter_description> +</parameter> +</parameters> +<return> a filename +</return> +</function> + +<function name="poppler_media_get_mime_type"> +<description> +Returns the media clip mime-type +</description> +<parameters> +<parameter name="poppler_media"> +<parameter_description> a #PopplerMedia +</parameter_description> +</parameter> +</parameters> +<return> the mime-type +</return> +</function> + +<function name="poppler_media_is_embedded"> +<description> +Whether the media clip is embedded in the PDF. If the result is %TRUE, the embedded stream +can be saved with one of the save() functions. If the result is %FALSE, the media clip +filename can be retrieved with the get_filename() function. +</description> +<parameters> +<parameter name="poppler_media"> +<parameter_description> a #PopplerMedia +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if media clip is embedded, %FALSE otherwise +</return> +</function> + +<function name="poppler_movie_get_filename"> +<description> +Returns the local filename identifying a self-describing movie file +</description> +<parameters> +<parameter name="poppler_movie"> +<parameter_description> a #PopplerMovie +</parameter_description> +</parameter> +</parameters> +<return> a local filename +</return> +</function> + +<function name="poppler_annot_get_annot_type"> +<description> +Gets the type of the annotation +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnot +</parameter_description> +</parameter> +</parameters> +<return> #PopplerAnnotType of the annotation. +</return> +</function> + +<function name="poppler_annot_get_flags"> +<description> +Retrieves the flag field specifying various characteristics of the annotation. +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnot +</parameter_description> +</parameter> +</parameters> +<return> the flag field of the annotation. +</return> +</function> + +<function name="poppler_annot_get_name"> +<description> +Retrieves the name of the annotation. +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnot +</parameter_description> +</parameter> +</parameters> +<return> a string containing the name of the annotation. +</return> +</function> + +<function name="poppler_annot_get_page_index"> +<description> +Returns the page index to which the annotation is associated, or -1 if unknown +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnot +</parameter_description> +</parameter> +</parameters> +<return> page index or -1 +</return> +</function> + +<function name="poppler_annot_get_color"> +<description> +Retrieves the color of the annotation. +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnot +</parameter_description> +</parameter> +</parameters> +<return> a #PopplerColor with the color values of the annotation, or %NULL. +</return> +</function> + +<function name="poppler_annot_set_color"> +<description> +Sets the color of the annotation. +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnot +</parameter_description> +</parameter> +<parameter name="poppler_color"> +<parameter_description> a #PopplerColor, or %NULL +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_annot_get_contents"> +<description> +Retrieves the contents of the annotation. +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnot +</parameter_description> +</parameter> +</parameters> +<return> a string containing the contents of the annotation. +</return> +</function> + +<function name="poppler_annot_set_contents"> +<description> +Sets the contents of the annotation to the given value, replacing the current contents. +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnot +</parameter_description> +</parameter> +<parameter name="contents"> +<parameter_description> a text string containing the new contents +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_annot_get_modified"> +<description> +Retrieves the last modification data of the annotation. The returned string will be either +a PDF format date or a text string. See also Poppler::date_parse() +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnot +</parameter_description> +</parameter> +</parameters> +<return> A string containing the last modification date of the annotation. +</return> +</function> + +<function name="poppler_annot_markup_get_label"> +<description> +Retrieves the label text of the annotation. +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMarkup +</parameter_description> +</parameter> +</parameters> +<return> A string containing the label text of annotation. +</return> +</function> + +<function name="poppler_annot_markup_set_label"> +<description> +Sets the label text of the annotation, replacing the current one. +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMarkup +</parameter_description> +</parameter> +<parameter name="label"> +<parameter_description> A text string containing the new label. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_annot_markup_get_subject"> +<description> +Retrieves the subject text of the annotation. +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMarkup +</parameter_description> +</parameter> +</parameters> +<return> The subject text of the annotation. +</return> +</function> + +<function name="poppler_page_render"> +<description> +Render the page to the given cairo context. This function is for rendering a page that +will be displayed. If you want to render a page that will be printed use +render_for_printing() instead. +</description> +<parameters> +<parameter name="page"> +<parameter_description> the page to render from +</parameter_description> +</parameter> +<parameter name="cairo"> +<parameter_description> Cairo::Context to render to +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_page_get_selected_region"> +<description> +Returns a region containing the area that would be rendered by render_selection(). +</description> +<parameters> +<parameter name="page"> +<parameter_description> a #PopplerPage +</parameter_description> +</parameter> +<parameter name="scale"> +<parameter_description> scale specified as pixels per point +</parameter_description> +</parameter> +<parameter name="style"> +<parameter_description> a #PopplerSelectionStyle +</parameter_description> +</parameter> +<parameter name="selection"> +<parameter_description> start and end point of selection as a rectangle +</parameter_description> +</parameter> +</parameters> +<return> a Cairo::Region +</return> +</function> + +<function name="poppler_page_find_text"> +<description> +Obtaines a vector of rectangles for each occurance of the text on the page. +The coordinates are in PDF points. +</description> +<parameters> +<parameter name="page"> +<parameter_description> a #PopplerPage +</parameter_description> +</parameter> +<parameter name="text"> +<parameter_description> the text to search for (UTF-8 encoded) +</parameter_description> +</parameter> +</parameters> +<return> Returns a vector of #PopplerRectangle +</return> +</function> + +<function name="poppler_page_get_text_layout"> +<description> +Obtains the layout of the text as a vector of #PopplerRectangle. +The position in the array represents an offset in the text returned by get_text() +</description> +<parameters> +<parameter name="page"> +<parameter_description> A #PopplerPage +</parameter_description> +</parameter> +<parameter name="rectangles"> +<parameter_description> return location for a vector of #PopplerRectangle +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if the page contains text, %FALSE otherwise +</return> +</function> + +<function name="poppler_page_get_text_attributes"> +<description> +Obtains the attributes of the text as a vector of #PopplerTextAttributes. Each list +element is a #PopplerTextAttributes where start_index and end_index indicates the range of +text (as returned by get_text()) to which text attributes apply. +</description> +<parameters> +<parameter name="page"> +<parameter_description> A #PopplerPage +</parameter_description> +</parameter> +</parameters> +<return> A vector of #PopplerTextAttributes +</return> +</function> + +<function name="poppler_page_get_link_mapping"> +<description> +Returns a vector of #PopplerLinkMapping items that map from a +location on the page to a #PopplerAction. +</description> +<parameters> +<parameter name="page"> +<parameter_description> A #PopplerPage +</parameter_description> +</parameter> +</parameters> +<return> A vector of #PopplerLinkMapping +</return> +</function> + +<function name="poppler_page_get_image_mapping"> +<description> +Returns a vector of #PopplerImageMapping items that map from a +location on the page to an image of the page. +</description> +<parameters> +<parameter name="page"> +<parameter_description> A #PopplerPage +</parameter_description> +</parameter> +</parameters> +<return> A vector of #PopplerImageMapping +</return> +</function> + +<function name="poppler_page_get_form_field_mapping"> +<description> +Returns a vector of #PopplerFormFieldMapping items that map from a +location on the page to a form field. +</description> +<parameters> +<parameter name="page"> +<parameter_description> A #PopplerPage +</parameter_description> +</parameter> +</parameters> +<return> A vector of #PopplerFormFieldMapping +</return> +</function> + +<function name="poppler_page_get_annot_mapping"> +<description> +Returns a vector of #PopplerAnnotMapping items that map from a location on the page to a +#PopplerAnnot. +</description> +<parameters> +<parameter name="page"> +<parameter_description> A #PopplerPage +</parameter_description> +</parameter> +</parameters> +<return> A vector of #PopplerAnnotMapping +</return> +</function> + +<function name="poppler_annot_text_new"> +<description> +Creates a new text annotation that will be located on @rect when added to a page. See +Poppler::Page::add_annot() +</description> +<parameters> +<parameter name="doc"> +<parameter_description> The document the text annotation will be added to +</parameter_description> +</parameter> +<parameter name="rect"> +<parameter_description> The location of the text annotation on the page +</parameter_description> +</parameter> +</parameters> +<return> A newly created #PopplerAnnotText annotation +</return> +</function> + +<function name="poppler_annot_text_set_icon"> +<description> +Sets the icon of the annotationg. The following predefined icons are currently supported: + - POPPLER_ANNOT_TEXT_ICON_NOTE + - POPPLER_ANNOT_TEXT_ICON_COMMENT + - POPPLER_ANNOT_TEXT_ICON_KEY + - POPPLER_ANNOT_TEXT_ICON_HELP + - POPPLER_ANNOT_TEXT_ICON_NEW_PARAGRAPH + - POPPLER_ANNOT_TEXT_ICON_PARAGRAPH + - POPPLER_ANNOT_TEXT_ICON_INSERT + - POPPLER_ANNOT_TEXT_ICON_CROSS + - POPPLER_ANNOT_TEXT_ICON_CIRCLE + . +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotText +</parameter_description> +</parameter> +<parameter name="icon"> +<parameter_description> The name of an icon +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="poppler_annot_free_text_get_callout_line"> +<description> +Retrieves a #PopplerAnnotCalloutLine of four or six numbers specifying a callout +line attached to the annotation. +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotFreeText +</parameter_description> +</parameter> +</parameters> +<return> A #PopplerAnnotCalloutLine if the annot has a callout +line, %NULL in other case. +</return> +</function> + +<function name="poppler_annot_free_text_get_quadding"> +<description> +Retrieves the justification of the text of the annotation. +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotFreeText +</parameter_description> +</parameter> +</parameters> +<return> #PopplerAnnotFreeTextQuadding of the annotation. +</return> +</function> + +<function name="poppler_annot_file_attachment_get_attachment"> +<description> +Creates a #PopplerAttachment for the file of the file attachment annotation. +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotFileAttachment +</parameter_description> +</parameter> +</parameters> +<return> @PopplerAttachment +</return> +</function> + +<function name="poppler_annot_file_attachment_get_name"> +<description> +Retrieves the name of annotation. +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotFileAttachment +</parameter_description> +</parameter> +</parameters> +<return> A string containing the name of the annotation. +</return> +</function> + +<function name="poppler_annot_movie_get_movie"> +<description> +Retrieves the movie object (PopplerMovie) stored in the annotation. +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotMovie +</parameter_description> +</parameter> +</parameters> +<return> The movie object stored in the annotation. +</return> +</function> + +<function name="poppler_annot_screen_get_action"> +<description> +Retrieves the action (#PopplerAction) that shall be performed when the annotation is activated +</description> +<parameters> +<parameter name="poppler_annot"> +<parameter_description> a #PopplerAnnotScreen +</parameter_description> +</parameter> +</parameters> +<return> The action to perform. +</return> +</function> + +<function name="poppler_fonts_iter_get_file_name"> +<description> +The filename of the font associated with the iter or %NULL if the font is embedded +</description> +<parameters> +<parameter name="iter"> +<parameter_description> a #PopplerFontsIter +</parameter_description> +</parameter> +</parameters> +<return> The filename of the font or %NULL if the font is emebedded +</return> +</function> + +</root> diff --git a/poppler-glib/src/poppler-glib_enum.defs b/poppler-glib/src/poppler-glib_enum.defs new file mode 100644 index 0000000..139817b --- /dev/null +++ b/poppler-glib/src/poppler-glib_enum.defs @@ -0,0 +1,677 @@ +;; From poppler-action.h + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_ACTION_UNKNOWN, /* unknown action */ +;; POPPLER_ACTION_NONE, /* no action specified */ +;; POPPLER_ACTION_GOTO_DEST, /* go to destination */ +;; POPPLER_ACTION_GOTO_REMOTE, /* go to destination in new file */ +;; POPPLER_ACTION_LAUNCH, /* launch app (or open document) */ +;; POPPLER_ACTION_URI, /* URI */ +;; POPPLER_ACTION_NAMED, /* named action*/ +;; POPPLER_ACTION_MOVIE, /* movie action */ +;; POPPLER_ACTION_RENDITION, /* rendition action */ +;; POPPLER_ACTION_OCG_STATE, /* Set-OCG-State action */ +;; POPPLER_ACTION_JAVASCRIPT /* Javascript action */ +;; } PopplerActionType; + +(define-enum-extended ActionType + (in-module "Poppler") + (c-name "PopplerActionType") + (values + '("unknown" "POPPLER_ACTION_UNKNOWN" "0") + '("none" "POPPLER_ACTION_NONE" "1") + '("goto-dest" "POPPLER_ACTION_GOTO_DEST" "2") + '("goto-remote" "POPPLER_ACTION_GOTO_REMOTE" "3") + '("launch" "POPPLER_ACTION_LAUNCH" "4") + '("uri" "POPPLER_ACTION_URI" "5") + '("named" "POPPLER_ACTION_NAMED" "6") + '("movie" "POPPLER_ACTION_MOVIE" "7") + '("rendition" "POPPLER_ACTION_RENDITION" "8") + '("ocg-state" "POPPLER_ACTION_OCG_STATE" "9") + '("javascript" "POPPLER_ACTION_JAVASCRIPT" "10") + ) +) + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_DEST_UNKNOWN, +;; POPPLER_DEST_XYZ, +;; POPPLER_DEST_FIT, +;; POPPLER_DEST_FITH, +;; POPPLER_DEST_FITV, +;; POPPLER_DEST_FITR, +;; POPPLER_DEST_FITB, +;; POPPLER_DEST_FITBH, +;; POPPLER_DEST_FITBV, +;; POPPLER_DEST_NAMED +;; } PopplerDestType; + +(define-enum-extended DestType + (in-module "Poppler") + (c-name "PopplerDestType") + (values + '("unknown" "POPPLER_DEST_UNKNOWN" "0") + '("xyz" "POPPLER_DEST_XYZ" "1") + '("fit" "POPPLER_DEST_FIT" "2") + '("fith" "POPPLER_DEST_FITH" "3") + '("fitv" "POPPLER_DEST_FITV" "4") + '("fitr" "POPPLER_DEST_FITR" "5") + '("fitb" "POPPLER_DEST_FITB" "6") + '("fitbh" "POPPLER_DEST_FITBH" "7") + '("fitbv" "POPPLER_DEST_FITBV" "8") + '("named" "POPPLER_DEST_NAMED" "9") + ) +) + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_ACTION_MOVIE_PLAY, +;; POPPLER_ACTION_MOVIE_PAUSE, +;; POPPLER_ACTION_MOVIE_RESUME, +;; POPPLER_ACTION_MOVIE_STOP +;; } PopplerActionMovieOperation; + +(define-enum-extended ActionMovieOperation + (in-module "Poppler") + (c-name "PopplerActionMovieOperation") + (values + '("play" "POPPLER_ACTION_MOVIE_PLAY" "0") + '("pause" "POPPLER_ACTION_MOVIE_PAUSE" "1") + '("resume" "POPPLER_ACTION_MOVIE_RESUME" "2") + '("stop" "POPPLER_ACTION_MOVIE_STOP" "3") + ) +) + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_ACTION_LAYER_ON, +;; POPPLER_ACTION_LAYER_OFF, +;; POPPLER_ACTION_LAYER_TOGGLE +;; } PopplerActionLayerAction; + +(define-enum-extended ActionLayerAction + (in-module "Poppler") + (c-name "PopplerActionLayerAction") + (values + '("on" "POPPLER_ACTION_LAYER_ON" "0") + '("off" "POPPLER_ACTION_LAYER_OFF" "1") + '("toggle" "POPPLER_ACTION_LAYER_TOGGLE" "2") + ) +) + +;; From poppler-annot.h + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_ANNOT_UNKNOWN, +;; POPPLER_ANNOT_TEXT, +;; POPPLER_ANNOT_LINK, +;; POPPLER_ANNOT_FREE_TEXT, +;; POPPLER_ANNOT_LINE, +;; POPPLER_ANNOT_SQUARE, +;; POPPLER_ANNOT_CIRCLE, +;; POPPLER_ANNOT_POLYGON, +;; POPPLER_ANNOT_POLY_LINE, +;; POPPLER_ANNOT_HIGHLIGHT, +;; POPPLER_ANNOT_UNDERLINE, +;; POPPLER_ANNOT_SQUIGGLY, +;; POPPLER_ANNOT_STRIKE_OUT, +;; POPPLER_ANNOT_STAMP, +;; POPPLER_ANNOT_CARET, +;; POPPLER_ANNOT_INK, +;; POPPLER_ANNOT_POPUP, +;; POPPLER_ANNOT_FILE_ATTACHMENT, +;; POPPLER_ANNOT_SOUND, +;; POPPLER_ANNOT_MOVIE, +;; POPPLER_ANNOT_WIDGET, +;; POPPLER_ANNOT_SCREEN, +;; POPPLER_ANNOT_PRINTER_MARK, +;; POPPLER_ANNOT_TRAP_NET, +;; POPPLER_ANNOT_WATERMARK, +;; POPPLER_ANNOT_3D +;; } PopplerAnnotType; + +(define-enum-extended AnnotType + (in-module "Poppler") + (c-name "PopplerAnnotType") + (values + '("unknown" "POPPLER_ANNOT_UNKNOWN" "0") + '("text" "POPPLER_ANNOT_TEXT" "1") + '("link" "POPPLER_ANNOT_LINK" "2") + '("free-text" "POPPLER_ANNOT_FREE_TEXT" "3") + '("line" "POPPLER_ANNOT_LINE" "4") + '("square" "POPPLER_ANNOT_SQUARE" "5") + '("circle" "POPPLER_ANNOT_CIRCLE" "6") + '("polygon" "POPPLER_ANNOT_POLYGON" "7") + '("poly-line" "POPPLER_ANNOT_POLY_LINE" "8") + '("highlight" "POPPLER_ANNOT_HIGHLIGHT" "9") + '("underline" "POPPLER_ANNOT_UNDERLINE" "10") + '("squiggly" "POPPLER_ANNOT_SQUIGGLY" "11") + '("strike-out" "POPPLER_ANNOT_STRIKE_OUT" "12") + '("stamp" "POPPLER_ANNOT_STAMP" "13") + '("caret" "POPPLER_ANNOT_CARET" "14") + '("ink" "POPPLER_ANNOT_INK" "15") + '("popup" "POPPLER_ANNOT_POPUP" "16") + '("file-attachment" "POPPLER_ANNOT_FILE_ATTACHMENT" "17") + '("sound" "POPPLER_ANNOT_SOUND" "18") + '("movie" "POPPLER_ANNOT_MOVIE" "19") + '("widget" "POPPLER_ANNOT_WIDGET" "20") + '("screen" "POPPLER_ANNOT_SCREEN" "21") + '("printer-mark" "POPPLER_ANNOT_PRINTER_MARK" "22") + '("trap-net" "POPPLER_ANNOT_TRAP_NET" "23") + '("watermark" "POPPLER_ANNOT_WATERMARK" "24") + '("3d" "POPPLER_ANNOT_3D" "25") + ) +) + +;; Original typedef: +;; typedef enum /*< flags >*/ +;; { +;; POPPLER_ANNOT_FLAG_UNKNOWN = 0, +;; POPPLER_ANNOT_FLAG_INVISIBLE = 1 << 0, +;; POPPLER_ANNOT_FLAG_HIDDEN = 1 << 1, +;; POPPLER_ANNOT_FLAG_PRINT = 1 << 2, +;; POPPLER_ANNOT_FLAG_NO_ZOOM = 1 << 3, +;; POPPLER_ANNOT_FLAG_NO_ROTATE = 1 << 4, +;; POPPLER_ANNOT_FLAG_NO_VIEW = 1 << 5, +;; POPPLER_ANNOT_FLAG_READ_ONLY = 1 << 6, +;; POPPLER_ANNOT_FLAG_LOCKED = 1 << 7, +;; POPPLER_ANNOT_FLAG_TOGGLE_NO_VIEW = 1 << 8, +;; POPPLER_ANNOT_FLAG_LOCKED_CONTENTS = 1 << 9 +;; } PopplerAnnotFlag; + +(define-flags-extended AnnotFlag + (in-module "Poppler") + (c-name "PopplerAnnotFlag") + (values + '("unknown" "POPPLER_ANNOT_FLAG_UNKNOWN" "0x0") + '("invisible" "POPPLER_ANNOT_FLAG_INVISIBLE" "1 << 0") + '("hidden" "POPPLER_ANNOT_FLAG_HIDDEN" "1 << 1") + '("print" "POPPLER_ANNOT_FLAG_PRINT" "1 << 2") + '("no-zoom" "POPPLER_ANNOT_FLAG_NO_ZOOM" "1 << 3") + '("no-rotate" "POPPLER_ANNOT_FLAG_NO_ROTATE" "1 << 4") + '("no-view" "POPPLER_ANNOT_FLAG_NO_VIEW" "1 << 5") + '("read-only" "POPPLER_ANNOT_FLAG_READ_ONLY" "1 << 6") + '("locked" "POPPLER_ANNOT_FLAG_LOCKED" "1 << 7") + '("toggle-no-view" "POPPLER_ANNOT_FLAG_TOGGLE_NO_VIEW" "1 << 8") + '("locked-contents" "POPPLER_ANNOT_FLAG_LOCKED_CONTENTS" "1 << 9") + ) +) + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_ANNOT_MARKUP_REPLY_TYPE_R, +;; POPPLER_ANNOT_MARKUP_REPLY_TYPE_GROUP +;; } PopplerAnnotMarkupReplyType; + +(define-enum-extended AnnotMarkupReplyType + (in-module "Poppler") + (c-name "PopplerAnnotMarkupReplyType") + (values + '("r" "POPPLER_ANNOT_MARKUP_REPLY_TYPE_R" "0") + '("group" "POPPLER_ANNOT_MARKUP_REPLY_TYPE_GROUP" "1") + ) +) + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_ANNOT_EXTERNAL_DATA_MARKUP_3D, +;; POPPLER_ANNOT_EXTERNAL_DATA_MARKUP_UNKNOWN +;; } PopplerAnnotExternalDataType; + +(define-enum-extended AnnotExternalDataType + (in-module "Poppler") + (c-name "PopplerAnnotExternalDataType") + (values + '("3d" "POPPLER_ANNOT_EXTERNAL_DATA_MARKUP_3D" "0") + '("unknown" "POPPLER_ANNOT_EXTERNAL_DATA_MARKUP_UNKNOWN" "1") + ) +) + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_ANNOT_TEXT_STATE_MARKED, +;; POPPLER_ANNOT_TEXT_STATE_UNMARKED, +;; POPPLER_ANNOT_TEXT_STATE_ACCEPTED, +;; POPPLER_ANNOT_TEXT_STATE_REJECTED, +;; POPPLER_ANNOT_TEXT_STATE_CANCELLED, +;; POPPLER_ANNOT_TEXT_STATE_COMPLETED, +;; POPPLER_ANNOT_TEXT_STATE_NONE, +;; POPPLER_ANNOT_TEXT_STATE_UNKNOWN +;; } PopplerAnnotTextState; + +(define-enum-extended AnnotTextState + (in-module "Poppler") + (c-name "PopplerAnnotTextState") + (values + '("marked" "POPPLER_ANNOT_TEXT_STATE_MARKED" "0") + '("unmarked" "POPPLER_ANNOT_TEXT_STATE_UNMARKED" "1") + '("accepted" "POPPLER_ANNOT_TEXT_STATE_ACCEPTED" "2") + '("rejected" "POPPLER_ANNOT_TEXT_STATE_REJECTED" "3") + '("cancelled" "POPPLER_ANNOT_TEXT_STATE_CANCELLED" "4") + '("completed" "POPPLER_ANNOT_TEXT_STATE_COMPLETED" "5") + '("none" "POPPLER_ANNOT_TEXT_STATE_NONE" "6") + '("unknown" "POPPLER_ANNOT_TEXT_STATE_UNKNOWN" "7") + ) +) + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_ANNOT_FREE_TEXT_QUADDING_LEFT_JUSTIFIED, +;; POPPLER_ANNOT_FREE_TEXT_QUADDING_CENTERED, +;; POPPLER_ANNOT_FREE_TEXT_QUADDING_RIGHT_JUSTIFIED +;; } PopplerAnnotFreeTextQuadding; + +(define-enum-extended AnnotFreeTextQuadding + (in-module "Poppler") + (c-name "PopplerAnnotFreeTextQuadding") + (values + '("left-justified" "POPPLER_ANNOT_FREE_TEXT_QUADDING_LEFT_JUSTIFIED" "0") + '("centered" "POPPLER_ANNOT_FREE_TEXT_QUADDING_CENTERED" "1") + '("right-justified" "POPPLER_ANNOT_FREE_TEXT_QUADDING_RIGHT_JUSTIFIED" "2") + ) +) + +;; From poppler-document.h + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_PAGE_LAYOUT_UNSET, +;; POPPLER_PAGE_LAYOUT_SINGLE_PAGE, +;; POPPLER_PAGE_LAYOUT_ONE_COLUMN, +;; POPPLER_PAGE_LAYOUT_TWO_COLUMN_LEFT, +;; POPPLER_PAGE_LAYOUT_TWO_COLUMN_RIGHT, +;; POPPLER_PAGE_LAYOUT_TWO_PAGE_LEFT, +;; POPPLER_PAGE_LAYOUT_TWO_PAGE_RIGHT +;; } PopplerPageLayout; + +(define-enum-extended PageLayout + (in-module "Poppler") + (c-name "PopplerPageLayout") + (values + '("unset" "POPPLER_PAGE_LAYOUT_UNSET" "0") + '("single-page" "POPPLER_PAGE_LAYOUT_SINGLE_PAGE" "1") + '("one-column" "POPPLER_PAGE_LAYOUT_ONE_COLUMN" "2") + '("two-column-left" "POPPLER_PAGE_LAYOUT_TWO_COLUMN_LEFT" "3") + '("two-column-right" "POPPLER_PAGE_LAYOUT_TWO_COLUMN_RIGHT" "4") + '("two-page-left" "POPPLER_PAGE_LAYOUT_TWO_PAGE_LEFT" "5") + '("two-page-right" "POPPLER_PAGE_LAYOUT_TWO_PAGE_RIGHT" "6") + ) +) + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_PAGE_MODE_UNSET, +;; POPPLER_PAGE_MODE_NONE, +;; POPPLER_PAGE_MODE_USE_OUTLINES, +;; POPPLER_PAGE_MODE_USE_THUMBS, +;; POPPLER_PAGE_MODE_FULL_SCREEN, +;; POPPLER_PAGE_MODE_USE_OC, +;; POPPLER_PAGE_MODE_USE_ATTACHMENTS +;; } PopplerPageMode; + +(define-enum-extended PageMode + (in-module "Poppler") + (c-name "PopplerPageMode") + (values + '("unset" "POPPLER_PAGE_MODE_UNSET" "0") + '("none" "POPPLER_PAGE_MODE_NONE" "1") + '("use-outlines" "POPPLER_PAGE_MODE_USE_OUTLINES" "2") + '("use-thumbs" "POPPLER_PAGE_MODE_USE_THUMBS" "3") + '("full-screen" "POPPLER_PAGE_MODE_FULL_SCREEN" "4") + '("use-oc" "POPPLER_PAGE_MODE_USE_OC" "5") + '("use-attachments" "POPPLER_PAGE_MODE_USE_ATTACHMENTS" "6") + ) +) + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_FONT_TYPE_UNKNOWN, +;; POPPLER_FONT_TYPE_TYPE1, +;; POPPLER_FONT_TYPE_TYPE1C, +;; POPPLER_FONT_TYPE_TYPE1COT, +;; POPPLER_FONT_TYPE_TYPE3, +;; POPPLER_FONT_TYPE_TRUETYPE, +;; POPPLER_FONT_TYPE_TRUETYPEOT, +;; POPPLER_FONT_TYPE_CID_TYPE0, +;; POPPLER_FONT_TYPE_CID_TYPE0C, +;; POPPLER_FONT_TYPE_CID_TYPE0COT, +;; POPPLER_FONT_TYPE_CID_TYPE2, +;; POPPLER_FONT_TYPE_CID_TYPE2OT +;; } PopplerFontType; + +(define-enum-extended FontType + (in-module "Poppler") + (c-name "PopplerFontType") + (values + '("unknown" "POPPLER_FONT_TYPE_UNKNOWN" "0") + '("type1" "POPPLER_FONT_TYPE_TYPE1" "1") + '("type1c" "POPPLER_FONT_TYPE_TYPE1C" "2") + '("type1cot" "POPPLER_FONT_TYPE_TYPE1COT" "3") + '("type3" "POPPLER_FONT_TYPE_TYPE3" "4") + '("truetype" "POPPLER_FONT_TYPE_TRUETYPE" "5") + '("truetypeot" "POPPLER_FONT_TYPE_TRUETYPEOT" "6") + '("cid-type0" "POPPLER_FONT_TYPE_CID_TYPE0" "7") + '("cid-type0c" "POPPLER_FONT_TYPE_CID_TYPE0C" "8") + '("cid-type0cot" "POPPLER_FONT_TYPE_CID_TYPE0COT" "9") + '("cid-type2" "POPPLER_FONT_TYPE_CID_TYPE2" "10") + '("cid-type2ot" "POPPLER_FONT_TYPE_CID_TYPE2OT" "11") + ) +) + +;; Original typedef: +;; typedef enum /*< flags >*/ +;; { +;; POPPLER_VIEWER_PREFERENCES_UNSET = 0, +;; POPPLER_VIEWER_PREFERENCES_HIDE_TOOLBAR = 1 << 0, +;; POPPLER_VIEWER_PREFERENCES_HIDE_MENUBAR = 1 << 1, +;; POPPLER_VIEWER_PREFERENCES_HIDE_WINDOWUI = 1 << 2, +;; POPPLER_VIEWER_PREFERENCES_FIT_WINDOW = 1 << 3, +;; POPPLER_VIEWER_PREFERENCES_CENTER_WINDOW = 1 << 4, +;; POPPLER_VIEWER_PREFERENCES_DISPLAY_DOC_TITLE = 1 << 5, +;; POPPLER_VIEWER_PREFERENCES_DIRECTION_RTL = 1 << 6 +;; } PopplerViewerPreferences; + +(define-flags-extended ViewerPreferences + (in-module "Poppler") + (c-name "PopplerViewerPreferences") + (values + '("unset" "POPPLER_VIEWER_PREFERENCES_UNSET" "0x0") + '("hide-toolbar" "POPPLER_VIEWER_PREFERENCES_HIDE_TOOLBAR" "1 << 0") + '("hide-menubar" "POPPLER_VIEWER_PREFERENCES_HIDE_MENUBAR" "1 << 1") + '("hide-windowui" "POPPLER_VIEWER_PREFERENCES_HIDE_WINDOWUI" "1 << 2") + '("fit-window" "POPPLER_VIEWER_PREFERENCES_FIT_WINDOW" "1 << 3") + '("center-window" "POPPLER_VIEWER_PREFERENCES_CENTER_WINDOW" "1 << 4") + '("display-doc-title" "POPPLER_VIEWER_PREFERENCES_DISPLAY_DOC_TITLE" "1 << 5") + '("direction-rtl" "POPPLER_VIEWER_PREFERENCES_DIRECTION_RTL" "1 << 6") + ) +) + +;; Original typedef: +;; typedef enum /*< flags >*/ +;; { +;; POPPLER_PERMISSIONS_OK_TO_PRINT = 1 << 0, +;; POPPLER_PERMISSIONS_OK_TO_MODIFY = 1 << 1, +;; POPPLER_PERMISSIONS_OK_TO_COPY = 1 << 2, +;; POPPLER_PERMISSIONS_OK_TO_ADD_NOTES = 1 << 3, +;; POPPLER_PERMISSIONS_OK_TO_FILL_FORM = 1 << 4, +;; POPPLER_PERMISSIONS_OK_TO_EXTRACT_CONTENTS = 1 << 5, +;; POPPLER_PERMISSIONS_OK_TO_ASSEMBLE = 1 << 6, +;; POPPLER_PERMISSIONS_OK_TO_PRINT_HIGH_RESOLUTION = 1 << 7, +;; POPPLER_PERMISSIONS_FULL = (POPPLER_PERMISSIONS_OK_TO_PRINT | POPPLER_PERMISSIONS_OK_TO_MODIFY | POPPLER_PERMISSIONS_OK_TO_COPY | POPPLER_PERMISSIONS_OK_TO_ADD_NOTES | POPPLER_PERMISSIONS_OK_TO_FILL_FORM | POPPLER_PERMISSIONS_OK_TO_EXTRACT_CONTENTS | POPPLER_PERMISSIONS_OK_TO_ASSEMBLE | POPPLER_PERMISSIONS_OK_TO_PRINT_HIGH_RESOLUTION) +;; +;; } PopplerPermissions; + +(define-flags-extended Permissions + (in-module "Poppler") + (c-name "PopplerPermissions") + (values + '("ok-to-print" "POPPLER_PERMISSIONS_OK_TO_PRINT" "1 << 0") + '("ok-to-modify" "POPPLER_PERMISSIONS_OK_TO_MODIFY" "1 << 1") + '("ok-to-copy" "POPPLER_PERMISSIONS_OK_TO_COPY" "1 << 2") + '("ok-to-add-notes" "POPPLER_PERMISSIONS_OK_TO_ADD_NOTES" "1 << 3") + '("ok-to-fill-form" "POPPLER_PERMISSIONS_OK_TO_FILL_FORM" "1 << 4") + '("ok-to-extract-contents" "POPPLER_PERMISSIONS_OK_TO_EXTRACT_CONTENTS" "1 << 5") + '("ok-to-assemble" "POPPLER_PERMISSIONS_OK_TO_ASSEMBLE" "1 << 6") + '("ok-to-print-high-resolution" "POPPLER_PERMISSIONS_OK_TO_PRINT_HIGH_RESOLUTION" "1 << 7") + '("full" "POPPLER_PERMISSIONS_FULL" "0xFF") + ) +) + +;; From poppler-form-field.h + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_FORM_FIELD_UNKNOWN, +;; POPPLER_FORM_FIELD_BUTTON, +;; POPPLER_FORM_FIELD_TEXT, +;; POPPLER_FORM_FIELD_CHOICE, +;; POPPLER_FORM_FIELD_SIGNATURE +;; } PopplerFormFieldType; + +(define-enum-extended FormFieldType + (in-module "Poppler") + (c-name "PopplerFormFieldType") + (values + '("unknown" "POPPLER_FORM_FIELD_UNKNOWN" "0") + '("button" "POPPLER_FORM_FIELD_BUTTON" "1") + '("text" "POPPLER_FORM_FIELD_TEXT" "2") + '("choice" "POPPLER_FORM_FIELD_CHOICE" "3") + '("signature" "POPPLER_FORM_FIELD_SIGNATURE" "4") + ) +) + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_FORM_BUTTON_PUSH, +;; POPPLER_FORM_BUTTON_CHECK, +;; POPPLER_FORM_BUTTON_RADIO +;; } PopplerFormButtonType; + +(define-enum-extended FormButtonType + (in-module "Poppler") + (c-name "PopplerFormButtonType") + (values + '("push" "POPPLER_FORM_BUTTON_PUSH" "0") + '("check" "POPPLER_FORM_BUTTON_CHECK" "1") + '("radio" "POPPLER_FORM_BUTTON_RADIO" "2") + ) +) + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_FORM_TEXT_NORMAL, +;; POPPLER_FORM_TEXT_MULTILINE, +;; POPPLER_FORM_TEXT_FILE_SELECT +;; } PopplerFormTextType; + +(define-enum-extended FormTextType + (in-module "Poppler") + (c-name "PopplerFormTextType") + (values + '("normal" "POPPLER_FORM_TEXT_NORMAL" "0") + '("multiline" "POPPLER_FORM_TEXT_MULTILINE" "1") + '("file-select" "POPPLER_FORM_TEXT_FILE_SELECT" "2") + ) +) + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_FORM_CHOICE_COMBO, +;; POPPLER_FORM_CHOICE_LIST +;; } PopplerFormChoiceType; + +(define-enum-extended FormChoiceType + (in-module "Poppler") + (c-name "PopplerFormChoiceType") + (values + '("combo" "POPPLER_FORM_CHOICE_COMBO" "0") + '("list" "POPPLER_FORM_CHOICE_LIST" "1") + ) +) + +;; From poppler.h + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_ERROR_INVALID, +;; POPPLER_ERROR_ENCRYPTED, +;; POPPLER_ERROR_OPEN_FILE, +;; POPPLER_ERROR_BAD_CATALOG, +;; POPPLER_ERROR_DAMAGED +;; } PopplerError; + +(define-enum-extended Error + (in-module "Poppler") + (c-name "PopplerError") + (values + '("invalid" "POPPLER_ERROR_INVALID" "0") + '("encrypted" "POPPLER_ERROR_ENCRYPTED" "1") + '("open-file" "POPPLER_ERROR_OPEN_FILE" "2") + '("bad-catalog" "POPPLER_ERROR_BAD_CATALOG" "3") + '("damaged" "POPPLER_ERROR_DAMAGED" "4") + ) +) + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_ORIENTATION_PORTRAIT, +;; POPPLER_ORIENTATION_LANDSCAPE, +;; POPPLER_ORIENTATION_UPSIDEDOWN, +;; POPPLER_ORIENTATION_SEASCAPE +;; } PopplerOrientation; + +(define-enum-extended Orientation + (in-module "Poppler") + (c-name "PopplerOrientation") + (values + '("portrait" "POPPLER_ORIENTATION_PORTRAIT" "0") + '("landscape" "POPPLER_ORIENTATION_LANDSCAPE" "1") + '("upsidedown" "POPPLER_ORIENTATION_UPSIDEDOWN" "2") + '("seascape" "POPPLER_ORIENTATION_SEASCAPE" "3") + ) +) + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_PAGE_TRANSITION_REPLACE, +;; POPPLER_PAGE_TRANSITION_SPLIT, +;; POPPLER_PAGE_TRANSITION_BLINDS, +;; POPPLER_PAGE_TRANSITION_BOX, +;; POPPLER_PAGE_TRANSITION_WIPE, +;; POPPLER_PAGE_TRANSITION_DISSOLVE, +;; POPPLER_PAGE_TRANSITION_GLITTER, +;; POPPLER_PAGE_TRANSITION_FLY, +;; POPPLER_PAGE_TRANSITION_PUSH, +;; POPPLER_PAGE_TRANSITION_COVER, +;; POPPLER_PAGE_TRANSITION_UNCOVER, +;; POPPLER_PAGE_TRANSITION_FADE +;; } PopplerPageTransitionType; + +(define-enum-extended PageTransitionType + (in-module "Poppler") + (c-name "PopplerPageTransitionType") + (values + '("replace" "POPPLER_PAGE_TRANSITION_REPLACE" "0") + '("split" "POPPLER_PAGE_TRANSITION_SPLIT" "1") + '("blinds" "POPPLER_PAGE_TRANSITION_BLINDS" "2") + '("box" "POPPLER_PAGE_TRANSITION_BOX" "3") + '("wipe" "POPPLER_PAGE_TRANSITION_WIPE" "4") + '("dissolve" "POPPLER_PAGE_TRANSITION_DISSOLVE" "5") + '("glitter" "POPPLER_PAGE_TRANSITION_GLITTER" "6") + '("fly" "POPPLER_PAGE_TRANSITION_FLY" "7") + '("push" "POPPLER_PAGE_TRANSITION_PUSH" "8") + '("cover" "POPPLER_PAGE_TRANSITION_COVER" "9") + '("uncover" "POPPLER_PAGE_TRANSITION_UNCOVER" "10") + '("fade" "POPPLER_PAGE_TRANSITION_FADE" "11") + ) +) + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_PAGE_TRANSITION_HORIZONTAL, +;; POPPLER_PAGE_TRANSITION_VERTICAL +;; } PopplerPageTransitionAlignment; + +(define-enum-extended PageTransitionAlignment + (in-module "Poppler") + (c-name "PopplerPageTransitionAlignment") + (values + '("horizontal" "POPPLER_PAGE_TRANSITION_HORIZONTAL" "0") + '("vertical" "POPPLER_PAGE_TRANSITION_VERTICAL" "1") + ) +) + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_PAGE_TRANSITION_INWARD, +;; POPPLER_PAGE_TRANSITION_OUTWARD +;; } PopplerPageTransitionDirection; + +(define-enum-extended PageTransitionDirection + (in-module "Poppler") + (c-name "PopplerPageTransitionDirection") + (values + '("inward" "POPPLER_PAGE_TRANSITION_INWARD" "0") + '("outward" "POPPLER_PAGE_TRANSITION_OUTWARD" "1") + ) +) + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_SELECTION_GLYPH, +;; POPPLER_SELECTION_WORD, +;; POPPLER_SELECTION_LINE +;; } PopplerSelectionStyle; + +(define-enum-extended SelectionStyle + (in-module "Poppler") + (c-name "PopplerSelectionStyle") + (values + '("glyph" "POPPLER_SELECTION_GLYPH" "0") + '("word" "POPPLER_SELECTION_WORD" "1") + '("line" "POPPLER_SELECTION_LINE" "2") + ) +) + +;; Original typedef: +;; typedef enum /*< flags >*/ +;; { +;; POPPLER_PRINT_DOCUMENT = 0, +;; POPPLER_PRINT_MARKUP_ANNOTS = 1 << 0, +;; POPPLER_PRINT_STAMP_ANNOTS_ONLY = 1 << 1, +;; POPPLER_PRINT_ALL = POPPLER_PRINT_MARKUP_ANNOTS +;; } PopplerPrintFlags; + +(define-flags-extended PrintFlags + (in-module "Poppler") + (c-name "PopplerPrintFlags") + (values + '("document" "POPPLER_PRINT_DOCUMENT" "0x0") + '("markup-annots" "POPPLER_PRINT_MARKUP_ANNOTS" "1 << 0") + '("stamp-annots-only" "POPPLER_PRINT_STAMP_ANNOTS_ONLY" "1 << 1") + '("all" "POPPLER_PRINT_ALL" "0x1") + ) +) + +;; Original typedef: +;; typedef enum +;; { +;; POPPLER_BACKEND_UNKNOWN, +;; POPPLER_BACKEND_SPLASH, +;; POPPLER_BACKEND_CAIRO +;; } PopplerBackend; + +(define-enum-extended Backend + (in-module "Poppler") + (c-name "PopplerBackend") + (values + '("unknown" "POPPLER_BACKEND_UNKNOWN" "0") + '("splash" "POPPLER_BACKEND_SPLASH" "1") + '("cairo" "POPPLER_BACKEND_CAIRO" "2") + ) +) + diff --git a/poppler-glib/src/poppler-glib_extra.defs b/poppler-glib/src/poppler-glib_extra.defs new file mode 100644 index 0000000..1372cf9 --- /dev/null +++ b/poppler-glib/src/poppler-glib_extra.defs @@ -0,0 +1,277 @@ +;; From PopplerAction + +;; From PopplerActionLayerAction + +;; From PopplerActionMovieOperation + +;; From PopplerActionType + +;; From PopplerAnnot + +;; From PopplerAnnotCalloutLine + +;; From PopplerAnnotExternalDataType + +;; From PopplerAnnotFileAttachment + +;; From PopplerAnnotFlag + +;; From PopplerAnnotFreeText + +;; From PopplerAnnotFreeTextQuadding + +;; From PopplerAnnotMapping + +;; From PopplerAnnotMarkup + +;; From PopplerAnnotMarkupReplyType + +;; From PopplerAnnotMovie + +;; From PopplerAnnotScreen + +;; From PopplerAnnotText + +;; From PopplerAnnotTextState + +;; From PopplerAnnotType + +;; From PopplerAttachment + +;; From PopplerBackend + +;; From PopplerColor + +;; From PopplerDest + +;; From PopplerDestType + +;; From PopplerDocument + +(define-property title + (of-object "PopplerDocument") + (prop-type "GParamString") + (docs "The title of the document") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property format + (of-object "PopplerDocument") + (prop-type "GParamString") + (docs "The PDF version of the document") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property format-major + (of-object "PopplerDocument") + (prop-type "GParamUInt") + (docs "The PDF major version number of the document") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property format-minor + (of-object "PopplerDocument") + (prop-type "GParamUInt") + (docs "The PDF minor version number of the document") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property author + (of-object "PopplerDocument") + (prop-type "GParamString") + (docs "The author of the document") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property subject + (of-object "PopplerDocument") + (prop-type "GParamString") + (docs "Subjects the document touches") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property keywords + (of-object "PopplerDocument") + (prop-type "GParamString") + (docs "Keywords") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property creator + (of-object "PopplerDocument") + (prop-type "GParamString") + (docs "The software that created the document") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property producer + (of-object "PopplerDocument") + (prop-type "GParamString") + (docs "The software that converted the document") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property creation-date + (of-object "PopplerDocument") + (prop-type "GParamInt") + (docs "The date and time the document was created") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property mod-date + (of-object "PopplerDocument") + (prop-type "GParamInt") + (docs "The date and time the document was modified") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property linearized + (of-object "PopplerDocument") + (prop-type "GParamBoolean") + (docs "Is the document optimized for web viewing?") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property page-layout + (of-object "PopplerDocument") + (prop-type "GParamEnum") + (docs "Initial Page Layout") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property page-mode + (of-object "PopplerDocument") + (prop-type "GParamEnum") + (docs "Page Mode") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property viewer-preferences + (of-object "PopplerDocument") + (prop-type "GParamFlags") + (docs "Viewer Preferences") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property permissions + (of-object "PopplerDocument") + (prop-type "GParamFlags") + (docs "Permissions") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property metadata + (of-object "PopplerDocument") + (prop-type "GParamString") + (docs "Embedded XML metadata") + (readable #t) + (writable #f) + (construct-only #f) +) + +;; From PopplerError + +;; From PopplerFontsIter + +;; From PopplerFontInfo + +;; From PopplerFontType + +;; From PopplerFormButtonType + +;; From PopplerFormChoiceType + +;; From PopplerFormField + +;; From PopplerFormFieldMapping + +;; From PopplerFormFieldType + +;; From PopplerFormTextType + +;; From PopplerImageMapping + +;; From PopplerIndexIter + +;; From PopplerLayer + +;; From PopplerLayersIter + +;; From PopplerLinkMapping + +;; From PopplerMedia + +;; From PopplerMovie + +;; From PopplerOrientation + +;; From PopplerPage + +(define-property label + (of-object "PopplerPage") + (prop-type "GParamString") + (docs "The label of the page") + (readable #t) + (writable #f) + (construct-only #f) +) + +;; From PopplerPageLayout + +;; From PopplerPageMode + +;; From PopplerPageTransition + +;; From PopplerPageTransitionAlignment + +;; From PopplerPageTransitionDirection + +;; From PopplerPageTransitionType + +;; From PopplerPermissions + +;; From PopplerPrintFlags + +;; From PopplerPSFile + +;; From PopplerRectangle + +;; From PopplerSelectionStyle + +;; From PopplerTextAttributes + +;; From PopplerViewerPreferences + + diff --git a/poppler-glib/src/poppler-glib_method.defs b/poppler-glib/src/poppler-glib_method.defs new file mode 100644 index 0000000..5add90c --- /dev/null +++ b/poppler-glib/src/poppler-glib_method.defs @@ -0,0 +1,2201 @@ +;; -*- scheme -*- +; object definitions ... +(define-object Attachment + (in-module "Poppler") + (parent "GObject") + (c-name "PopplerAttachment") + (gtype-id "POPPLER_TYPE_ATTACHMENT") +) + +(define-object Attachment + (in-module "Poppler") + (parent "GObject") + (c-name "PopplerAttachment") + (gtype-id "POPPLER_TYPE_ATTACHMENT") +) + +;; Enumerations and flags ... + +(define-enum ActionType + (in-module "Poppler") + (c-name "PopplerActionType") + (gtype-id "POPPLER_TYPE_ACTION_TYPE") + (values + '("unknown" "POPPLER_ACTION_UNKNOWN") + '("none" "POPPLER_ACTION_NONE") + '("goto-dest" "POPPLER_ACTION_GOTO_DEST") + '("goto-remote" "POPPLER_ACTION_GOTO_REMOTE") + '("launch" "POPPLER_ACTION_LAUNCH") + '("uri" "POPPLER_ACTION_URI") + '("named" "POPPLER_ACTION_NAMED") + '("movie" "POPPLER_ACTION_MOVIE") + '("rendition" "POPPLER_ACTION_RENDITION") + '("ocg-state" "POPPLER_ACTION_OCG_STATE") + '("javascript" "POPPLER_ACTION_JAVASCRIPT") + ) +) + +(define-enum DestType + (in-module "Poppler") + (c-name "PopplerDestType") + (gtype-id "POPPLER_TYPE_DEST_TYPE") + (values + '("unknown" "POPPLER_DEST_UNKNOWN") + '("xyz" "POPPLER_DEST_XYZ") + '("fit" "POPPLER_DEST_FIT") + '("fith" "POPPLER_DEST_FITH") + '("fitv" "POPPLER_DEST_FITV") + '("fitr" "POPPLER_DEST_FITR") + '("fitb" "POPPLER_DEST_FITB") + '("fitbh" "POPPLER_DEST_FITBH") + '("fitbv" "POPPLER_DEST_FITBV") + '("named" "POPPLER_DEST_NAMED") + ) +) + +(define-enum ActionMovieOperation + (in-module "Poppler") + (c-name "PopplerActionMovieOperation") + (gtype-id "POPPLER_TYPE_ACTION_MOVIE_OPERATION") + (values + '("play" "POPPLER_ACTION_MOVIE_PLAY") + '("pause" "POPPLER_ACTION_MOVIE_PAUSE") + '("resume" "POPPLER_ACTION_MOVIE_RESUME") + '("stop" "POPPLER_ACTION_MOVIE_STOP") + ) +) + +(define-enum ActionLayerAction + (in-module "Poppler") + (c-name "PopplerActionLayerAction") + (gtype-id "POPPLER_TYPE_ACTION_LAYER_ACTION") + (values + '("on" "POPPLER_ACTION_LAYER_ON") + '("off" "POPPLER_ACTION_LAYER_OFF") + '("toggle" "POPPLER_ACTION_LAYER_TOGGLE") + ) +) + +(define-enum AnnotType + (in-module "Poppler") + (c-name "PopplerAnnotType") + (gtype-id "POPPLER_TYPE_ANNOT_TYPE") + (values + '("unknown" "POPPLER_ANNOT_UNKNOWN") + '("text" "POPPLER_ANNOT_TEXT") + '("link" "POPPLER_ANNOT_LINK") + '("free-text" "POPPLER_ANNOT_FREE_TEXT") + '("line" "POPPLER_ANNOT_LINE") + '("square" "POPPLER_ANNOT_SQUARE") + '("circle" "POPPLER_ANNOT_CIRCLE") + '("polygon" "POPPLER_ANNOT_POLYGON") + '("poly-line" "POPPLER_ANNOT_POLY_LINE") + '("highlight" "POPPLER_ANNOT_HIGHLIGHT") + '("underline" "POPPLER_ANNOT_UNDERLINE") + '("squiggly" "POPPLER_ANNOT_SQUIGGLY") + '("strike-out" "POPPLER_ANNOT_STRIKE_OUT") + '("stamp" "POPPLER_ANNOT_STAMP") + '("caret" "POPPLER_ANNOT_CARET") + '("ink" "POPPLER_ANNOT_INK") + '("popup" "POPPLER_ANNOT_POPUP") + '("file-attachment" "POPPLER_ANNOT_FILE_ATTACHMENT") + '("sound" "POPPLER_ANNOT_SOUND") + '("movie" "POPPLER_ANNOT_MOVIE") + '("widget" "POPPLER_ANNOT_WIDGET") + '("screen" "POPPLER_ANNOT_SCREEN") + '("printer-mark" "POPPLER_ANNOT_PRINTER_MARK") + '("trap-net" "POPPLER_ANNOT_TRAP_NET") + '("watermark" "POPPLER_ANNOT_WATERMARK") + '("3d" "POPPLER_ANNOT_3D") + ) +) + +(define-flags AnnotFlag + (in-module "Poppler") + (c-name "PopplerAnnotFlag") + (gtype-id "POPPLER_TYPE_ANNOT_FLAG") + (values + '("unknown" "POPPLER_ANNOT_FLAG_UNKNOWN") + '("invisible" "POPPLER_ANNOT_FLAG_INVISIBLE") + '("hidden" "POPPLER_ANNOT_FLAG_HIDDEN") + '("print" "POPPLER_ANNOT_FLAG_PRINT") + '("no-zoom" "POPPLER_ANNOT_FLAG_NO_ZOOM") + '("no-rotate" "POPPLER_ANNOT_FLAG_NO_ROTATE") + '("no-view" "POPPLER_ANNOT_FLAG_NO_VIEW") + '("read-only" "POPPLER_ANNOT_FLAG_READ_ONLY") + '("locked" "POPPLER_ANNOT_FLAG_LOCKED") + '("toggle-no-view" "POPPLER_ANNOT_FLAG_TOGGLE_NO_VIEW") + '("locked-contents" "POPPLER_ANNOT_FLAG_LOCKED_CONTENTS") + ) +) + +(define-enum AnnotMarkupReplyType + (in-module "Poppler") + (c-name "PopplerAnnotMarkupReplyType") + (gtype-id "POPPLER_TYPE_ANNOT_MARKUP_REPLY_TYPE") + (values + '("r" "POPPLER_ANNOT_MARKUP_REPLY_TYPE_R") + '("group" "POPPLER_ANNOT_MARKUP_REPLY_TYPE_GROUP") + ) +) + +(define-enum AnnotExternalDataType + (in-module "Poppler") + (c-name "PopplerAnnotExternalDataType") + (gtype-id "POPPLER_TYPE_ANNOT_EXTERNAL_DATA_TYPE") + (values + '("3d" "POPPLER_ANNOT_EXTERNAL_DATA_MARKUP_3D") + '("unknown" "POPPLER_ANNOT_EXTERNAL_DATA_MARKUP_UNKNOWN") + ) +) + +(define-enum AnnotTextState + (in-module "Poppler") + (c-name "PopplerAnnotTextState") + (gtype-id "POPPLER_TYPE_ANNOT_TEXT_STATE") + (values + '("marked" "POPPLER_ANNOT_TEXT_STATE_MARKED") + '("unmarked" "POPPLER_ANNOT_TEXT_STATE_UNMARKED") + '("accepted" "POPPLER_ANNOT_TEXT_STATE_ACCEPTED") + '("rejected" "POPPLER_ANNOT_TEXT_STATE_REJECTED") + '("cancelled" "POPPLER_ANNOT_TEXT_STATE_CANCELLED") + '("completed" "POPPLER_ANNOT_TEXT_STATE_COMPLETED") + '("none" "POPPLER_ANNOT_TEXT_STATE_NONE") + '("unknown" "POPPLER_ANNOT_TEXT_STATE_UNKNOWN") + ) +) + +(define-enum AnnotFreeTextQuadding + (in-module "Poppler") + (c-name "PopplerAnnotFreeTextQuadding") + (gtype-id "POPPLER_TYPE_ANNOT_FREE_TEXT_QUADDING") + (values + '("left-justified" "POPPLER_ANNOT_FREE_TEXT_QUADDING_LEFT_JUSTIFIED") + '("centered" "POPPLER_ANNOT_FREE_TEXT_QUADDING_CENTERED") + '("right-justified" "POPPLER_ANNOT_FREE_TEXT_QUADDING_RIGHT_JUSTIFIED") + ) +) + +(define-enum PageLayout + (in-module "Poppler") + (c-name "PopplerPageLayout") + (gtype-id "POPPLER_TYPE_PAGE_LAYOUT") + (values + '("unset" "POPPLER_PAGE_LAYOUT_UNSET") + '("single-page" "POPPLER_PAGE_LAYOUT_SINGLE_PAGE") + '("one-column" "POPPLER_PAGE_LAYOUT_ONE_COLUMN") + '("two-column-left" "POPPLER_PAGE_LAYOUT_TWO_COLUMN_LEFT") + '("two-column-right" "POPPLER_PAGE_LAYOUT_TWO_COLUMN_RIGHT") + '("two-page-left" "POPPLER_PAGE_LAYOUT_TWO_PAGE_LEFT") + '("two-page-right" "POPPLER_PAGE_LAYOUT_TWO_PAGE_RIGHT") + ) +) + +(define-enum PageMode + (in-module "Poppler") + (c-name "PopplerPageMode") + (gtype-id "POPPLER_TYPE_PAGE_MODE") + (values + '("unset" "POPPLER_PAGE_MODE_UNSET") + '("none" "POPPLER_PAGE_MODE_NONE") + '("use-outlines" "POPPLER_PAGE_MODE_USE_OUTLINES") + '("use-thumbs" "POPPLER_PAGE_MODE_USE_THUMBS") + '("full-screen" "POPPLER_PAGE_MODE_FULL_SCREEN") + '("use-oc" "POPPLER_PAGE_MODE_USE_OC") + '("use-attachments" "POPPLER_PAGE_MODE_USE_ATTACHMENTS") + ) +) + +(define-enum FontType + (in-module "Poppler") + (c-name "PopplerFontType") + (gtype-id "POPPLER_TYPE_FONT_TYPE") + (values + '("unknown" "POPPLER_FONT_TYPE_UNKNOWN") + '("type1" "POPPLER_FONT_TYPE_TYPE1") + '("type1c" "POPPLER_FONT_TYPE_TYPE1C") + '("type1cot" "POPPLER_FONT_TYPE_TYPE1COT") + '("type3" "POPPLER_FONT_TYPE_TYPE3") + '("truetype" "POPPLER_FONT_TYPE_TRUETYPE") + '("truetypeot" "POPPLER_FONT_TYPE_TRUETYPEOT") + '("cid-type0" "POPPLER_FONT_TYPE_CID_TYPE0") + '("cid-type0c" "POPPLER_FONT_TYPE_CID_TYPE0C") + '("cid-type0cot" "POPPLER_FONT_TYPE_CID_TYPE0COT") + '("cid-type2" "POPPLER_FONT_TYPE_CID_TYPE2") + '("cid-type2ot" "POPPLER_FONT_TYPE_CID_TYPE2OT") + ) +) + +(define-flags ViewerPreferences + (in-module "Poppler") + (c-name "PopplerViewerPreferences") + (gtype-id "POPPLER_TYPE_VIEWER_PREFERENCES") + (values + '("unset" "POPPLER_VIEWER_PREFERENCES_UNSET") + '("hide-toolbar" "POPPLER_VIEWER_PREFERENCES_HIDE_TOOLBAR") + '("hide-menubar" "POPPLER_VIEWER_PREFERENCES_HIDE_MENUBAR") + '("hide-windowui" "POPPLER_VIEWER_PREFERENCES_HIDE_WINDOWUI") + '("fit-window" "POPPLER_VIEWER_PREFERENCES_FIT_WINDOW") + '("center-window" "POPPLER_VIEWER_PREFERENCES_CENTER_WINDOW") + '("display-doc-title" "POPPLER_VIEWER_PREFERENCES_DISPLAY_DOC_TITLE") + '("direction-rtl" "POPPLER_VIEWER_PREFERENCES_DIRECTION_RTL") + ) +) + +(define-flags Permissions + (in-module "Poppler") + (c-name "PopplerPermissions") + (gtype-id "POPPLER_TYPE_PERMISSIONS") + (values + '("ok-to-print" "POPPLER_PERMISSIONS_OK_TO_PRINT") + '("ok-to-modify" "POPPLER_PERMISSIONS_OK_TO_MODIFY") + '("ok-to-copy" "POPPLER_PERMISSIONS_OK_TO_COPY") + '("ok-to-add-notes" "POPPLER_PERMISSIONS_OK_TO_ADD_NOTES") + '("ok-to-fill-form" "POPPLER_PERMISSIONS_OK_TO_FILL_FORM") + '("ok-to-extract-contents" "POPPLER_PERMISSIONS_OK_TO_EXTRACT_CONTENTS") + '("ok-to-assemble" "POPPLER_PERMISSIONS_OK_TO_ASSEMBLE") + '("ok-to-print-high-resolution" "POPPLER_PERMISSIONS_OK_TO_PRINT_HIGH_RESOLUTION") + '("full" "POPPLER_PERMISSIONS_FULL") + ) +) + +(define-enum FormFieldType + (in-module "Poppler") + (c-name "PopplerFormFieldType") + (gtype-id "POPPLER_TYPE_FORM_FIELD_TYPE") + (values + '("unknown" "POPPLER_FORM_FIELD_UNKNOWN") + '("button" "POPPLER_FORM_FIELD_BUTTON") + '("text" "POPPLER_FORM_FIELD_TEXT") + '("choice" "POPPLER_FORM_FIELD_CHOICE") + '("signature" "POPPLER_FORM_FIELD_SIGNATURE") + ) +) + +(define-enum FormButtonType + (in-module "Poppler") + (c-name "PopplerFormButtonType") + (gtype-id "POPPLER_TYPE_FORM_BUTTON_TYPE") + (values + '("push" "POPPLER_FORM_BUTTON_PUSH") + '("check" "POPPLER_FORM_BUTTON_CHECK") + '("radio" "POPPLER_FORM_BUTTON_RADIO") + ) +) + +(define-enum FormTextType + (in-module "Poppler") + (c-name "PopplerFormTextType") + (gtype-id "POPPLER_TYPE_FORM_TEXT_TYPE") + (values + '("normal" "POPPLER_FORM_TEXT_NORMAL") + '("multiline" "POPPLER_FORM_TEXT_MULTILINE") + '("file-select" "POPPLER_FORM_TEXT_FILE_SELECT") + ) +) + +(define-enum FormChoiceType + (in-module "Poppler") + (c-name "PopplerFormChoiceType") + (gtype-id "POPPLER_TYPE_FORM_CHOICE_TYPE") + (values + '("combo" "POPPLER_FORM_CHOICE_COMBO") + '("list" "POPPLER_FORM_CHOICE_LIST") + ) +) + +(define-enum Error + (in-module "Poppler") + (c-name "PopplerError") + (gtype-id "POPPLER_TYPE_ERROR") + (values + '("invalid" "POPPLER_ERROR_INVALID") + '("encrypted" "POPPLER_ERROR_ENCRYPTED") + '("open-file" "POPPLER_ERROR_OPEN_FILE") + '("bad-catalog" "POPPLER_ERROR_BAD_CATALOG") + '("damaged" "POPPLER_ERROR_DAMAGED") + ) +) + +(define-enum Orientation + (in-module "Poppler") + (c-name "PopplerOrientation") + (gtype-id "POPPLER_TYPE_ORIENTATION") + (values + '("portrait" "POPPLER_ORIENTATION_PORTRAIT") + '("landscape" "POPPLER_ORIENTATION_LANDSCAPE") + '("upsidedown" "POPPLER_ORIENTATION_UPSIDEDOWN") + '("seascape" "POPPLER_ORIENTATION_SEASCAPE") + ) +) + +(define-enum PageTransitionType + (in-module "Poppler") + (c-name "PopplerPageTransitionType") + (gtype-id "POPPLER_TYPE_PAGE_TRANSITION_TYPE") + (values + '("replace" "POPPLER_PAGE_TRANSITION_REPLACE") + '("split" "POPPLER_PAGE_TRANSITION_SPLIT") + '("blinds" "POPPLER_PAGE_TRANSITION_BLINDS") + '("box" "POPPLER_PAGE_TRANSITION_BOX") + '("wipe" "POPPLER_PAGE_TRANSITION_WIPE") + '("dissolve" "POPPLER_PAGE_TRANSITION_DISSOLVE") + '("glitter" "POPPLER_PAGE_TRANSITION_GLITTER") + '("fly" "POPPLER_PAGE_TRANSITION_FLY") + '("push" "POPPLER_PAGE_TRANSITION_PUSH") + '("cover" "POPPLER_PAGE_TRANSITION_COVER") + '("uncover" "POPPLER_PAGE_TRANSITION_UNCOVER") + '("fade" "POPPLER_PAGE_TRANSITION_FADE") + ) +) + +(define-enum PageTransitionAlignment + (in-module "Poppler") + (c-name "PopplerPageTransitionAlignment") + (gtype-id "POPPLER_TYPE_PAGE_TRANSITION_ALIGNMENT") + (values + '("horizontal" "POPPLER_PAGE_TRANSITION_HORIZONTAL") + '("vertical" "POPPLER_PAGE_TRANSITION_VERTICAL") + ) +) + +(define-enum PageTransitionDirection + (in-module "Poppler") + (c-name "PopplerPageTransitionDirection") + (gtype-id "POPPLER_TYPE_PAGE_TRANSITION_DIRECTION") + (values + '("inward" "POPPLER_PAGE_TRANSITION_INWARD") + '("outward" "POPPLER_PAGE_TRANSITION_OUTWARD") + ) +) + +(define-enum SelectionStyle + (in-module "Poppler") + (c-name "PopplerSelectionStyle") + (gtype-id "POPPLER_TYPE_SELECTION_STYLE") + (values + '("glyph" "POPPLER_SELECTION_GLYPH") + '("word" "POPPLER_SELECTION_WORD") + '("line" "POPPLER_SELECTION_LINE") + ) +) + +(define-flags PrintFlags + (in-module "Poppler") + (c-name "PopplerPrintFlags") + (gtype-id "POPPLER_TYPE_PRINT_FLAGS") + (values + '("document" "POPPLER_PRINT_DOCUMENT") + '("markup-annots" "POPPLER_PRINT_MARKUP_ANNOTS") + '("stamp-annots-only" "POPPLER_PRINT_STAMP_ANNOTS_ONLY") + '("all" "POPPLER_PRINT_ALL") + ) +) + +(define-enum Backend + (in-module "Poppler") + (c-name "PopplerBackend") + (gtype-id "POPPLER_TYPE_BACKEND") + (values + '("unknown" "POPPLER_BACKEND_UNKNOWN") + '("splash" "POPPLER_BACKEND_SPLASH") + '("cairo" "POPPLER_BACKEND_CAIRO") + ) +) + + +;; From poppler-action.h + +(define-function poppler_action_get_type + (c-name "poppler_action_get_type") + (return-type "GType") +) + +(define-method free + (of-object "PopplerAction") + (c-name "poppler_action_free") + (return-type "none") +) + +(define-method copy + (of-object "PopplerAction") + (c-name "poppler_action_copy") + (return-type "PopplerAction*") +) + +(define-function poppler_dest_get_type + (c-name "poppler_dest_get_type") + (return-type "GType") +) + +(define-method free + (of-object "PopplerDest") + (c-name "poppler_dest_free") + (return-type "none") +) + +(define-method copy + (of-object "PopplerDest") + (c-name "poppler_dest_copy") + (return-type "PopplerDest*") +) + + + +;; From poppler-annot.h + +(define-function poppler_annot_get_type + (c-name "poppler_annot_get_type") + (return-type "GType") +) + +(define-method get_annot_type + (of-object "PopplerAnnot") + (c-name "poppler_annot_get_annot_type") + (return-type "PopplerAnnotType") +) + +(define-method get_contents + (of-object "PopplerAnnot") + (c-name "poppler_annot_get_contents") + (return-type "gchar*") +) + +(define-method set_contents + (of-object "PopplerAnnot") + (c-name "poppler_annot_set_contents") + (return-type "none") + (parameters + '("const-gchar*" "contents") + ) +) + +(define-method get_name + (of-object "PopplerAnnot") + (c-name "poppler_annot_get_name") + (return-type "gchar*") +) + +(define-method get_modified + (of-object "PopplerAnnot") + (c-name "poppler_annot_get_modified") + (return-type "gchar*") +) + +(define-method get_flags + (of-object "PopplerAnnot") + (c-name "poppler_annot_get_flags") + (return-type "PopplerAnnotFlag") +) + +(define-method get_color + (of-object "PopplerAnnot") + (c-name "poppler_annot_get_color") + (return-type "PopplerColor*") +) + +(define-method set_color + (of-object "PopplerAnnot") + (c-name "poppler_annot_set_color") + (return-type "none") + (parameters + '("PopplerColor*" "poppler_color") + ) +) + +(define-method get_page_index + (of-object "PopplerAnnot") + (c-name "poppler_annot_get_page_index") + (return-type "gint") +) + +(define-function poppler_annot_markup_get_type + (c-name "poppler_annot_markup_get_type") + (return-type "GType") +) + +(define-method get_label + (of-object "PopplerAnnotMarkup") + (c-name "poppler_annot_markup_get_label") + (return-type "gchar*") +) + +(define-method set_label + (of-object "PopplerAnnotMarkup") + (c-name "poppler_annot_markup_set_label") + (return-type "none") + (parameters + '("const-gchar*" "label") + ) +) + +(define-method has_popup + (of-object "PopplerAnnotMarkup") + (c-name "poppler_annot_markup_has_popup") + (return-type "gboolean") +) + +(define-method set_popup + (of-object "PopplerAnnotMarkup") + (c-name "poppler_annot_markup_set_popup") + (return-type "none") + (parameters + '("PopplerRectangle*" "popup_rect") + ) +) + +(define-method get_popup_is_open + (of-object "PopplerAnnotMarkup") + (c-name "poppler_annot_markup_get_popup_is_open") + (return-type "gboolean") +) + +(define-method set_popup_is_open + (of-object "PopplerAnnotMarkup") + (c-name "poppler_annot_markup_set_popup_is_open") + (return-type "none") + (parameters + '("gboolean" "is_open") + ) +) + +(define-method get_popup_rectangle + (of-object "PopplerAnnotMarkup") + (c-name "poppler_annot_markup_get_popup_rectangle") + (return-type "gboolean") + (parameters + '("PopplerRectangle*" "poppler_rect") + ) +) + +(define-method get_opacity + (of-object "PopplerAnnotMarkup") + (c-name "poppler_annot_markup_get_opacity") + (return-type "gdouble") +) + +(define-method set_opacity + (of-object "PopplerAnnotMarkup") + (c-name "poppler_annot_markup_set_opacity") + (return-type "none") + (parameters + '("gdouble" "opacity") + ) +) + +(define-method get_date + (of-object "PopplerAnnotMarkup") + (c-name "poppler_annot_markup_get_date") + (return-type "GDate*") +) + +(define-method get_subject + (of-object "PopplerAnnotMarkup") + (c-name "poppler_annot_markup_get_subject") + (return-type "gchar*") +) + +(define-method get_reply_to + (of-object "PopplerAnnotMarkup") + (c-name "poppler_annot_markup_get_reply_to") + (return-type "PopplerAnnotMarkupReplyType") +) + +(define-method get_external_data + (of-object "PopplerAnnotMarkup") + (c-name "poppler_annot_markup_get_external_data") + (return-type "PopplerAnnotExternalDataType") +) + +(define-function poppler_annot_text_get_type + (c-name "poppler_annot_text_get_type") + (return-type "GType") +) + +(define-function poppler_annot_text_new + (c-name "poppler_annot_text_new") + (is-constructor-of "PopplerAnnotText") + (return-type "PopplerAnnot*") + (parameters + '("PopplerDocument*" "doc") + '("PopplerRectangle*" "rect") + ) +) + +(define-method get_is_open + (of-object "PopplerAnnotText") + (c-name "poppler_annot_text_get_is_open") + (return-type "gboolean") +) + +(define-method set_is_open + (of-object "PopplerAnnotText") + (c-name "poppler_annot_text_set_is_open") + (return-type "none") + (parameters + '("gboolean" "is_open") + ) +) + +(define-method get_icon + (of-object "PopplerAnnotText") + (c-name "poppler_annot_text_get_icon") + (return-type "gchar*") +) + +(define-method set_icon + (of-object "PopplerAnnotText") + (c-name "poppler_annot_text_set_icon") + (return-type "none") + (parameters + '("const-gchar*" "icon") + ) +) + +(define-method get_state + (of-object "PopplerAnnotText") + (c-name "poppler_annot_text_get_state") + (return-type "PopplerAnnotTextState") +) + +(define-function poppler_annot_free_text_get_type + (c-name "poppler_annot_free_text_get_type") + (return-type "GType") +) + +(define-method get_quadding + (of-object "PopplerAnnotFreeText") + (c-name "poppler_annot_free_text_get_quadding") + (return-type "PopplerAnnotFreeTextQuadding") +) + +(define-method get_callout_line + (of-object "PopplerAnnotFreeText") + (c-name "poppler_annot_free_text_get_callout_line") + (return-type "PopplerAnnotCalloutLine*") +) + +(define-function poppler_annot_file_attachment_get_type + (c-name "poppler_annot_file_attachment_get_type") + (return-type "GType") +) + +(define-method get_attachment + (of-object "PopplerAnnotFileAttachment") + (c-name "poppler_annot_file_attachment_get_attachment") + (return-type "PopplerAttachment*") +) + +(define-method get_name + (of-object "PopplerAnnotFileAttachment") + (c-name "poppler_annot_file_attachment_get_name") + (return-type "gchar*") +) + +(define-function poppler_annot_movie_get_type + (c-name "poppler_annot_movie_get_type") + (return-type "GType") +) + +(define-method get_title + (of-object "PopplerAnnotMovie") + (c-name "poppler_annot_movie_get_title") + (return-type "gchar*") +) + +(define-method get_movie + (of-object "PopplerAnnotMovie") + (c-name "poppler_annot_movie_get_movie") + (return-type "PopplerMovie*") +) + +(define-function poppler_annot_screen_get_type + (c-name "poppler_annot_screen_get_type") + (return-type "GType") +) + +(define-method get_action + (of-object "PopplerAnnotScreen") + (c-name "poppler_annot_screen_get_action") + (return-type "PopplerAction*") +) + +(define-function poppler_annot_callout_line_get_type + (c-name "poppler_annot_callout_line_get_type") + (return-type "GType") +) + +(define-function poppler_annot_callout_line_new + (c-name "poppler_annot_callout_line_new") + (is-constructor-of "PopplerAnnotCalloutLine") + (return-type "PopplerAnnotCalloutLine*") +) + +(define-method copy + (of-object "PopplerAnnotCalloutLine") + (c-name "poppler_annot_callout_line_copy") + (return-type "PopplerAnnotCalloutLine*") +) + +(define-method free + (of-object "PopplerAnnotCalloutLine") + (c-name "poppler_annot_callout_line_free") + (return-type "none") +) + + + +;; From poppler-attachment.h + +(define-function poppler_attachment_get_type + (c-name "poppler_attachment_get_type") + (return-type "GType") +) + +(define-method save + (of-object "PopplerAttachment") + (c-name "poppler_attachment_save") + (return-type "gboolean") + (parameters + '("const-char*" "filename") + '("GError**" "error") + ) +) + +(define-method save_to_callback + (of-object "PopplerAttachment") + (c-name "poppler_attachment_save_to_callback") + (return-type "gboolean") + (parameters + '("PopplerAttachmentSaveFunc" "save_func") + '("gpointer" "user_data") + '("GError**" "error") + ) +) + + + +;; From poppler-date.h + +(define-function poppler_date_parse + (c-name "poppler_date_parse") + (return-type "gboolean") + (parameters + '("const-gchar*" "date") + '("time_t*" "timet") + ) +) + + + +;; From poppler-document.h + +(define-function poppler_document_get_type + (c-name "poppler_document_get_type") + (return-type "GType") +) + +(define-function poppler_document_new_from_file + (c-name "poppler_document_new_from_file") + (return-type "PopplerDocument*") + (parameters + '("const-char*" "uri") + '("const-char*" "password") + '("GError**" "error") + ) +) + +(define-function poppler_document_new_from_data + (c-name "poppler_document_new_from_data") + (return-type "PopplerDocument*") + (parameters + '("char*" "data") + '("int" "length") + '("const-char*" "password") + '("GError**" "error") + ) +) + +(define-method save + (of-object "PopplerDocument") + (c-name "poppler_document_save") + (return-type "gboolean") + (parameters + '("const-char*" "uri") + '("GError**" "error") + ) +) + +(define-method save_a_copy + (of-object "PopplerDocument") + (c-name "poppler_document_save_a_copy") + (return-type "gboolean") + (parameters + '("const-char*" "uri") + '("GError**" "error") + ) +) + +(define-method get_id + (of-object "PopplerDocument") + (c-name "poppler_document_get_id") + (return-type "gboolean") + (parameters + '("gchar**" "permanent_id") + '("gchar**" "update_id") + ) +) + +(define-method get_n_pages + (of-object "PopplerDocument") + (c-name "poppler_document_get_n_pages") + (return-type "int") +) + +(define-method get_page + (of-object "PopplerDocument") + (c-name "poppler_document_get_page") + (return-type "PopplerPage*") + (parameters + '("int" "index") + ) +) + +(define-method get_page_by_label + (of-object "PopplerDocument") + (c-name "poppler_document_get_page_by_label") + (return-type "PopplerPage*") + (parameters + '("const-char*" "label") + ) +) + +(define-method get_pdf_version_string + (of-object "PopplerDocument") + (c-name "poppler_document_get_pdf_version_string") + (return-type "gchar*") +) + +(define-method get_pdf_version + (of-object "PopplerDocument") + (c-name "poppler_document_get_pdf_version") + (return-type "none") + (parameters + '("guint*" "major_version") + '("guint*" "minor_version") + ) +) + +(define-method get_title + (of-object "PopplerDocument") + (c-name "poppler_document_get_title") + (return-type "gchar*") +) + +(define-method get_author + (of-object "PopplerDocument") + (c-name "poppler_document_get_author") + (return-type "gchar*") +) + +(define-method get_subject + (of-object "PopplerDocument") + (c-name "poppler_document_get_subject") + (return-type "gchar*") +) + +(define-method get_keywords + (of-object "PopplerDocument") + (c-name "poppler_document_get_keywords") + (return-type "gchar*") +) + +(define-method get_creator + (of-object "PopplerDocument") + (c-name "poppler_document_get_creator") + (return-type "gchar*") +) + +(define-method get_producer + (of-object "PopplerDocument") + (c-name "poppler_document_get_producer") + (return-type "gchar*") +) + +(define-method get_creation_date + (of-object "PopplerDocument") + (c-name "poppler_document_get_creation_date") + (return-type "time_t") +) + +(define-method get_modification_date + (of-object "PopplerDocument") + (c-name "poppler_document_get_modification_date") + (return-type "time_t") +) + +(define-method is_linearized + (of-object "PopplerDocument") + (c-name "poppler_document_is_linearized") + (return-type "gboolean") +) + +(define-method get_page_layout + (of-object "PopplerDocument") + (c-name "poppler_document_get_page_layout") + (return-type "PopplerPageLayout") +) + +(define-method get_page_mode + (of-object "PopplerDocument") + (c-name "poppler_document_get_page_mode") + (return-type "PopplerPageMode") +) + +(define-method get_permissions + (of-object "PopplerDocument") + (c-name "poppler_document_get_permissions") + (return-type "PopplerPermissions") +) + +(define-method get_metadata + (of-object "PopplerDocument") + (c-name "poppler_document_get_metadata") + (return-type "gchar*") +) + +(define-method get_n_attachments + (of-object "PopplerDocument") + (c-name "poppler_document_get_n_attachments") + (return-type "guint") +) + +(define-method has_attachments + (of-object "PopplerDocument") + (c-name "poppler_document_has_attachments") + (return-type "gboolean") +) + +(define-method get_attachments + (of-object "PopplerDocument") + (c-name "poppler_document_get_attachments") + (return-type "GList*") +) + +(define-method find_dest + (of-object "PopplerDocument") + (c-name "poppler_document_find_dest") + (return-type "PopplerDest*") + (parameters + '("const-gchar*" "link_name") + ) +) + +(define-method get_form_field + (of-object "PopplerDocument") + (c-name "poppler_document_get_form_field") + (return-type "PopplerFormField*") + (parameters + '("gint" "id") + ) +) + +(define-function poppler_index_iter_get_type + (c-name "poppler_index_iter_get_type") + (return-type "GType") +) + +(define-function poppler_index_iter_new + (c-name "poppler_index_iter_new") + (is-constructor-of "PopplerIndexIter") + (return-type "PopplerIndexIter*") + (parameters + '("PopplerDocument*" "document") + ) +) + +(define-method copy + (of-object "PopplerIndexIter") + (c-name "poppler_index_iter_copy") + (return-type "PopplerIndexIter*") +) + +(define-method free + (of-object "PopplerIndexIter") + (c-name "poppler_index_iter_free") + (return-type "none") +) + +(define-method get_child + (of-object "PopplerIndexIter") + (c-name "poppler_index_iter_get_child") + (return-type "PopplerIndexIter*") +) + +(define-method is_open + (of-object "PopplerIndexIter") + (c-name "poppler_index_iter_is_open") + (return-type "gboolean") +) + +(define-method get_action + (of-object "PopplerIndexIter") + (c-name "poppler_index_iter_get_action") + (return-type "PopplerAction*") +) + +(define-method next + (of-object "PopplerIndexIter") + (c-name "poppler_index_iter_next") + (return-type "gboolean") +) + +(define-function poppler_font_info_get_type + (c-name "poppler_font_info_get_type") + (return-type "GType") +) + +(define-function poppler_font_info_new + (c-name "poppler_font_info_new") + (is-constructor-of "PopplerFontInfo") + (return-type "PopplerFontInfo*") + (parameters + '("PopplerDocument*" "document") + ) +) + +(define-method scan + (of-object "PopplerFontInfo") + (c-name "poppler_font_info_scan") + (return-type "gboolean") + (parameters + '("int" "n_pages") + '("PopplerFontsIter**" "iter") + ) +) + +(define-method free + (of-object "PopplerFontInfo") + (c-name "poppler_font_info_free") + (return-type "none") +) + +(define-function poppler_fonts_iter_get_type + (c-name "poppler_fonts_iter_get_type") + (return-type "GType") +) + +(define-method copy + (of-object "PopplerFontsIter") + (c-name "poppler_fonts_iter_copy") + (return-type "PopplerFontsIter*") +) + +(define-method free + (of-object "PopplerFontsIter") + (c-name "poppler_fonts_iter_free") + (return-type "none") +) + +(define-method get_name + (of-object "PopplerFontsIter") + (c-name "poppler_fonts_iter_get_name") + (return-type "const-char*") +) + +(define-method get_full_name + (of-object "PopplerFontsIter") + (c-name "poppler_fonts_iter_get_full_name") + (return-type "const-char*") +) + +(define-method get_substitute_name + (of-object "PopplerFontsIter") + (c-name "poppler_fonts_iter_get_substitute_name") + (return-type "const-char*") +) + +(define-method get_file_name + (of-object "PopplerFontsIter") + (c-name "poppler_fonts_iter_get_file_name") + (return-type "const-char*") +) + +(define-method get_font_type + (of-object "PopplerFontsIter") + (c-name "poppler_fonts_iter_get_font_type") + (return-type "PopplerFontType") +) + +(define-method get_encoding + (of-object "PopplerFontsIter") + (c-name "poppler_fonts_iter_get_encoding") + (return-type "const-char*") +) + +(define-method is_embedded + (of-object "PopplerFontsIter") + (c-name "poppler_fonts_iter_is_embedded") + (return-type "gboolean") +) + +(define-method is_subset + (of-object "PopplerFontsIter") + (c-name "poppler_fonts_iter_is_subset") + (return-type "gboolean") +) + +(define-method next + (of-object "PopplerFontsIter") + (c-name "poppler_fonts_iter_next") + (return-type "gboolean") +) + +(define-function poppler_layers_iter_get_type + (c-name "poppler_layers_iter_get_type") + (return-type "GType") +) + +(define-function poppler_layers_iter_new + (c-name "poppler_layers_iter_new") + (is-constructor-of "PopplerLayersIter") + (return-type "PopplerLayersIter*") + (parameters + '("PopplerDocument*" "document") + ) +) + +(define-method copy + (of-object "PopplerLayersIter") + (c-name "poppler_layers_iter_copy") + (return-type "PopplerLayersIter*") +) + +(define-method free + (of-object "PopplerLayersIter") + (c-name "poppler_layers_iter_free") + (return-type "none") +) + +(define-method get_child + (of-object "PopplerLayersIter") + (c-name "poppler_layers_iter_get_child") + (return-type "PopplerLayersIter*") +) + +(define-method get_title + (of-object "PopplerLayersIter") + (c-name "poppler_layers_iter_get_title") + (return-type "gchar*") +) + +(define-method get_layer + (of-object "PopplerLayersIter") + (c-name "poppler_layers_iter_get_layer") + (return-type "PopplerLayer*") +) + +(define-method next + (of-object "PopplerLayersIter") + (c-name "poppler_layers_iter_next") + (return-type "gboolean") +) + +(define-function poppler_ps_file_get_type + (c-name "poppler_ps_file_get_type") + (return-type "GType") +) + +(define-function poppler_ps_file_new + (c-name "poppler_ps_file_new") + (is-constructor-of "PopplerPsFile") + (return-type "PopplerPSFile*") + (parameters + '("PopplerDocument*" "document") + '("const-char*" "filename") + '("int" "first_page") + '("int" "n_pages") + ) +) + +(define-method set_paper_size + (of-object "PopplerPSFile") + (c-name "poppler_ps_file_set_paper_size") + (return-type "none") + (parameters + '("double" "width") + '("double" "height") + ) +) + +(define-method set_duplex + (of-object "PopplerPSFile") + (c-name "poppler_ps_file_set_duplex") + (return-type "none") + (parameters + '("gboolean" "duplex") + ) +) + +(define-method free + (of-object "PopplerPSFile") + (c-name "poppler_ps_file_free") + (return-type "none") +) + + + +;; From poppler-enums.h + +(define-function poppler_action_type_get_type + (c-name "poppler_action_type_get_type") + (return-type "GType") +) + +(define-function poppler_dest_type_get_type + (c-name "poppler_dest_type_get_type") + (return-type "GType") +) + +(define-function poppler_action_movie_operation_get_type + (c-name "poppler_action_movie_operation_get_type") + (return-type "GType") +) + +(define-function poppler_action_layer_action_get_type + (c-name "poppler_action_layer_action_get_type") + (return-type "GType") +) + +(define-function poppler_page_layout_get_type + (c-name "poppler_page_layout_get_type") + (return-type "GType") +) + +(define-function poppler_page_mode_get_type + (c-name "poppler_page_mode_get_type") + (return-type "GType") +) + +(define-function poppler_font_type_get_type + (c-name "poppler_font_type_get_type") + (return-type "GType") +) + +(define-function poppler_viewer_preferences_get_type + (c-name "poppler_viewer_preferences_get_type") + (return-type "GType") +) + +(define-function poppler_permissions_get_type + (c-name "poppler_permissions_get_type") + (return-type "GType") +) + +(define-function poppler_form_field_type_get_type + (c-name "poppler_form_field_type_get_type") + (return-type "GType") +) + +(define-function poppler_form_button_type_get_type + (c-name "poppler_form_button_type_get_type") + (return-type "GType") +) + +(define-function poppler_form_text_type_get_type + (c-name "poppler_form_text_type_get_type") + (return-type "GType") +) + +(define-function poppler_form_choice_type_get_type + (c-name "poppler_form_choice_type_get_type") + (return-type "GType") +) + +(define-function poppler_annot_type_get_type + (c-name "poppler_annot_type_get_type") + (return-type "GType") +) + +(define-function poppler_annot_flag_get_type + (c-name "poppler_annot_flag_get_type") + (return-type "GType") +) + +(define-function poppler_annot_markup_reply_type_get_type + (c-name "poppler_annot_markup_reply_type_get_type") + (return-type "GType") +) + +(define-function poppler_annot_external_data_type_get_type + (c-name "poppler_annot_external_data_type_get_type") + (return-type "GType") +) + +(define-function poppler_annot_text_state_get_type + (c-name "poppler_annot_text_state_get_type") + (return-type "GType") +) + +(define-function poppler_annot_free_text_quadding_get_type + (c-name "poppler_annot_free_text_quadding_get_type") + (return-type "GType") +) + +(define-function poppler_error_get_type + (c-name "poppler_error_get_type") + (return-type "GType") +) + +(define-function poppler_orientation_get_type + (c-name "poppler_orientation_get_type") + (return-type "GType") +) + +(define-function poppler_page_transition_type_get_type + (c-name "poppler_page_transition_type_get_type") + (return-type "GType") +) + +(define-function poppler_page_transition_alignment_get_type + (c-name "poppler_page_transition_alignment_get_type") + (return-type "GType") +) + +(define-function poppler_page_transition_direction_get_type + (c-name "poppler_page_transition_direction_get_type") + (return-type "GType") +) + +(define-function poppler_selection_style_get_type + (c-name "poppler_selection_style_get_type") + (return-type "GType") +) + +(define-function poppler_print_flags_get_type + (c-name "poppler_print_flags_get_type") + (return-type "GType") +) + +(define-function poppler_backend_get_type + (c-name "poppler_backend_get_type") + (return-type "GType") +) + + + +;; From poppler-features.h + + + +;; From poppler-form-field.h + +(define-function poppler_form_field_get_type + (c-name "poppler_form_field_get_type") + (return-type "GType") +) + +(define-method get_field_type + (of-object "PopplerFormField") + (c-name "poppler_form_field_get_field_type") + (return-type "PopplerFormFieldType") +) + +(define-method get_id + (of-object "PopplerFormField") + (c-name "poppler_form_field_get_id") + (return-type "gint") +) + +(define-method get_font_size + (of-object "PopplerFormField") + (c-name "poppler_form_field_get_font_size") + (return-type "gdouble") +) + +(define-method is_read_only + (of-object "PopplerFormField") + (c-name "poppler_form_field_is_read_only") + (return-type "gboolean") +) + +(define-method get_partial_name + (of-object "PopplerFormField") + (c-name "poppler_form_field_get_partial_name") + (return-type "gchar*") +) + +(define-method get_mapping_name + (of-object "PopplerFormField") + (c-name "poppler_form_field_get_mapping_name") + (return-type "gchar*") +) + +(define-method get_name + (of-object "PopplerFormField") + (c-name "poppler_form_field_get_name") + (return-type "gchar*") +) + +(define-method get_action + (of-object "PopplerFormField") + (c-name "poppler_form_field_get_action") + (return-type "PopplerAction*") +) + +(define-method button_get_button_type + (of-object "PopplerFormField") + (c-name "poppler_form_field_button_get_button_type") + (return-type "PopplerFormButtonType") +) + +(define-method button_get_state + (of-object "PopplerFormField") + (c-name "poppler_form_field_button_get_state") + (return-type "gboolean") +) + +(define-method button_set_state + (of-object "PopplerFormField") + (c-name "poppler_form_field_button_set_state") + (return-type "none") + (parameters + '("gboolean" "state") + ) +) + +(define-method text_get_text_type + (of-object "PopplerFormField") + (c-name "poppler_form_field_text_get_text_type") + (return-type "PopplerFormTextType") +) + +(define-method text_get_text + (of-object "PopplerFormField") + (c-name "poppler_form_field_text_get_text") + (return-type "gchar*") +) + +(define-method text_set_text + (of-object "PopplerFormField") + (c-name "poppler_form_field_text_set_text") + (return-type "none") + (parameters + '("const-gchar*" "text") + ) +) + +(define-method text_get_max_len + (of-object "PopplerFormField") + (c-name "poppler_form_field_text_get_max_len") + (return-type "gint") +) + +(define-method text_do_spell_check + (of-object "PopplerFormField") + (c-name "poppler_form_field_text_do_spell_check") + (return-type "gboolean") +) + +(define-method text_do_scroll + (of-object "PopplerFormField") + (c-name "poppler_form_field_text_do_scroll") + (return-type "gboolean") +) + +(define-method text_is_rich_text + (of-object "PopplerFormField") + (c-name "poppler_form_field_text_is_rich_text") + (return-type "gboolean") +) + +(define-method text_is_password + (of-object "PopplerFormField") + (c-name "poppler_form_field_text_is_password") + (return-type "gboolean") +) + +(define-method choice_get_choice_type + (of-object "PopplerFormField") + (c-name "poppler_form_field_choice_get_choice_type") + (return-type "PopplerFormChoiceType") +) + +(define-method choice_is_editable + (of-object "PopplerFormField") + (c-name "poppler_form_field_choice_is_editable") + (return-type "gboolean") +) + +(define-method choice_can_select_multiple + (of-object "PopplerFormField") + (c-name "poppler_form_field_choice_can_select_multiple") + (return-type "gboolean") +) + +(define-method choice_do_spell_check + (of-object "PopplerFormField") + (c-name "poppler_form_field_choice_do_spell_check") + (return-type "gboolean") +) + +(define-method choice_commit_on_change + (of-object "PopplerFormField") + (c-name "poppler_form_field_choice_commit_on_change") + (return-type "gboolean") +) + +(define-method choice_get_n_items + (of-object "PopplerFormField") + (c-name "poppler_form_field_choice_get_n_items") + (return-type "gint") +) + +(define-method choice_get_item + (of-object "PopplerFormField") + (c-name "poppler_form_field_choice_get_item") + (return-type "gchar*") + (parameters + '("gint" "index") + ) +) + +(define-method choice_is_item_selected + (of-object "PopplerFormField") + (c-name "poppler_form_field_choice_is_item_selected") + (return-type "gboolean") + (parameters + '("gint" "index") + ) +) + +(define-method choice_select_item + (of-object "PopplerFormField") + (c-name "poppler_form_field_choice_select_item") + (return-type "none") + (parameters + '("gint" "index") + ) +) + +(define-method choice_unselect_all + (of-object "PopplerFormField") + (c-name "poppler_form_field_choice_unselect_all") + (return-type "none") +) + +(define-method choice_toggle_item + (of-object "PopplerFormField") + (c-name "poppler_form_field_choice_toggle_item") + (return-type "none") + (parameters + '("gint" "index") + ) +) + +(define-method choice_set_text + (of-object "PopplerFormField") + (c-name "poppler_form_field_choice_set_text") + (return-type "none") + (parameters + '("const-gchar*" "text") + ) +) + +(define-method choice_get_text + (of-object "PopplerFormField") + (c-name "poppler_form_field_choice_get_text") + (return-type "gchar*") +) + + + +;; From poppler.h + +(define-function poppler_error_quark + (c-name "poppler_error_quark") + (return-type "GQuark") +) + +(define-function poppler_get_backend + (c-name "poppler_get_backend") + (return-type "PopplerBackend") +) + +(define-function poppler_get_version + (c-name "poppler_get_version") + (return-type "const-char*") +) + + + +;; From poppler-layer.h + +(define-function poppler_layer_get_type + (c-name "poppler_layer_get_type") + (return-type "GType") +) + +(define-method get_title + (of-object "PopplerLayer") + (c-name "poppler_layer_get_title") + (return-type "const-gchar*") +) + +(define-method is_visible + (of-object "PopplerLayer") + (c-name "poppler_layer_is_visible") + (return-type "gboolean") +) + +(define-method show + (of-object "PopplerLayer") + (c-name "poppler_layer_show") + (return-type "none") +) + +(define-method hide + (of-object "PopplerLayer") + (c-name "poppler_layer_hide") + (return-type "none") +) + +(define-method is_parent + (of-object "PopplerLayer") + (c-name "poppler_layer_is_parent") + (return-type "gboolean") +) + +(define-method get_radio_button_group_id + (of-object "PopplerLayer") + (c-name "poppler_layer_get_radio_button_group_id") + (return-type "gint") +) + + + +;; From poppler-media.h + +(define-method is_embedded + (of-object "PopplerMedia") + (c-name "poppler_media_is_embedded") + (return-type "gboolean") +) + +(define-method get_filename + (of-object "PopplerMedia") + (c-name "poppler_media_get_filename") + (return-type "const-gchar*") +) + +(define-method get_mime_type + (of-object "PopplerMedia") + (c-name "poppler_media_get_mime_type") + (return-type "const-gchar*") +) + +(define-method save + (of-object "PopplerMedia") + (c-name "poppler_media_save") + (return-type "gboolean") + (parameters + '("const-char*" "filename") + '("GError**" "error") + ) +) + +(define-method save_to_callback + (of-object "PopplerMedia") + (c-name "poppler_media_save_to_callback") + (return-type "gboolean") + (parameters + '("PopplerMediaSaveFunc" "save_func") + '("gpointer" "user_data") + '("GError**" "error") + ) +) + + + +;; From poppler-movie.h + +(define-function poppler_movie_get_type + (c-name "poppler_movie_get_type") + (return-type "GType") +) + +(define-method get_filename + (of-object "PopplerMovie") + (c-name "poppler_movie_get_filename") + (return-type "const-gchar*") +) + +(define-method need_poster + (of-object "PopplerMovie") + (c-name "poppler_movie_need_poster") + (return-type "gboolean") +) + +(define-method show_controls + (of-object "PopplerMovie") + (c-name "poppler_movie_show_controls") + (return-type "gboolean") +) + + + +;; From poppler-page.h + +(define-function poppler_page_get_type + (c-name "poppler_page_get_type") + (return-type "GType") +) + +(define-method render + (of-object "PopplerPage") + (c-name "poppler_page_render") + (return-type "none") + (parameters + '("cairo_t*" "cairo") + ) +) + +(define-method render_for_printing + (of-object "PopplerPage") + (c-name "poppler_page_render_for_printing") + (return-type "none") + (parameters + '("cairo_t*" "cairo") + ) +) + +(define-method render_for_printing_with_options + (of-object "PopplerPage") + (c-name "poppler_page_render_for_printing_with_options") + (return-type "none") + (parameters + '("cairo_t*" "cairo") + '("PopplerPrintFlags" "options") + ) +) + +(define-method get_thumbnail + (of-object "PopplerPage") + (c-name "poppler_page_get_thumbnail") + (return-type "cairo_surface_t*") +) + +(define-method render_selection + (of-object "PopplerPage") + (c-name "poppler_page_render_selection") + (return-type "none") + (parameters + '("cairo_t*" "cairo") + '("PopplerRectangle*" "selection") + '("PopplerRectangle*" "old_selection") + '("PopplerSelectionStyle" "style") + '("PopplerColor*" "glyph_color") + '("PopplerColor*" "background_color") + ) +) + +(define-method get_size + (of-object "PopplerPage") + (c-name "poppler_page_get_size") + (return-type "none") + (parameters + '("double*" "width") + '("double*" "height") + ) +) + +(define-method get_index + (of-object "PopplerPage") + (c-name "poppler_page_get_index") + (return-type "int") +) + +(define-method get_label + (of-object "PopplerPage") + (c-name "poppler_page_get_label") + (return-type "gchar*") +) + +(define-method get_duration + (of-object "PopplerPage") + (c-name "poppler_page_get_duration") + (return-type "double") +) + +(define-method get_transition + (of-object "PopplerPage") + (c-name "poppler_page_get_transition") + (return-type "PopplerPageTransition*") +) + +(define-method get_thumbnail_size + (of-object "PopplerPage") + (c-name "poppler_page_get_thumbnail_size") + (return-type "gboolean") + (parameters + '("int*" "width") + '("int*" "height") + ) +) + +(define-method find_text + (of-object "PopplerPage") + (c-name "poppler_page_find_text") + (return-type "GList*") + (parameters + '("const-char*" "text") + ) +) + +(define-method render_to_ps + (of-object "PopplerPage") + (c-name "poppler_page_render_to_ps") + (return-type "none") + (parameters + '("PopplerPSFile*" "ps_file") + ) +) + +(define-method get_text + (of-object "PopplerPage") + (c-name "poppler_page_get_text") + (return-type "char*") +) + +(define-method get_selected_text + (of-object "PopplerPage") + (c-name "poppler_page_get_selected_text") + (return-type "char*") + (parameters + '("PopplerSelectionStyle" "style") + '("PopplerRectangle*" "selection") + ) +) + +(define-method get_selected_region + (of-object "PopplerPage") + (c-name "poppler_page_get_selected_region") + (return-type "cairo_region_t*") + (parameters + '("gdouble" "scale") + '("PopplerSelectionStyle" "style") + '("PopplerRectangle*" "selection") + ) +) + +(define-method get_selection_region + (of-object "PopplerPage") + (c-name "poppler_page_get_selection_region") + (return-type "GList*") + (parameters + '("gdouble" "scale") + '("PopplerSelectionStyle" "style") + '("PopplerRectangle*" "selection") + ) +) + +(define-function poppler_page_selection_region_free + (c-name "poppler_page_selection_region_free") + (return-type "none") + (parameters + '("GList*" "region") + ) +) + +(define-method get_link_mapping + (of-object "PopplerPage") + (c-name "poppler_page_get_link_mapping") + (return-type "GList*") +) + +(define-function poppler_page_free_link_mapping + (c-name "poppler_page_free_link_mapping") + (return-type "none") + (parameters + '("GList*" "list") + ) +) + +(define-method get_image_mapping + (of-object "PopplerPage") + (c-name "poppler_page_get_image_mapping") + (return-type "GList*") +) + +(define-function poppler_page_free_image_mapping + (c-name "poppler_page_free_image_mapping") + (return-type "none") + (parameters + '("GList*" "list") + ) +) + +(define-method get_image + (of-object "PopplerPage") + (c-name "poppler_page_get_image") + (return-type "cairo_surface_t*") + (parameters + '("gint" "image_id") + ) +) + +(define-method get_form_field_mapping + (of-object "PopplerPage") + (c-name "poppler_page_get_form_field_mapping") + (return-type "GList*") +) + +(define-function poppler_page_free_form_field_mapping + (c-name "poppler_page_free_form_field_mapping") + (return-type "none") + (parameters + '("GList*" "list") + ) +) + +(define-method get_annot_mapping + (of-object "PopplerPage") + (c-name "poppler_page_get_annot_mapping") + (return-type "GList*") +) + +(define-function poppler_page_free_annot_mapping + (c-name "poppler_page_free_annot_mapping") + (return-type "none") + (parameters + '("GList*" "list") + ) +) + +(define-method add_annot + (of-object "PopplerPage") + (c-name "poppler_page_add_annot") + (return-type "none") + (parameters + '("PopplerAnnot*" "annot") + ) +) + +(define-method get_crop_box + (of-object "PopplerPage") + (c-name "poppler_page_get_crop_box") + (return-type "none") + (parameters + '("PopplerRectangle*" "rect") + ) +) + +(define-method get_text_layout + (of-object "PopplerPage") + (c-name "poppler_page_get_text_layout") + (return-type "gboolean") + (parameters + '("PopplerRectangle**" "rectangles") + '("guint*" "n_rectangles") + ) +) + +(define-method get_text_attributes + (of-object "PopplerPage") + (c-name "poppler_page_get_text_attributes") + (return-type "GList*") +) + +(define-function poppler_page_free_text_attributes + (c-name "poppler_page_free_text_attributes") + (return-type "none") + (parameters + '("GList*" "list") + ) +) + +(define-function poppler_rectangle_get_type + (c-name "poppler_rectangle_get_type") + (return-type "GType") +) + +(define-function poppler_rectangle_new + (c-name "poppler_rectangle_new") + (is-constructor-of "PopplerRectangle") + (return-type "PopplerRectangle*") +) + +(define-method copy + (of-object "PopplerRectangle") + (c-name "poppler_rectangle_copy") + (return-type "PopplerRectangle*") +) + +(define-method free + (of-object "PopplerRectangle") + (c-name "poppler_rectangle_free") + (return-type "none") +) + +(define-function poppler_color_get_type + (c-name "poppler_color_get_type") + (return-type "GType") +) + +(define-function poppler_color_new + (c-name "poppler_color_new") + (is-constructor-of "PopplerColor") + (return-type "PopplerColor*") +) + +(define-method copy + (of-object "PopplerColor") + (c-name "poppler_color_copy") + (return-type "PopplerColor*") +) + +(define-method free + (of-object "PopplerColor") + (c-name "poppler_color_free") + (return-type "none") +) + +(define-function poppler_text_attributes_get_type + (c-name "poppler_text_attributes_get_type") + (return-type "GType") +) + +(define-function poppler_text_attributes_new + (c-name "poppler_text_attributes_new") + (is-constructor-of "PopplerTextAttributes") + (return-type "PopplerTextAttributes*") +) + +(define-method copy + (of-object "PopplerTextAttributes") + (c-name "poppler_text_attributes_copy") + (return-type "PopplerTextAttributes*") +) + +(define-method free + (of-object "PopplerTextAttributes") + (c-name "poppler_text_attributes_free") + (return-type "none") +) + +(define-function poppler_link_mapping_get_type + (c-name "poppler_link_mapping_get_type") + (return-type "GType") +) + +(define-function poppler_link_mapping_new + (c-name "poppler_link_mapping_new") + (is-constructor-of "PopplerLinkMapping") + (return-type "PopplerLinkMapping*") +) + +(define-method copy + (of-object "PopplerLinkMapping") + (c-name "poppler_link_mapping_copy") + (return-type "PopplerLinkMapping*") +) + +(define-method free + (of-object "PopplerLinkMapping") + (c-name "poppler_link_mapping_free") + (return-type "none") +) + +(define-function poppler_page_transition_get_type + (c-name "poppler_page_transition_get_type") + (return-type "GType") +) + +(define-function poppler_page_transition_new + (c-name "poppler_page_transition_new") + (is-constructor-of "PopplerPageTransition") + (return-type "PopplerPageTransition*") +) + +(define-method copy + (of-object "PopplerPageTransition") + (c-name "poppler_page_transition_copy") + (return-type "PopplerPageTransition*") +) + +(define-method free + (of-object "PopplerPageTransition") + (c-name "poppler_page_transition_free") + (return-type "none") +) + +(define-function poppler_image_mapping_get_type + (c-name "poppler_image_mapping_get_type") + (return-type "GType") +) + +(define-function poppler_image_mapping_new + (c-name "poppler_image_mapping_new") + (is-constructor-of "PopplerImageMapping") + (return-type "PopplerImageMapping*") +) + +(define-method copy + (of-object "PopplerImageMapping") + (c-name "poppler_image_mapping_copy") + (return-type "PopplerImageMapping*") +) + +(define-method free + (of-object "PopplerImageMapping") + (c-name "poppler_image_mapping_free") + (return-type "none") +) + +(define-function poppler_form_field_mapping_get_type + (c-name "poppler_form_field_mapping_get_type") + (return-type "GType") +) + +(define-function poppler_form_field_mapping_new + (c-name "poppler_form_field_mapping_new") + (is-constructor-of "PopplerFormFieldMapping") + (return-type "PopplerFormFieldMapping*") +) + +(define-method copy + (of-object "PopplerFormFieldMapping") + (c-name "poppler_form_field_mapping_copy") + (return-type "PopplerFormFieldMapping*") +) + +(define-method free + (of-object "PopplerFormFieldMapping") + (c-name "poppler_form_field_mapping_free") + (return-type "none") +) + +(define-function poppler_annot_mapping_get_type + (c-name "poppler_annot_mapping_get_type") + (return-type "GType") +) + +(define-function poppler_annot_mapping_new + (c-name "poppler_annot_mapping_new") + (is-constructor-of "PopplerAnnotMapping") + (return-type "PopplerAnnotMapping*") +) + +(define-method copy + (of-object "PopplerAnnotMapping") + (c-name "poppler_annot_mapping_copy") + (return-type "PopplerAnnotMapping*") +) + +(define-method free + (of-object "PopplerAnnotMapping") + (c-name "poppler_annot_mapping_free") + (return-type "none") +) + + diff --git a/poppler-glib/src/ps_file.ccg b/poppler-glib/src/ps_file.ccg new file mode 100644 index 0000000..1b22934 --- /dev/null +++ b/poppler-glib/src/ps_file.ccg @@ -0,0 +1,22 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +} // namespace Poppler diff --git a/poppler-glib/src/ps_file.hg b/poppler-glib/src/ps_file.hg new file mode 100644 index 0000000..855afca --- /dev/null +++ b/poppler-glib/src/ps_file.hg @@ -0,0 +1,42 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +_PINCLUDE(glibmm/private/object_p.h) +_CC_INCLUDE(poppler.h) + +namespace Poppler +{ + +/** Poppler::PSFile is used to convert a pdf file to ps + */ +class PSFile : public Glib::Object +{ + _CLASS_GOBJECT(PSFile, PopplerPSFile, POPPLER_PS_FILE, Glib::Object, GObject) + + protected: + _CTOR_DEFAULT + + public: + _WRAP_METHOD(void set_paper_size(double width, double height) const, poppler_ps_file_set_paper_size) + _WRAP_METHOD(void set_duplex(bool duplex) const, poppler_ps_file_set_duplex) + + _IGNORE(poppler_ps_file_free) +}; + +} // namespace Poppler diff --git a/poppler-glib/src/rectangle.ccg b/poppler-glib/src/rectangle.ccg new file mode 100644 index 0000000..09fd9ed --- /dev/null +++ b/poppler-glib/src/rectangle.ccg @@ -0,0 +1,34 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +Rectangle::Rectangle(double x1, double y1, double x2, double y2) +: + gobject_ (poppler_rectangle_new()) +{ + gobj()->x1 = x1; + gobj()->y1 = y1; + gobj()->x2 = x2; + gobj()->y2 = y2; +} + +void RectangleTraits::release_c_type(CType item) { poppler_rectangle_free(item); } + +} // namespace Poppler diff --git a/poppler-glib/src/rectangle.hg b/poppler-glib/src/rectangle.hg new file mode 100644 index 0000000..3df9024 --- /dev/null +++ b/poppler-glib/src/rectangle.hg @@ -0,0 +1,61 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +_CC_INCLUDE(poppler.h) + +namespace Poppler +{ + +/** Poppler::Rectangle is a structure holding the lower left and upper right + * vertices of a rectangle. + */ +class Rectangle +{ + _CLASS_BOXEDTYPE(Rectangle, PopplerRectangle, poppler_rectangle_new, poppler_rectangle_copy, poppler_rectangle_free) + +public: + + /** Creates a new rectangle instance with lower left corner (x1,y1) and + * upper right corner (x2,y2) + */ + Rectangle(double x1, double y1, double x2, double y2); + + _MEMBER_GET(x1, x1, double, double) + _MEMBER_GET(y1, y1, double, double) + _MEMBER_GET(x2, x2, double, double) + _MEMBER_GET(y2, y2, double, double) + _MEMBER_SET(x1, x1, double, double) + _MEMBER_SET(y1, y1, double, double) + _MEMBER_SET(x2, x2, double, double) + _MEMBER_SET(y2, y2, double, double) +}; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +struct RectangleTraits +{ + typedef Rectangle CppType; + typedef PopplerRectangle* CType; + typedef PopplerRectangle* CTypeNonConst; + + static CppType to_cpp_type(CType item) { return Rectangle(item); } + static void release_c_type(CType item); +}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Poppler diff --git a/poppler-glib/src/text_attributes.ccg b/poppler-glib/src/text_attributes.ccg new file mode 100644 index 0000000..bb97425 --- /dev/null +++ b/poppler-glib/src/text_attributes.ccg @@ -0,0 +1,24 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + +void TextAttributesTraits::release_c_type(CType item) { poppler_text_attributes_free(item); } + +} // namespace Poppler diff --git a/poppler-glib/src/text_attributes.hg b/poppler-glib/src/text_attributes.hg new file mode 100644 index 0000000..df17c0a --- /dev/null +++ b/poppler-glib/src/text_attributes.hg @@ -0,0 +1,54 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +#include<poppler-glibmm/color.h> +_CC_INCLUDE(poppler-page.h) + +namespace Poppler +{ + +/** A Poppler::TextAttributes is used to describe text attributes of a range + * of text. + */ +class TextAttributes +{ + _CLASS_BOXEDTYPE(TextAttributes, PopplerTextAttributes, poppler_text_attributes_new, poppler_text_attributes_copy, poppler_text_attributes_free) + +public: + _MEMBER_GET(font_name, font_name, Glib::ustring, gchar*) + _MEMBER_GET(font_size, font_size, double, double) + _MEMBER_GET(is_underlined, is_underlined, bool, gboolean) + _MEMBER_GET(color, color, Color, PopplerColor) + _MEMBER_GET(start_index, start_index, int, gint) + _MEMBER_GET(end_index, end_index, int, gint) +}; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +struct TextAttributesTraits +{ + typedef TextAttributes CppType; + typedef PopplerTextAttributes* CType; + typedef PopplerTextAttributes* CTypeNonConst; + + static CppType to_cpp_type(CType item) { return TextAttributes(item); } + static void release_c_type(CType item); +}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Poppler diff --git a/poppler-glib/src/utility.ccg b/poppler-glib/src/utility.ccg new file mode 100644 index 0000000..292df6e --- /dev/null +++ b/poppler-glib/src/utility.ccg @@ -0,0 +1,37 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poppler +{ + + bool date_parse(const Glib::ustring& date, time_t* timet) + { + return poppler_date_parse(date.c_str(), timet); + } + + Backend get_backend() + { + return (Backend)poppler_get_backend(); + } + + Glib::ustring get_version() + { + return Glib::convert_const_gchar_ptr_to_ustring(poppler_get_version()); + } + +} // namespace Poppler diff --git a/poppler-glib/src/utility.hg b/poppler-glib/src/utility.hg new file mode 100644 index 0000000..5534041 --- /dev/null +++ b/poppler-glib/src/utility.hg @@ -0,0 +1,52 @@ +/* Copyright (c) 2010 Glenn Rice <glennricster@gmail.com> + * + * This file is part of poppler-glibmm. + * + * poppler-glibmm is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 2.1 of the License, + * or (at your option) any later version. + * + * poppler-glibmm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +_DEFS(poppler-glibmm,poppler-glib) +_CC_INCLUDE(poppler-date.h) + +namespace Poppler +{ + _WRAP_ENUM(Backend, PopplerBackend) + + /** @defgroup PopplerUtility Poppler Utility Functions + * Poppler Utility Functions + * @{ + */ + + /** Parses a PDF format date string and converts it to a time_t. Returns + * <tt>false</tt> if the parsing fails or the input string is not a valid + * PDF format date string + * @param date string to parse. + * @param timet an uninitialize time_t. + * @return <tt>true</tt> if timet was set. + */ + bool date_parse(const Glib::ustring& date, time_t* timet); + + /** Returns the backend compiled into the poppler library. + * @return The Poppler::Backend used by poppler. + */ + Backend get_backend(); + + /** Returns the version of poppler in use. + * @return The version of poppler. + */ + Glib::ustring get_version(); + + /** @} group PopplerUtility */ + +} // namespace Poppler diff --git a/poppler-glibmm.doap b/poppler-glibmm.doap new file mode 100644 index 0000000..5b20211 --- /dev/null +++ b/poppler-glibmm.doap @@ -0,0 +1,20 @@ +<Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:foaf="http://xmlns.com/foaf/0.1/" + xmlns:gnome="http://api.gnome.org/doap-extensions#" + xmlns="http://usefulinc.com/ns/doap#"> + + <name xml:lang="en">poppler-glibmm</name> + <shortdesc xml:lang="en">C++ bindings for the poppler-glib library</shortdesc> + <homepage rdf:resource="http://www.gtkmm.org/" /> + <mailing-list rdf:resource="mailto:gtkmm-list@gnome.org" /> + <category rdf:resource="http://api.gnome.org/doap-extensions#bindings" /> + + <maintainer> + <foaf:Person> + <foaf:name>Glenn Rice</foaf:name> + <foaf:mbox rdf:resource="mailto:glennricster@gmail.com" /> + <gnome:userid>na</gnome:userid> + </foaf:Person> + </maintainer> +</Project> |