diff --git a/root/cli/CSRender/CSRender.cs b/root/cli/CSRender/CSRender.cs index f4e87326ea715d11f28e0fb84441fb0fa1a63657..d3bd85c6f1e43e4ff4d43737b4c43c622d90f653 100644 --- a/root/cli/CSRender/CSRender.cs +++ b/root/cli/CSRender/CSRender.cs @@ -188,7 +188,8 @@ namespace CSRender { var format = System.Drawing.Imaging.PixelFormat.Format24bppRgb; var clonebitmap = bitmap.Clone(cloneRect, format); // - //bitmap.Dispose(); + // オリジナルbitmapの解放 S.Hishi 2023/08/22 + bitmap.Dispose(); return clonebitmap; /* 保存時にBitmapのクローンを作成し、その際のBitmapの形式に24bitRGB(PixelFormat.Format24bppRgb)を @@ -227,7 +228,8 @@ namespace CSRender { pm = new RenderConditionParams(); using (var memStrm = new MemoryStream()) { - PdfRenderFlags flg = (PdfRenderFlags.ForPrinting | PdfRenderFlags.CorrectFromDpi); + // PdfRenderFlags.LimitImageCacheSizeの追加 S.Hihsi 2023/08/22 + PdfRenderFlags flg = (PdfRenderFlags.ForPrinting | PdfRenderFlags.CorrectFromDpi| PdfRenderFlags.LimitImageCacheSize); using(var img = RenderRgbBitMap(docG, index, (float)pm.Dpi, (float)pm.Dpi, flg) ){ img.Save(memStrm, System.Drawing.Imaging.ImageFormat.Bmp); /* @@ -508,7 +510,8 @@ namespace CSRender { var bThDump = Check.bThDump; if (pm == null) pm = new RenderConditionParams(); - PdfRenderFlags flg = (PdfRenderFlags.ForPrinting | PdfRenderFlags.CorrectFromDpi); + // PdfRenderFlags.LimitImageCacheSizeの追加 S.Hishi 2023/08/22 + PdfRenderFlags flg = (PdfRenderFlags.ForPrinting | PdfRenderFlags.CorrectFromDpi | PdfRenderFlags.LimitImageCacheSize); System.Drawing.Image img =RenderRgbBitMap(docG, index, (float)pm.Dpi, (float)pm.Dpi, flg); img.Save(memStrm, System.Drawing.Imaging.ImageFormat.Bmp); //img.Save(memStrm, System.Drawing.Imaging.ImageFormat.Jpeg); diff --git a/root/cli/CSRender/CSRender2019.csproj b/root/cli/CSRender/CSRender2019.csproj index f35f288a5349c09e06aaba3010270d63c8305b16..0c8b97d594ed8232e86d016f514e0403e9b8141a 100644 --- a/root/cli/CSRender/CSRender2019.csproj +++ b/root/cli/CSRender/CSRender2019.csproj @@ -58,6 +58,10 @@ app.manifest + + False + ..\PdfiumViewer-master\PdfiumViewer\bin\Release\PdfiumViewer.dll + @@ -107,12 +111,6 @@ 10.0.19041.1 - - 2.13.0 - - - 2018.4.8.256 - 5.0.0-preview.5.20278.1 diff --git a/root/cli/CSRender2019.sln b/root/cli/CSRender2019.sln index 9259ae92e6386ddfd17bbc9856bf45453a5b8d0a..3d24d0805af793f2a638e1022bb78cf414ae11f8 100644 --- a/root/cli/CSRender2019.sln +++ b/root/cli/CSRender2019.sln @@ -1,9 +1,14 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 -VisualStudioVersion = 16.0.31613.86 +VisualStudioVersion = 16.0.33927.289 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSRender2019", "CSRender\CSRender2019.csproj", "{FD99EFAA-2479-4E3B-BD1A-5B785288E3B3}" + ProjectSection(ProjectDependencies) = postProject + {438914B6-5D1C-482C-B942-5C0E057EEF6F} = {438914B6-5D1C-482C-B942-5C0E057EEF6F} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PdfiumViewer", "PdfiumViewer-master\PdfiumViewer\PdfiumViewer.csproj", "{438914B6-5D1C-482C-B942-5C0E057EEF6F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,11 +20,15 @@ Global {FD99EFAA-2479-4E3B-BD1A-5B785288E3B3}.Debug|Any CPU.Build.0 = Debug|Any CPU {FD99EFAA-2479-4E3B-BD1A-5B785288E3B3}.Release|Any CPU.ActiveCfg = Release|Any CPU {FD99EFAA-2479-4E3B-BD1A-5B785288E3B3}.Release|Any CPU.Build.0 = Release|Any CPU + {438914B6-5D1C-482C-B942-5C0E057EEF6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {438914B6-5D1C-482C-B942-5C0E057EEF6F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {438914B6-5D1C-482C-B942-5C0E057EEF6F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {438914B6-5D1C-482C-B942-5C0E057EEF6F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {8B1418EB-CA5D-4F34-9026-020B0B30AE79} + SolutionGuid = {5A59DF7F-F182-4DB6-B2F9-60DD07DBE657} EndGlobalSection EndGlobal diff --git a/root/cli/PdfiumViewer-master/Contrib/pdfiumviewer.cpp b/root/cli/PdfiumViewer-master/Contrib/pdfiumviewer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c137607cf1b73eca1e988a3b0068137d4b4ecef1 --- /dev/null +++ b/root/cli/PdfiumViewer-master/Contrib/pdfiumviewer.cpp @@ -0,0 +1,102 @@ +// Copyright (c) 2015 Pieter van Ginkel. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "public/fpdfview.h" +#if PDF_ENABLE_V8 +#include "v8/include/v8.h" +#include "v8/include/libplatform/libplatform.h" +#endif // PDF_ENABLE_V8 + +extern "C" +{ + DLLEXPORT void STDCALL FPDF_AddRef(); + DLLEXPORT void STDCALL FPDF_Release(); +} + +class RefCounter +{ +private: + CRITICAL_SECTION cs; + int refCount; +#if PDF_ENABLE_V8 + v8::Platform* platform; +#endif // PDF_ENABLE_V8 + +public: + RefCounter() + { + ::InitializeCriticalSection(&cs); + refCount = 0; +#if PDF_ENABLE_V8 + platform = NULL; +#endif // PDF_ENABLE_V8 + } + + ~RefCounter() + { + ::DeleteCriticalSection(&cs); + } + + void Enter() + { + ::EnterCriticalSection(&cs); + } + + void Leave() + { + ::LeaveCriticalSection(&cs); + } + + void AddRef() + { + ::EnterCriticalSection(&cs); + + if (refCount == 0) + { +#if PDF_ENABLE_V8 + v8::V8::InitializeICU(); + platform = v8::platform::CreateDefaultPlatform(); + v8::V8::InitializePlatform(platform); + v8::V8::Initialize(); +#endif // PDF_ENABLE_V8 + + FPDF_InitLibrary(); + } + + refCount++; + + ::LeaveCriticalSection(&cs); + } + + void Release() + { + ::EnterCriticalSection(&cs); + + refCount--; + + if (refCount == 0) + { + FPDF_DestroyLibrary(); +#if PDF_ENABLE_V8 + v8::V8::ShutdownPlatform(); + delete platform; +#endif // PDF_ENABLE_V8 + } + + ::LeaveCriticalSection(&cs); + } +}; + +static RefCounter refCounter; + + +DLLEXPORT void STDCALL FPDF_AddRef() +{ + refCounter.AddRef(); +} + +DLLEXPORT void STDCALL FPDF_Release() +{ + refCounter.Release(); +} diff --git a/root/cli/PdfiumViewer-master/LICENSE b/root/cli/PdfiumViewer-master/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d645695673349e3947e8e5ae42332d0ac3164cd7 --- /dev/null +++ b/root/cli/PdfiumViewer-master/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/root/cli/PdfiumViewer-master/LICENSE PDFium b/root/cli/PdfiumViewer-master/LICENSE PDFium new file mode 100644 index 0000000000000000000000000000000000000000..b534b725b461b000debbec5273e3a169018f4fbe --- /dev/null +++ b/root/cli/PdfiumViewer-master/LICENSE PDFium @@ -0,0 +1 @@ +See the PDFium License directory for the licenses associated with PDFium. diff --git a/root/cli/PdfiumViewer-master/Libraries/NuGet/NuGet.exe b/root/cli/PdfiumViewer-master/Libraries/NuGet/NuGet.exe new file mode 100644 index 0000000000000000000000000000000000000000..34ad49b494dd855dabf1b1cee5d3a8d51525d3b9 Binary files /dev/null and b/root/cli/PdfiumViewer-master/Libraries/NuGet/NuGet.exe differ diff --git a/root/cli/PdfiumViewer-master/Libraries/Pdfium/README.md b/root/cli/PdfiumViewer-master/Libraries/Pdfium/README.md new file mode 100644 index 0000000000000000000000000000000000000000..32914658ac996f8f5947b2b3a97674e152470a02 --- /dev/null +++ b/root/cli/PdfiumViewer-master/Libraries/Pdfium/README.md @@ -0,0 +1,3 @@ +The native PDFium libraries have been removed from this repository. +Please see the [README](https://github.com/pvginkel/PdfiumViewer/blob/master/README.markdown) +or the [PdfiumBuild](https://github.com/pvginkel/PdfiumBuild) for more information. \ No newline at end of file diff --git a/root/cli/PdfiumViewer-master/PDFium License/LICENSE b/root/cli/PdfiumViewer-master/PDFium License/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..2cb7e358aecc415e9608191e1ba2b8a504aa1521 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PDFium License/LICENSE @@ -0,0 +1,54 @@ +This license applies to all parts of V8 that are not externally +maintained libraries. The externally maintained libraries used by V8 +are: + + - PCRE test suite, located in + test/mjsunit/third_party/regexp-pcre.js. This is based on the + test suite from PCRE-7.3, which is copyrighted by the University + of Cambridge and Google, Inc. The copyright notice and license + are embedded in regexp-pcre.js. + + - Layout tests, located in test/mjsunit/third_party. These are + based on layout tests from webkit.org which are copyrighted by + Apple Computer, Inc. and released under a 3-clause BSD license. + + - Strongtalk assembler, the basis of the files assembler-arm-inl.h, + assembler-arm.cc, assembler-arm.h, assembler-ia32-inl.h, + assembler-ia32.cc, assembler-ia32.h, assembler-x64-inl.h, + assembler-x64.cc, assembler-x64.h, assembler-mips-inl.h, + assembler-mips.cc, assembler-mips.h, assembler.cc and assembler.h. + This code is copyrighted by Sun Microsystems Inc. and released + under a 3-clause BSD license. + + - Valgrind client API header, located at third_party/valgrind/valgrind.h + This is release under the BSD license. + +These libraries have their own licenses; we recommend you read them, +as their terms may differ from the terms below. + +Copyright 2014, the V8 project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/root/cli/PdfiumViewer-master/PDFium License/LICENSE.strongtalk b/root/cli/PdfiumViewer-master/PDFium License/LICENSE.strongtalk new file mode 100644 index 0000000000000000000000000000000000000000..9bd62e4f231a357d47073bdece85373325dd732f --- /dev/null +++ b/root/cli/PdfiumViewer-master/PDFium License/LICENSE.strongtalk @@ -0,0 +1,29 @@ +Copyright (c) 1994-2006 Sun Microsystems Inc. +All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +- Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +- Redistribution in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of Sun Microsystems or the names of contributors may +be used to endorse or promote products derived from this software without +specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/root/cli/PdfiumViewer-master/PDFium License/LICENSE.v8 b/root/cli/PdfiumViewer-master/PDFium License/LICENSE.v8 new file mode 100644 index 0000000000000000000000000000000000000000..933718a9ef9dae4cb4afa56e490211760d8a949f --- /dev/null +++ b/root/cli/PdfiumViewer-master/PDFium License/LICENSE.v8 @@ -0,0 +1,26 @@ +Copyright 2006-2011, the V8 project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/root/cli/PdfiumViewer-master/PDFium License/LICENSE.valgrind b/root/cli/PdfiumViewer-master/PDFium License/LICENSE.valgrind new file mode 100644 index 0000000000000000000000000000000000000000..fd8ebaf50992130504530eb002daad634f3125e8 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PDFium License/LICENSE.valgrind @@ -0,0 +1,45 @@ +---------------------------------------------------------------- + +Notice that the following BSD-style license applies to this one +file (valgrind.h) only. The rest of Valgrind is licensed under the +terms of the GNU General Public License, version 2, unless +otherwise indicated. See the COPYING file in the source +distribution for details. + +---------------------------------------------------------------- + +This file is part of Valgrind, a dynamic binary instrumentation +framework. + +Copyright (C) 2000-2007 Julian Seward. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + +3. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + +4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/root/cli/PdfiumViewer-master/Pack NuGet.bat b/root/cli/PdfiumViewer-master/Pack NuGet.bat new file mode 100644 index 0000000000000000000000000000000000000000..0f9d0f71eb029a785a3fd5d1558d559d33fa2c77 --- /dev/null +++ b/root/cli/PdfiumViewer-master/Pack NuGet.bat @@ -0,0 +1,10 @@ +@echo off + +pushd "%~dp0" + +cd PdfiumViewer +..\Libraries\NuGet\NuGet.exe pack -Prop "configuration=release;platform=anycpu" + +pause + +popd diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/.gitignore b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..10714b4d2a33e9a66572c72605f0f48c187accae --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/.gitignore @@ -0,0 +1,4 @@ +/*.suo +/*.user +/bin +/obj diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/ExportBitmapsForm.Designer.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/ExportBitmapsForm.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..fd913e8e228d2c7838e353f08dcbc8bc570c8147 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/ExportBitmapsForm.Designer.cs @@ -0,0 +1,128 @@ +namespace PdfiumViewer.Demo +{ + partial class ExportBitmapsForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this._dpiXTextBox = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this._dpiYTextBox = new System.Windows.Forms.TextBox(); + this._acceptButton = new System.Windows.Forms.Button(); + this._cancelButton = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 15); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(78, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Horizontal DPI:"; + // + // _dpiXTextBox + // + this._dpiXTextBox.Location = new System.Drawing.Point(106, 12); + this._dpiXTextBox.Name = "_dpiXTextBox"; + this._dpiXTextBox.Size = new System.Drawing.Size(240, 20); + this._dpiXTextBox.TabIndex = 1; + this._dpiXTextBox.Text = "96"; + this._dpiXTextBox.TextChanged += new System.EventHandler(this._dpiX_TextChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 41); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(66, 13); + this.label2.TabIndex = 2; + this.label2.Text = "Vertical DPI:"; + // + // _dpiYTextBox + // + this._dpiYTextBox.Location = new System.Drawing.Point(106, 38); + this._dpiYTextBox.Name = "_dpiYTextBox"; + this._dpiYTextBox.Size = new System.Drawing.Size(240, 20); + this._dpiYTextBox.TabIndex = 3; + this._dpiYTextBox.Text = "96"; + this._dpiYTextBox.TextChanged += new System.EventHandler(this._dpiY_TextChanged); + // + // _acceptButton + // + this._acceptButton.Location = new System.Drawing.Point(190, 64); + this._acceptButton.Name = "_acceptButton"; + this._acceptButton.Size = new System.Drawing.Size(75, 23); + this._acceptButton.TabIndex = 4; + this._acceptButton.Text = "OK"; + this._acceptButton.UseVisualStyleBackColor = true; + this._acceptButton.Click += new System.EventHandler(this._acceptButton_Click); + // + // _cancelButton + // + this._cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this._cancelButton.Location = new System.Drawing.Point(271, 64); + this._cancelButton.Name = "_cancelButton"; + this._cancelButton.Size = new System.Drawing.Size(75, 23); + this._cancelButton.TabIndex = 5; + this._cancelButton.Text = "Cancel"; + this._cancelButton.UseVisualStyleBackColor = true; + // + // ExportBitmapsForm + // + this.AcceptButton = this._acceptButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this._cancelButton; + this.ClientSize = new System.Drawing.Size(358, 99); + this.Controls.Add(this._cancelButton); + this.Controls.Add(this._acceptButton); + this.Controls.Add(this._dpiYTextBox); + this.Controls.Add(this.label2); + this.Controls.Add(this._dpiXTextBox); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "ExportBitmapsForm"; + this.ShowInTaskbar = false; + this.Text = "Export bitmaps"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox _dpiXTextBox; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox _dpiYTextBox; + private System.Windows.Forms.Button _acceptButton; + private System.Windows.Forms.Button _cancelButton; + } +} \ No newline at end of file diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/ExportBitmapsForm.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/ExportBitmapsForm.cs new file mode 100644 index 0000000000000000000000000000000000000000..8053d04d27cb17b9b8604b1da07cab1cf9f44574 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/ExportBitmapsForm.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace PdfiumViewer.Demo +{ + public partial class ExportBitmapsForm : Form + { + private int _dpiX; + private int _dpiY; + + public int DpiX + { + get { return _dpiX; } + } + + public int DpiY + { + get { return _dpiY; } + } + + public ExportBitmapsForm() + { + InitializeComponent(); + UpdateEnabled(); + } + + private void _acceptButton_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.OK; + } + + private void _dpiX_TextChanged(object sender, EventArgs e) + { + UpdateEnabled(); + } + + private void _dpiY_TextChanged(object sender, EventArgs e) + { + UpdateEnabled(); + } + + private void UpdateEnabled() + { + _acceptButton.Enabled = + int.TryParse(_dpiXTextBox.Text, out _dpiX) && + int.TryParse(_dpiYTextBox.Text, out _dpiY); + } + } +} diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/ExportBitmapsForm.resx b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/ExportBitmapsForm.resx new file mode 100644 index 0000000000000000000000000000000000000000..5ea0895e324fa7a86681adc56938bad2f2367ba0 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/ExportBitmapsForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/MainForm.Designer.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/MainForm.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..0c2cff90d905b72d85d8b4d6f78ff447f2419378 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/MainForm.Designer.cs @@ -0,0 +1,630 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace PdfiumViewer.Demo +{ + partial class MainForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); + this.printPreviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator(); + this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.findToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem7 = new System.Windows.Forms.ToolStripSeparator(); + this.renderToBitmapsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); + this.cutMarginsWhenPrintingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.shrinkToMarginsWhenPrintingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator(); + this.deleteCurrentPageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.rotateCurrentPageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.rotate0ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.rotate90ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.rotate180ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.rotate270ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator(); + this.showRangeOfPagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem6 = new System.Windows.Forms.ToolStripSeparator(); + this.informationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel(); + this._page = new System.Windows.Forms.ToolStripTextBox(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel(); + this._zoom = new System.Windows.Forms.ToolStripTextBox(); + this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripButton4 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this._fitWidth = new System.Windows.Forms.ToolStripButton(); + this._fitHeight = new System.Windows.Forms.ToolStripButton(); + this._fitBest = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); + this._rotateLeft = new System.Windows.Forms.ToolStripButton(); + this._rotateRight = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); + this._showToolbar = new System.Windows.Forms.ToolStripButton(); + this._showBookmarks = new System.Windows.Forms.ToolStripButton(); + this._getTextFromPage = new System.Windows.Forms.ToolStripButton(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); + this._pageToolStripLabel = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); + this._coordinatesToolStripLabel = new System.Windows.Forms.ToolStripStatusLabel(); + this.pdfViewer1 = new PdfiumViewer.PdfViewer(); + this.printMultiplePagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.menuStrip1.SuspendLayout(); + this.toolStrip1.SuspendLayout(); + this.statusStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem, + this.toolsToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(1128, 24); + this.menuStrip1.TabIndex = 1; + this.menuStrip1.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.openToolStripMenuItem, + this.toolStripMenuItem1, + this.printPreviewToolStripMenuItem, + this.printMultiplePagesToolStripMenuItem, + this.toolStripMenuItem3, + this.exitToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "&File"; + // + // openToolStripMenuItem + // + this.openToolStripMenuItem.Name = "openToolStripMenuItem"; + this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); + this.openToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.openToolStripMenuItem.Text = "&Open"; + this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); + // + // toolStripMenuItem1 + // + this.toolStripMenuItem1.Name = "toolStripMenuItem1"; + this.toolStripMenuItem1.Size = new System.Drawing.Size(177, 6); + // + // printPreviewToolStripMenuItem + // + this.printPreviewToolStripMenuItem.Name = "printPreviewToolStripMenuItem"; + this.printPreviewToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.printPreviewToolStripMenuItem.Text = "Print Preview"; + this.printPreviewToolStripMenuItem.Click += new System.EventHandler(this.printPreviewToolStripMenuItem_Click); + // + // toolStripMenuItem3 + // + this.toolStripMenuItem3.Name = "toolStripMenuItem3"; + this.toolStripMenuItem3.Size = new System.Drawing.Size(177, 6); + // + // exitToolStripMenuItem + // + this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; + this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.exitToolStripMenuItem.Text = "E&xit"; + this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); + // + // toolsToolStripMenuItem + // + this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.findToolStripMenuItem, + this.toolStripMenuItem7, + this.renderToBitmapsToolStripMenuItem, + this.toolStripMenuItem2, + this.cutMarginsWhenPrintingToolStripMenuItem, + this.shrinkToMarginsWhenPrintingToolStripMenuItem, + this.toolStripMenuItem4, + this.deleteCurrentPageToolStripMenuItem, + this.rotateCurrentPageToolStripMenuItem, + this.toolStripMenuItem5, + this.showRangeOfPagesToolStripMenuItem, + this.toolStripMenuItem6, + this.informationToolStripMenuItem}); + this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem"; + this.toolsToolStripMenuItem.Size = new System.Drawing.Size(47, 20); + this.toolsToolStripMenuItem.Text = "&Tools"; + // + // findToolStripMenuItem + // + this.findToolStripMenuItem.Name = "findToolStripMenuItem"; + this.findToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F))); + this.findToolStripMenuItem.Size = new System.Drawing.Size(244, 22); + this.findToolStripMenuItem.Text = "&Find"; + this.findToolStripMenuItem.Click += new System.EventHandler(this.findToolStripMenuItem_Click); + // + // toolStripMenuItem7 + // + this.toolStripMenuItem7.Name = "toolStripMenuItem7"; + this.toolStripMenuItem7.Size = new System.Drawing.Size(241, 6); + // + // renderToBitmapsToolStripMenuItem + // + this.renderToBitmapsToolStripMenuItem.Name = "renderToBitmapsToolStripMenuItem"; + this.renderToBitmapsToolStripMenuItem.Size = new System.Drawing.Size(244, 22); + this.renderToBitmapsToolStripMenuItem.Text = "&Render to Bitmaps"; + this.renderToBitmapsToolStripMenuItem.Click += new System.EventHandler(this.renderToBitmapsToolStripMenuItem_Click); + // + // toolStripMenuItem2 + // + this.toolStripMenuItem2.Name = "toolStripMenuItem2"; + this.toolStripMenuItem2.Size = new System.Drawing.Size(241, 6); + // + // cutMarginsWhenPrintingToolStripMenuItem + // + this.cutMarginsWhenPrintingToolStripMenuItem.Name = "cutMarginsWhenPrintingToolStripMenuItem"; + this.cutMarginsWhenPrintingToolStripMenuItem.Size = new System.Drawing.Size(244, 22); + this.cutMarginsWhenPrintingToolStripMenuItem.Text = "Cut margins when printing"; + this.cutMarginsWhenPrintingToolStripMenuItem.Click += new System.EventHandler(this.cutMarginsWhenPrintingToolStripMenuItem_Click); + // + // shrinkToMarginsWhenPrintingToolStripMenuItem + // + this.shrinkToMarginsWhenPrintingToolStripMenuItem.Name = "shrinkToMarginsWhenPrintingToolStripMenuItem"; + this.shrinkToMarginsWhenPrintingToolStripMenuItem.Size = new System.Drawing.Size(244, 22); + this.shrinkToMarginsWhenPrintingToolStripMenuItem.Text = "Shrink to margins when printing"; + this.shrinkToMarginsWhenPrintingToolStripMenuItem.Click += new System.EventHandler(this.shrinkToMarginsWhenPrintingToolStripMenuItem_Click); + // + // toolStripMenuItem4 + // + this.toolStripMenuItem4.Name = "toolStripMenuItem4"; + this.toolStripMenuItem4.Size = new System.Drawing.Size(241, 6); + // + // deleteCurrentPageToolStripMenuItem + // + this.deleteCurrentPageToolStripMenuItem.Name = "deleteCurrentPageToolStripMenuItem"; + this.deleteCurrentPageToolStripMenuItem.Size = new System.Drawing.Size(244, 22); + this.deleteCurrentPageToolStripMenuItem.Text = "Delete Current Page"; + this.deleteCurrentPageToolStripMenuItem.Click += new System.EventHandler(this.deleteCurrentPageToolStripMenuItem_Click); + // + // rotateCurrentPageToolStripMenuItem + // + this.rotateCurrentPageToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.rotate0ToolStripMenuItem, + this.rotate90ToolStripMenuItem, + this.rotate180ToolStripMenuItem, + this.rotate270ToolStripMenuItem}); + this.rotateCurrentPageToolStripMenuItem.Name = "rotateCurrentPageToolStripMenuItem"; + this.rotateCurrentPageToolStripMenuItem.Size = new System.Drawing.Size(244, 22); + this.rotateCurrentPageToolStripMenuItem.Text = "Rotate Current Page"; + // + // rotate0ToolStripMenuItem + // + this.rotate0ToolStripMenuItem.Name = "rotate0ToolStripMenuItem"; + this.rotate0ToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.rotate0ToolStripMenuItem.Text = "Rotate 0°"; + this.rotate0ToolStripMenuItem.Click += new System.EventHandler(this.rotate0ToolStripMenuItem_Click); + // + // rotate90ToolStripMenuItem + // + this.rotate90ToolStripMenuItem.Name = "rotate90ToolStripMenuItem"; + this.rotate90ToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.rotate90ToolStripMenuItem.Text = "Rotate 90°"; + this.rotate90ToolStripMenuItem.Click += new System.EventHandler(this.rotate90ToolStripMenuItem_Click); + // + // rotate180ToolStripMenuItem + // + this.rotate180ToolStripMenuItem.Name = "rotate180ToolStripMenuItem"; + this.rotate180ToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.rotate180ToolStripMenuItem.Text = "Rotate 180°"; + this.rotate180ToolStripMenuItem.Click += new System.EventHandler(this.rotate180ToolStripMenuItem_Click); + // + // rotate270ToolStripMenuItem + // + this.rotate270ToolStripMenuItem.Name = "rotate270ToolStripMenuItem"; + this.rotate270ToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.rotate270ToolStripMenuItem.Text = "Rotate 270°"; + this.rotate270ToolStripMenuItem.Click += new System.EventHandler(this.rotate270ToolStripMenuItem_Click); + // + // toolStripMenuItem5 + // + this.toolStripMenuItem5.Name = "toolStripMenuItem5"; + this.toolStripMenuItem5.Size = new System.Drawing.Size(241, 6); + // + // showRangeOfPagesToolStripMenuItem + // + this.showRangeOfPagesToolStripMenuItem.Name = "showRangeOfPagesToolStripMenuItem"; + this.showRangeOfPagesToolStripMenuItem.Size = new System.Drawing.Size(244, 22); + this.showRangeOfPagesToolStripMenuItem.Text = "Show range of pages"; + this.showRangeOfPagesToolStripMenuItem.Click += new System.EventHandler(this.showRangeOfPagesToolStripMenuItem_Click); + // + // toolStripMenuItem6 + // + this.toolStripMenuItem6.Name = "toolStripMenuItem6"; + this.toolStripMenuItem6.Size = new System.Drawing.Size(241, 6); + // + // informationToolStripMenuItem + // + this.informationToolStripMenuItem.Name = "informationToolStripMenuItem"; + this.informationToolStripMenuItem.Size = new System.Drawing.Size(244, 22); + this.informationToolStripMenuItem.Text = "Information"; + this.informationToolStripMenuItem.Click += new System.EventHandler(this.informationToolStripMenuItem_Click); + // + // toolStrip1 + // + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripLabel1, + this._page, + this.toolStripSeparator1, + this.toolStripButton1, + this.toolStripButton2, + this.toolStripSeparator2, + this.toolStripLabel2, + this._zoom, + this.toolStripSeparator7, + this.toolStripButton4, + this.toolStripButton3, + this.toolStripSeparator3, + this._fitWidth, + this._fitHeight, + this._fitBest, + this.toolStripSeparator5, + this._rotateLeft, + this._rotateRight, + this.toolStripSeparator6, + this._showToolbar, + this._showBookmarks, + this._getTextFromPage}); + this.toolStrip1.Location = new System.Drawing.Point(0, 24); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(1128, 25); + this.toolStrip1.TabIndex = 2; + this.toolStrip1.Text = "toolStrip1"; + // + // toolStripLabel1 + // + this.toolStripLabel1.Name = "toolStripLabel1"; + this.toolStripLabel1.Size = new System.Drawing.Size(36, 22); + this.toolStripLabel1.Text = "Page:"; + // + // _page + // + this._page.Name = "_page"; + this._page.Size = new System.Drawing.Size(100, 25); + this._page.KeyDown += new System.Windows.Forms.KeyEventHandler(this._page_KeyDown); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); + // + // toolStripButton1 + // + this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image"))); + this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton1.Name = "toolStripButton1"; + this.toolStripButton1.Size = new System.Drawing.Size(23, 22); + this.toolStripButton1.Text = "<"; + this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click_1); + // + // toolStripButton2 + // + this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.toolStripButton2.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton2.Image"))); + this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton2.Name = "toolStripButton2"; + this.toolStripButton2.Size = new System.Drawing.Size(23, 22); + this.toolStripButton2.Text = ">"; + this.toolStripButton2.Click += new System.EventHandler(this.toolStripButton2_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25); + // + // toolStripLabel2 + // + this.toolStripLabel2.Name = "toolStripLabel2"; + this.toolStripLabel2.Size = new System.Drawing.Size(42, 22); + this.toolStripLabel2.Text = "Zoom:"; + // + // _zoom + // + this._zoom.Name = "_zoom"; + this._zoom.Size = new System.Drawing.Size(100, 25); + this._zoom.KeyDown += new System.Windows.Forms.KeyEventHandler(this._zoom_KeyDown); + // + // toolStripSeparator7 + // + this.toolStripSeparator7.Name = "toolStripSeparator7"; + this.toolStripSeparator7.Size = new System.Drawing.Size(6, 25); + // + // toolStripButton4 + // + this.toolStripButton4.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.toolStripButton4.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton4.Image"))); + this.toolStripButton4.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton4.Name = "toolStripButton4"; + this.toolStripButton4.Size = new System.Drawing.Size(23, 22); + this.toolStripButton4.Text = "+"; + this.toolStripButton4.Click += new System.EventHandler(this.toolStripButton4_Click); + // + // toolStripButton3 + // + this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.toolStripButton3.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton3.Image"))); + this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton3.Name = "toolStripButton3"; + this.toolStripButton3.Size = new System.Drawing.Size(23, 22); + this.toolStripButton3.Text = "-"; + this.toolStripButton3.Click += new System.EventHandler(this.toolStripButton3_Click); + // + // toolStripSeparator3 + // + this.toolStripSeparator3.Name = "toolStripSeparator3"; + this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25); + // + // _fitWidth + // + this._fitWidth.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this._fitWidth.Image = ((System.Drawing.Image)(resources.GetObject("_fitWidth.Image"))); + this._fitWidth.ImageTransparentColor = System.Drawing.Color.Magenta; + this._fitWidth.Name = "_fitWidth"; + this._fitWidth.Size = new System.Drawing.Size(59, 22); + this._fitWidth.Text = "Fit Width"; + this._fitWidth.Click += new System.EventHandler(this._fitWidth_Click); + // + // _fitHeight + // + this._fitHeight.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this._fitHeight.Image = ((System.Drawing.Image)(resources.GetObject("_fitHeight.Image"))); + this._fitHeight.ImageTransparentColor = System.Drawing.Color.Magenta; + this._fitHeight.Name = "_fitHeight"; + this._fitHeight.Size = new System.Drawing.Size(63, 22); + this._fitHeight.Text = "Fit Height"; + this._fitHeight.Click += new System.EventHandler(this._fitHeight_Click); + // + // _fitBest + // + this._fitBest.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this._fitBest.Image = ((System.Drawing.Image)(resources.GetObject("_fitBest.Image"))); + this._fitBest.ImageTransparentColor = System.Drawing.Color.Magenta; + this._fitBest.Name = "_fitBest"; + this._fitBest.Size = new System.Drawing.Size(49, 22); + this._fitBest.Text = "Fit Best"; + this._fitBest.Click += new System.EventHandler(this._fitBest_Click); + // + // toolStripSeparator5 + // + this.toolStripSeparator5.Name = "toolStripSeparator5"; + this.toolStripSeparator5.Size = new System.Drawing.Size(6, 25); + // + // _rotateLeft + // + this._rotateLeft.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this._rotateLeft.Image = ((System.Drawing.Image)(resources.GetObject("_rotateLeft.Image"))); + this._rotateLeft.ImageTransparentColor = System.Drawing.Color.Magenta; + this._rotateLeft.Name = "_rotateLeft"; + this._rotateLeft.Size = new System.Drawing.Size(68, 22); + this._rotateLeft.Text = "Rotate Left"; + this._rotateLeft.Click += new System.EventHandler(this._rotateLeft_Click); + // + // _rotateRight + // + this._rotateRight.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this._rotateRight.Image = ((System.Drawing.Image)(resources.GetObject("_rotateRight.Image"))); + this._rotateRight.ImageTransparentColor = System.Drawing.Color.Magenta; + this._rotateRight.Name = "_rotateRight"; + this._rotateRight.Size = new System.Drawing.Size(76, 22); + this._rotateRight.Text = "Rotate Right"; + this._rotateRight.Click += new System.EventHandler(this._rotateRight_Click); + // + // toolStripSeparator6 + // + this.toolStripSeparator6.Name = "toolStripSeparator6"; + this.toolStripSeparator6.Size = new System.Drawing.Size(6, 25); + // + // _showToolbar + // + this._showToolbar.CheckOnClick = true; + this._showToolbar.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this._showToolbar.Image = ((System.Drawing.Image)(resources.GetObject("_showToolbar.Image"))); + this._showToolbar.ImageTransparentColor = System.Drawing.Color.Magenta; + this._showToolbar.Name = "_showToolbar"; + this._showToolbar.Size = new System.Drawing.Size(83, 22); + this._showToolbar.Text = "Show Toolbar"; + this._showToolbar.Click += new System.EventHandler(this._hideToolbar_Click); + // + // _showBookmarks + // + this._showBookmarks.CheckOnClick = true; + this._showBookmarks.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this._showBookmarks.Image = ((System.Drawing.Image)(resources.GetObject("_showBookmarks.Image"))); + this._showBookmarks.ImageTransparentColor = System.Drawing.Color.Magenta; + this._showBookmarks.Name = "_showBookmarks"; + this._showBookmarks.Size = new System.Drawing.Size(102, 22); + this._showBookmarks.Text = "Show Bookmarks"; + this._showBookmarks.Click += new System.EventHandler(this._hideBookmarks_Click); + // + // _getTextFromPage + // + this._getTextFromPage.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this._getTextFromPage.Image = ((System.Drawing.Image)(resources.GetObject("_getTextFromPage.Image"))); + this._getTextFromPage.ImageTransparentColor = System.Drawing.Color.Magenta; + this._getTextFromPage.Name = "_getTextFromPage"; + this._getTextFromPage.Size = new System.Drawing.Size(53, 22); + this._getTextFromPage.Text = "Get Text"; + this._getTextFromPage.ToolTipText = "Get Text From Current Page"; + this._getTextFromPage.Click += new System.EventHandler(this._getTextFromPage_Click); + // + // statusStrip1 + // + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabel1, + this._pageToolStripLabel, + this.toolStripStatusLabel2, + this._coordinatesToolStripLabel}); + this.statusStrip1.Location = new System.Drawing.Point(0, 573); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(1128, 22); + this.statusStrip1.TabIndex = 3; + this.statusStrip1.Text = "statusStrip1"; + // + // toolStripStatusLabel1 + // + this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; + this.toolStripStatusLabel1.Size = new System.Drawing.Size(36, 17); + this.toolStripStatusLabel1.Text = "Page:"; + // + // _pageToolStripLabel + // + this._pageToolStripLabel.Name = "_pageToolStripLabel"; + this._pageToolStripLabel.Size = new System.Drawing.Size(41, 17); + this._pageToolStripLabel.Text = "(page)"; + // + // toolStripStatusLabel2 + // + this.toolStripStatusLabel2.Name = "toolStripStatusLabel2"; + this.toolStripStatusLabel2.Size = new System.Drawing.Size(74, 17); + this.toolStripStatusLabel2.Text = "Coordinates:"; + // + // _coordinatesToolStripLabel + // + this._coordinatesToolStripLabel.Name = "_coordinatesToolStripLabel"; + this._coordinatesToolStripLabel.Size = new System.Drawing.Size(77, 17); + this._coordinatesToolStripLabel.Text = "(coordinates)"; + // + // pdfViewer1 + // + this.pdfViewer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.pdfViewer1.Location = new System.Drawing.Point(0, 49); + this.pdfViewer1.Name = "pdfViewer1"; + this.pdfViewer1.Size = new System.Drawing.Size(1128, 524); + this.pdfViewer1.TabIndex = 0; + // + // printMultiplePagesToolStripMenuItem + // + this.printMultiplePagesToolStripMenuItem.Name = "printMultiplePagesToolStripMenuItem"; + this.printMultiplePagesToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.printMultiplePagesToolStripMenuItem.Text = "Print Multiple Pages"; + this.printMultiplePagesToolStripMenuItem.Click += new System.EventHandler(this.printMultiplePagesToolStripMenuItem_Click); + // + // MainForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1128, 595); + this.Controls.Add(this.pdfViewer1); + this.Controls.Add(this.statusStrip1); + this.Controls.Add(this.toolStrip1); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; + this.Name = "MainForm"; + this.Text = "Form1"; + this.Shown += new System.EventHandler(this.MainForm_Shown); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private global::PdfiumViewer.PdfViewer pdfViewer1; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1; + private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem renderToBitmapsToolStripMenuItem; + private System.Windows.Forms.ToolStrip toolStrip1; + private System.Windows.Forms.ToolStripLabel toolStripLabel1; + private System.Windows.Forms.ToolStripTextBox _page; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripButton toolStripButton1; + private System.Windows.Forms.ToolStripButton toolStripButton2; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2; + private System.Windows.Forms.ToolStripMenuItem cutMarginsWhenPrintingToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem shrinkToMarginsWhenPrintingToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem printPreviewToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripButton _fitWidth; + private System.Windows.Forms.ToolStripButton _fitHeight; + private System.Windows.Forms.ToolStripLabel toolStripLabel2; + private System.Windows.Forms.ToolStripTextBox _zoom; + private System.Windows.Forms.ToolStripButton toolStripButton4; + private System.Windows.Forms.ToolStripButton toolStripButton3; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; + private System.Windows.Forms.ToolStripButton _rotateLeft; + private System.Windows.Forms.ToolStripButton _rotateRight; + private System.Windows.Forms.ToolStripButton _fitBest; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator6; + private System.Windows.Forms.ToolStripButton _showToolbar; + private System.Windows.Forms.ToolStripButton _showBookmarks; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4; + private System.Windows.Forms.ToolStripMenuItem deleteCurrentPageToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem rotateCurrentPageToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem rotate0ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem rotate90ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem rotate180ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem rotate270ToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator7; + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; + private System.Windows.Forms.ToolStripStatusLabel _pageToolStripLabel; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2; + private System.Windows.Forms.ToolStripStatusLabel _coordinatesToolStripLabel; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem5; + private System.Windows.Forms.ToolStripMenuItem showRangeOfPagesToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem6; + private System.Windows.Forms.ToolStripMenuItem informationToolStripMenuItem; + private System.Windows.Forms.ToolStripButton _getTextFromPage; + private System.Windows.Forms.ToolStripMenuItem findToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem7; + private System.Windows.Forms.ToolStripMenuItem printMultiplePagesToolStripMenuItem; + } +} + diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/MainForm.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/MainForm.cs new file mode 100644 index 0000000000000000000000000000000000000000..e65cddf5a075faed0395ef0a7f593b320cecd3f5 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/MainForm.cs @@ -0,0 +1,382 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Text; +using System.Windows.Forms; + +namespace PdfiumViewer.Demo +{ + public partial class MainForm : Form + { + private SearchForm _searchForm; + + public MainForm() + { + InitializeComponent(); + + renderToBitmapsToolStripMenuItem.Enabled = false; + + pdfViewer1.Renderer.DisplayRectangleChanged += Renderer_DisplayRectangleChanged; + pdfViewer1.Renderer.ZoomChanged += Renderer_ZoomChanged; + + pdfViewer1.Renderer.MouseMove += Renderer_MouseMove; + pdfViewer1.Renderer.MouseLeave += Renderer_MouseLeave; + ShowPdfLocation(PdfPoint.Empty); + + cutMarginsWhenPrintingToolStripMenuItem.PerformClick(); + + _zoom.Text = pdfViewer1.Renderer.Zoom.ToString(); + + Disposed += (s, e) => pdfViewer1.Document?.Dispose(); + } + + private void Renderer_MouseLeave(object sender, EventArgs e) + { + ShowPdfLocation(PdfPoint.Empty); + } + + private void Renderer_MouseMove(object sender, MouseEventArgs e) + { + ShowPdfLocation(pdfViewer1.Renderer.PointToPdf(e.Location)); + } + + private void ShowPdfLocation(PdfPoint point) + { + if (!point.IsValid) + { + _pageToolStripLabel.Text = null; + _coordinatesToolStripLabel.Text = null; + } + else + { + _pageToolStripLabel.Text = (point.Page + 1).ToString(); + _coordinatesToolStripLabel.Text = point.Location.X + "," + point.Location.Y; + } + } + + void Renderer_ZoomChanged(object sender, EventArgs e) + { + _zoom.Text = pdfViewer1.Renderer.Zoom.ToString(); + } + + void Renderer_DisplayRectangleChanged(object sender, EventArgs e) + { + _page.Text = (pdfViewer1.Renderer.Page + 1).ToString(); + } + + private void MainForm_Shown(object sender, EventArgs e) + { + var args = Environment.GetCommandLineArgs(); + + if (args.Length > 1) + { + pdfViewer1.Document?.Dispose(); + pdfViewer1.Document = OpenDocument(args[1]); + renderToBitmapsToolStripMenuItem.Enabled = true; + } + else + { + OpenFile(); + } + + _showBookmarks.Checked = pdfViewer1.ShowBookmarks; + _showToolbar.Checked = pdfViewer1.ShowToolbar; + } + + private PdfDocument OpenDocument(string fileName) + { + try + { + return PdfDocument.Load(this, fileName); + } + catch (Exception ex) + { + MessageBox.Show(this, ex.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); + return null; + } + } + + private void OpenFile() + { + using (var form = new OpenFileDialog()) + { + form.Filter = "PDF Files (*.pdf)|*.pdf|All Files (*.*)|*.*"; + form.RestoreDirectory = true; + form.Title = "Open PDF File"; + + if (form.ShowDialog(this) != DialogResult.OK) + { + Dispose(); + return; + } + + pdfViewer1.Document?.Dispose(); + pdfViewer1.Document = OpenDocument(form.FileName); + renderToBitmapsToolStripMenuItem.Enabled = true; + } + } + + private void exitToolStripMenuItem_Click(object sender, EventArgs e) + { + Close(); + } + + private void openToolStripMenuItem_Click(object sender, EventArgs e) + { + OpenFile(); + } + + private void renderToBitmapsToolStripMenuItem_Click(object sender, EventArgs e) + { + int dpiX; + int dpiY; + + using (var form = new ExportBitmapsForm()) + { + if (form.ShowDialog() != DialogResult.OK) + return; + + dpiX = form.DpiX; + dpiY = form.DpiY; + } + + string path; + + using (var form = new FolderBrowserDialog()) + { + if (form.ShowDialog(this) != DialogResult.OK) + return; + + path = form.SelectedPath; + } + + var document = pdfViewer1.Document; + + for (int i = 0; i < document.PageCount; i++) + { + using (var image = document.Render(i, (int)document.PageSizes[i].Width, (int)document.PageSizes[i].Height, dpiX, dpiY, false)) + { + image.Save(Path.Combine(path, "Page " + i + ".png")); + } + } + } + + private void toolStripButton1_Click_1(object sender, EventArgs e) + { + pdfViewer1.Renderer.Page--; + } + + private void toolStripButton2_Click(object sender, EventArgs e) + { + pdfViewer1.Renderer.Page++; + } + + private void cutMarginsWhenPrintingToolStripMenuItem_Click(object sender, EventArgs e) + { + cutMarginsWhenPrintingToolStripMenuItem.Checked = true; + shrinkToMarginsWhenPrintingToolStripMenuItem.Checked = false; + + pdfViewer1.DefaultPrintMode = PdfPrintMode.CutMargin; + } + + private void shrinkToMarginsWhenPrintingToolStripMenuItem_Click(object sender, EventArgs e) + { + shrinkToMarginsWhenPrintingToolStripMenuItem.Checked = true; + cutMarginsWhenPrintingToolStripMenuItem.Checked = false; + + pdfViewer1.DefaultPrintMode = PdfPrintMode.ShrinkToMargin; + } + + private void printPreviewToolStripMenuItem_Click(object sender, EventArgs e) + { + using (var form = new PrintPreviewDialog()) + { + form.Document = pdfViewer1.Document.CreatePrintDocument(pdfViewer1.DefaultPrintMode); + form.ShowDialog(this); + } + } + + private void _fitWidth_Click(object sender, EventArgs e) + { + FitPage(PdfViewerZoomMode.FitWidth); + } + + private void FitPage(PdfViewerZoomMode zoomMode) + { + int page = pdfViewer1.Renderer.Page; + pdfViewer1.ZoomMode = zoomMode; + pdfViewer1.Renderer.Zoom = 1; + pdfViewer1.Renderer.Page = page; + } + + private void _fitHeight_Click(object sender, EventArgs e) + { + FitPage(PdfViewerZoomMode.FitHeight); + } + + private void _fitBest_Click(object sender, EventArgs e) + { + FitPage(PdfViewerZoomMode.FitBest); + } + + private void _page_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + e.Handled = true; + + int page; + if (int.TryParse(_page.Text, out page)) + pdfViewer1.Renderer.Page = page - 1; + } + } + + private void _zoom_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + e.Handled = true; + + float zoom; + if (float.TryParse(_zoom.Text, out zoom)) + pdfViewer1.Renderer.Zoom = zoom; + } + } + + private void toolStripButton4_Click(object sender, EventArgs e) + { + pdfViewer1.Renderer.ZoomIn(); + } + + private void toolStripButton3_Click(object sender, EventArgs e) + { + pdfViewer1.Renderer.ZoomOut(); + } + + private void _rotateLeft_Click(object sender, EventArgs e) + { + pdfViewer1.Renderer.RotateLeft(); + } + + private void _rotateRight_Click(object sender, EventArgs e) + { + pdfViewer1.Renderer.RotateRight(); + } + + private void _hideToolbar_Click(object sender, EventArgs e) + { + pdfViewer1.ShowToolbar = _showToolbar.Checked; + } + + private void _hideBookmarks_Click(object sender, EventArgs e) + { + pdfViewer1.ShowBookmarks = _showBookmarks.Checked; + } + + private void deleteCurrentPageToolStripMenuItem_Click(object sender, EventArgs e) + { + // PdfRenderer does not support changes to the loaded document, + // so we fake it by reloading the document into the renderer. + + int page = pdfViewer1.Renderer.Page; + var document = pdfViewer1.Document; + pdfViewer1.Document = null; + document.DeletePage(page); + pdfViewer1.Document = document; + pdfViewer1.Renderer.Page = page; + } + + private void rotate0ToolStripMenuItem_Click(object sender, EventArgs e) + { + Rotate(PdfRotation.Rotate0); + } + + private void rotate90ToolStripMenuItem_Click(object sender, EventArgs e) + { + Rotate(PdfRotation.Rotate90); + } + + private void rotate180ToolStripMenuItem_Click(object sender, EventArgs e) + { + Rotate(PdfRotation.Rotate180); + } + + private void rotate270ToolStripMenuItem_Click(object sender, EventArgs e) + { + Rotate(PdfRotation.Rotate270); + } + + private void Rotate(PdfRotation rotate) + { + // PdfRenderer does not support changes to the loaded document, + // so we fake it by reloading the document into the renderer. + + int page = pdfViewer1.Renderer.Page; + var document = pdfViewer1.Document; + pdfViewer1.Document = null; + document.RotatePage(page, rotate); + pdfViewer1.Document = document; + pdfViewer1.Renderer.Page = page; + } + + private void showRangeOfPagesToolStripMenuItem_Click(object sender, EventArgs e) + { + using (var form = new PageRangeForm(pdfViewer1.Document)) + { + if (form.ShowDialog(this) == DialogResult.OK) + { + pdfViewer1.Document = form.Document; + } + } + } + + private void informationToolStripMenuItem_Click(object sender, EventArgs e) + { + PdfInformation info = pdfViewer1.Document.GetInformation(); + StringBuilder sz = new StringBuilder(); + sz.AppendLine($"Author: {info.Author}"); + sz.AppendLine($"Creator: {info.Creator}"); + sz.AppendLine($"Keywords: {info.Keywords}"); + sz.AppendLine($"Producer: {info.Producer}"); + sz.AppendLine($"Subject: {info.Subject}"); + sz.AppendLine($"Title: {info.Title}"); + sz.AppendLine($"Create Date: {info.CreationDate}"); + sz.AppendLine($"Modified Date: {info.ModificationDate}"); + + MessageBox.Show(sz.ToString(), "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + private void _getTextFromPage_Click(object sender, EventArgs e) + { + int page = pdfViewer1.Renderer.Page; + string text = pdfViewer1.Document.GetPdfText(page); + string caption = string.Format("Page {0} contains {1} character(s):", page + 1, text.Length); + + if (text.Length > 128) text = text.Substring(0, 125) + "...\n\n\n\n..." + text.Substring(text.Length - 125); + MessageBox.Show(this, text, caption, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + private void findToolStripMenuItem_Click(object sender, EventArgs e) + { + if (_searchForm == null) + { + _searchForm = new SearchForm(pdfViewer1.Renderer); + _searchForm.Disposed += (s, ea) => _searchForm = null; + _searchForm.Show(this); + } + + _searchForm.Focus(); + } + + private void printMultiplePagesToolStripMenuItem_Click(object sender, EventArgs e) + { + using (var form = new PrintMultiplePagesForm(pdfViewer1)) + { + form.ShowDialog(this); + } + } + } +} diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/MainForm.resx b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/MainForm.resx new file mode 100644 index 0000000000000000000000000000000000000000..98e3b46ec84298d65590d55b235365ae87f705e8 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/MainForm.resx @@ -0,0 +1,310 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 132, 17 + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jI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v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + + + 237, 17 + + \ No newline at end of file diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PageRangeForm.Designer.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PageRangeForm.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..8b9868348128c4e13ca660bee9e80e5b2c19ffb1 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PageRangeForm.Designer.cs @@ -0,0 +1,126 @@ +namespace PdfiumViewer.Demo +{ + partial class PageRangeForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this._startPage = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this._endPage = new System.Windows.Forms.TextBox(); + this._acceptButton = new System.Windows.Forms.Button(); + this._cancelButton = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 15); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(59, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Start page:"; + // + // _startPage + // + this._startPage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._startPage.Location = new System.Drawing.Point(83, 12); + this._startPage.Name = "_startPage"; + this._startPage.Size = new System.Drawing.Size(264, 20); + this._startPage.TabIndex = 1; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 41); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(56, 13); + this.label2.TabIndex = 2; + this.label2.Text = "End page:"; + // + // _endPage + // + this._endPage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._endPage.Location = new System.Drawing.Point(83, 38); + this._endPage.Name = "_endPage"; + this._endPage.Size = new System.Drawing.Size(264, 20); + this._endPage.TabIndex = 3; + // + // _acceptButton + // + this._acceptButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this._acceptButton.Location = new System.Drawing.Point(191, 64); + this._acceptButton.Name = "_acceptButton"; + this._acceptButton.Size = new System.Drawing.Size(75, 23); + this._acceptButton.TabIndex = 4; + this._acceptButton.Text = "OK"; + this._acceptButton.UseVisualStyleBackColor = true; + this._acceptButton.Click += new System.EventHandler(this._acceptButton_Click); + // + // _cancelButton + // + this._cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this._cancelButton.Location = new System.Drawing.Point(272, 64); + this._cancelButton.Name = "_cancelButton"; + this._cancelButton.Size = new System.Drawing.Size(75, 23); + this._cancelButton.TabIndex = 5; + this._cancelButton.Text = "Cancel"; + this._cancelButton.UseVisualStyleBackColor = true; + // + // PageRangeForm + // + this.AcceptButton = this._acceptButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this._cancelButton; + this.ClientSize = new System.Drawing.Size(359, 99); + this.Controls.Add(this._cancelButton); + this.Controls.Add(this._acceptButton); + this.Controls.Add(this._endPage); + this.Controls.Add(this.label2); + this.Controls.Add(this._startPage); + this.Controls.Add(this.label1); + this.Name = "PageRangeForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Show Range of Pages"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox _startPage; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox _endPage; + private System.Windows.Forms.Button _acceptButton; + private System.Windows.Forms.Button _cancelButton; + } +} \ No newline at end of file diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PageRangeForm.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PageRangeForm.cs new file mode 100644 index 0000000000000000000000000000000000000000..b0a694fa00fbc459d9795fae48cfc6200e285e7d --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PageRangeForm.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace PdfiumViewer.Demo +{ + public partial class PageRangeForm : Form + { + private readonly IPdfDocument _document; + + public IPdfDocument Document { get; private set; } + + public PageRangeForm(IPdfDocument document) + { + _document = document; + + InitializeComponent(); + + _startPage.Text = "1"; + _endPage.Text = document.PageCount.ToString(); + } + + private void _acceptButton_Click(object sender, EventArgs e) + { + int startPage; + int endPage; + + if ( + !int.TryParse(_startPage.Text, out startPage) || + !int.TryParse(_endPage.Text, out endPage) || + startPage < 1 || + endPage > _document.PageCount || + startPage > endPage + ) + { + MessageBox.Show(this, "Invalid start/end page"); + } + else + { + Document = PdfRangeDocument.FromDocument(_document, startPage - 1, endPage - 1); + + DialogResult = DialogResult.OK; + } + } + } +} diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PageRangeForm.resx b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PageRangeForm.resx new file mode 100644 index 0000000000000000000000000000000000000000..5ea0895e324fa7a86681adc56938bad2f2367ba0 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PageRangeForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PdfRangeDocument.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PdfRangeDocument.cs new file mode 100644 index 0000000000000000000000000000000000000000..c56f4010e3775b8cbbc08a514a98f4a3eb41fe62 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PdfRangeDocument.cs @@ -0,0 +1,303 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Printing; +using System.IO; +using System.Text; + +namespace PdfiumViewer.Demo +{ + public class PdfRangeDocument : IPdfDocument + { + public static PdfRangeDocument FromDocument(IPdfDocument document, int startPage, int endPage) + { + if (document == null) + throw new ArgumentNullException(nameof(document)); + + if (endPage < startPage) + throw new ArgumentException("End page cannot be less than start page"); + if (startPage < 0) + throw new ArgumentException("Start page cannot be less than zero"); + if (endPage >= document.PageCount) + throw new ArgumentException("End page cannot be more than the number of pages in the document"); + + return new PdfRangeDocument( + document, + startPage, + endPage + ); + } + + private readonly IPdfDocument _document; + private readonly int _startPage; + private readonly int _endPage; + private PdfBookmarkCollection _bookmarks; + private IList _sizes; + + private PdfRangeDocument(IPdfDocument document, int startPage, int endPage) + { + _document = document; + _startPage = startPage; + _endPage = endPage; + } + + public int PageCount + { + get { return _endPage - _startPage + 1; } + } + + public PdfBookmarkCollection Bookmarks + { + get + { + if (_bookmarks == null) + _bookmarks = TranslateBookmarks(_document.Bookmarks); + return _bookmarks; + } + } + + private PdfBookmarkCollection TranslateBookmarks(PdfBookmarkCollection bookmarks) + { + var result = new PdfBookmarkCollection(); + + TranslateBookmarks(result, bookmarks); + + return result; + } + + private void TranslateBookmarks(PdfBookmarkCollection result, PdfBookmarkCollection bookmarks) + { + foreach (var bookmark in bookmarks) + { + if (bookmark.PageIndex >= _startPage && bookmark.PageIndex <= _endPage) + { + var resultBookmark = new PdfBookmark + { + PageIndex = bookmark.PageIndex - _startPage, + Title = bookmark.Title + }; + + TranslateBookmarks(resultBookmark.Children, bookmark.Children); + + result.Add(resultBookmark); + } + } + } + + public IList PageSizes + { + get + { + if (_sizes == null) + _sizes = TranslateSizes(_document.PageSizes); + return _sizes; + } + } + + private IList TranslateSizes(IList pageSizes) + { + var result = new List(); + + for (int i = _startPage; i <= _endPage; i++) + { + result.Add(pageSizes[i]); + } + + return result; + } + + public void Render(int page, Graphics graphics, float dpiX, float dpiY, Rectangle bounds, bool forPrinting) + { + _document.Render(TranslatePage(page), graphics, dpiX, dpiY, bounds, forPrinting); + } + + public void Render(int page, Graphics graphics, float dpiX, float dpiY, Rectangle bounds, PdfRenderFlags flags) + { + _document.Render(TranslatePage(page), graphics, dpiX, dpiY, bounds, flags); + } + + public Image Render(int page, float dpiX, float dpiY, bool forPrinting) + { + return _document.Render(TranslatePage(page), dpiX, dpiY, forPrinting); + } + + public Image Render(int page, float dpiX, float dpiY, PdfRenderFlags flags) + { + return _document.Render(TranslatePage(page), dpiX, dpiY, flags); + } + + public Image Render(int page, int width, int height, float dpiX, float dpiY, bool forPrinting) + { + return _document.Render(TranslatePage(page), width, height, dpiX, dpiY, forPrinting); + } + + public Image Render(int page, int width, int height, float dpiX, float dpiY, PdfRenderFlags flags) + { + return _document.Render(TranslatePage(page), width, height, dpiX, dpiY, flags); + } + + public Image Render(int page, int width, int height, float dpiX, float dpiY, PdfRotation rotate, PdfRenderFlags flags) + { + return _document.Render(page, width, height, dpiX, dpiY, rotate, flags); + } + + public void Save(string path) + { + _document.Save(path); + } + + public void Save(Stream stream) + { + _document.Save(stream); + } + + public PdfMatches Search(string text, bool matchCase, bool wholeWord) + { + return TranslateMatches(_document.Search(text, matchCase, wholeWord)); + } + + public PdfMatches Search(string text, bool matchCase, bool wholeWord, int page) + { + return TranslateMatches(_document.Search(text, matchCase, wholeWord, page)); + } + + public PdfMatches Search(string text, bool matchCase, bool wholeWord, int startPage, int endPage) + { + return TranslateMatches(_document.Search(text, matchCase, wholeWord, startPage, endPage)); + } + + private PdfMatches TranslateMatches(PdfMatches search) + { + if (search == null) + return null; + + var matches = new List(); + + foreach (var match in search.Items) + { + matches.Add(new PdfMatch( + match.Text, + new PdfTextSpan(match.TextSpan.Page + _startPage, match.TextSpan.Offset, match.TextSpan.Length), + match.Page + _startPage + )); + } + + return new PdfMatches( + search.StartPage + _startPage, + search.EndPage + _startPage, + matches + ); + } + + public PrintDocument CreatePrintDocument() + { + return _document.CreatePrintDocument(); + } + + public PrintDocument CreatePrintDocument(PdfPrintMode printMode) + { + return _document.CreatePrintDocument(printMode); + } + + public PrintDocument CreatePrintDocument(PdfPrintSettings settings) + { + return _document.CreatePrintDocument(settings); + } + + public PdfPageLinks GetPageLinks(int pageNumber, Size pageSize) + { + return TranslateLinks(_document.GetPageLinks(pageNumber + _startPage, pageSize)); + } + + private PdfPageLinks TranslateLinks(PdfPageLinks pageLinks) + { + if (pageLinks == null) + return null; + + var links = new List(); + + foreach (var link in pageLinks.Links) + { + links.Add(new PdfPageLink( + link.Bounds, + link.TargetPage + _startPage, + link.Uri + )); + } + + return new PdfPageLinks(links); + } + + public void DeletePage(int pageNumber) + { + _document.DeletePage(TranslatePage(pageNumber)); + } + + public void RotatePage(int pageNumber, PdfRotation rotation) + { + _document.RotatePage(TranslatePage(pageNumber), rotation); + } + + public PdfInformation GetInformation() + { + return _document.GetInformation(); + } + + public string GetPdfText(int page) + { + return _document.GetPdfText(TranslatePage(page)); + } + + public string GetPdfText(PdfTextSpan textSpan) + { + return _document.GetPdfText(textSpan); + } + + public IList GetTextBounds(PdfTextSpan textSpan) + { + var result = new List(); + + foreach (var rectangle in _document.GetTextBounds(textSpan)) + { + result.Add(new PdfRectangle( + rectangle.Page + _startPage, + rectangle.Bounds + )); + } + + return result; + } + + public PointF PointToPdf(int page, Point point) + { + return _document.PointToPdf(TranslatePage(page), point); + } + + public Point PointFromPdf(int page, PointF point) + { + return _document.PointFromPdf(TranslatePage(page), point); + } + + public RectangleF RectangleToPdf(int page, Rectangle rect) + { + return _document.RectangleToPdf(TranslatePage(page), rect); + } + + public Rectangle RectangleFromPdf(int page, RectangleF rect) + { + return _document.RectangleFromPdf(TranslatePage(page), rect); + } + + private int TranslatePage(int page) + { + if (page < 0 || page >= PageCount) + throw new ArgumentException("Page number out of range"); + return page + _startPage; + } + + public void Dispose() + { + _document.Dispose(); + } + } +} diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PdfiumViewer.Demo.csproj b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PdfiumViewer.Demo.csproj new file mode 100644 index 0000000000000000000000000000000000000000..b878a3d8a1112c48902d483aec51b7433d2cc70d --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PdfiumViewer.Demo.csproj @@ -0,0 +1,181 @@ + + + + + + Debug + x86 + 8.0.30703 + 2.0 + {ADD131F6-17EB-4E42-932F-74CBE6DBEEB3} + WinExe + Properties + PdfiumViewer.Demo + PdfiumViewer.Demo + v4.6.1 + 512 + + + + + + true + bin\Debug\ + DEBUG;TRACE + full + AnyCPU + prompt + MinimumRecommendedRules.ruleset + false + + + bin\Release\ + TRACE + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + false + + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + false + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + false + + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + prompt + MinimumRecommendedRules.ruleset + false + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + false + + + + + + + + + + + + Form + + + ExportBitmapsForm.cs + + + Form + + + MainForm.cs + + + Form + + + PageRangeForm.cs + + + + Form + + + PrintMultiplePagesForm.cs + + + + + Form + + + SearchForm.cs + + + ExportBitmapsForm.cs + + + MainForm.cs + + + PageRangeForm.cs + + + PrintMultiplePagesForm.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SearchForm.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {438914b6-5d1c-482c-b942-5c0e057eef6f} + PdfiumViewer + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PrintMultiplePagesForm.Designer.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PrintMultiplePagesForm.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..63c2e44b276aec7ee4a9c70e95eeece55513ddd2 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PrintMultiplePagesForm.Designer.cs @@ -0,0 +1,199 @@ +namespace PdfiumViewer.Demo +{ + partial class PrintMultiplePagesForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this._horizontal = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this._vertical = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this._margin = new System.Windows.Forms.TextBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this._horizontalOrientation = new System.Windows.Forms.RadioButton(); + this._verticalOrientation = new System.Windows.Forms.RadioButton(); + this._acceptButton = new System.Windows.Forms.Button(); + this._cancelButton = new System.Windows.Forms.Button(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 15); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(57, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Horizontal:"; + // + // _horizontal + // + this._horizontal.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._horizontal.Location = new System.Drawing.Point(86, 12); + this._horizontal.Name = "_horizontal"; + this._horizontal.Size = new System.Drawing.Size(308, 20); + this._horizontal.TabIndex = 1; + this._horizontal.Text = "2"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 41); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(45, 13); + this.label2.TabIndex = 2; + this.label2.Text = "Vertical:"; + // + // _vertical + // + this._vertical.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._vertical.Location = new System.Drawing.Point(86, 38); + this._vertical.Name = "_vertical"; + this._vertical.Size = new System.Drawing.Size(308, 20); + this._vertical.TabIndex = 3; + this._vertical.Text = "2"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(12, 67); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(42, 13); + this.label3.TabIndex = 4; + this.label3.Text = "Margin:"; + // + // _margin + // + this._margin.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._margin.Location = new System.Drawing.Point(86, 64); + this._margin.Name = "_margin"; + this._margin.Size = new System.Drawing.Size(308, 20); + this._margin.TabIndex = 5; + this._margin.Text = "5"; + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this._verticalOrientation); + this.groupBox1.Controls.Add(this._horizontalOrientation); + this.groupBox1.Location = new System.Drawing.Point(86, 90); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(308, 70); + this.groupBox1.TabIndex = 6; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Orientation"; + // + // _horizontalOrientation + // + this._horizontalOrientation.AutoSize = true; + this._horizontalOrientation.Checked = true; + this._horizontalOrientation.Location = new System.Drawing.Point(13, 20); + this._horizontalOrientation.Name = "_horizontalOrientation"; + this._horizontalOrientation.Size = new System.Drawing.Size(72, 17); + this._horizontalOrientation.TabIndex = 0; + this._horizontalOrientation.TabStop = true; + this._horizontalOrientation.Text = "Horizontal"; + this._horizontalOrientation.UseVisualStyleBackColor = true; + // + // _verticalOrientation + // + this._verticalOrientation.AutoSize = true; + this._verticalOrientation.Location = new System.Drawing.Point(13, 43); + this._verticalOrientation.Name = "_verticalOrientation"; + this._verticalOrientation.Size = new System.Drawing.Size(60, 17); + this._verticalOrientation.TabIndex = 1; + this._verticalOrientation.Text = "Vertical"; + this._verticalOrientation.UseVisualStyleBackColor = true; + // + // _acceptButton + // + this._acceptButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this._acceptButton.Location = new System.Drawing.Point(238, 172); + this._acceptButton.Name = "_acceptButton"; + this._acceptButton.Size = new System.Drawing.Size(75, 23); + this._acceptButton.TabIndex = 7; + this._acceptButton.Text = "Print"; + this._acceptButton.UseVisualStyleBackColor = true; + this._acceptButton.Click += new System.EventHandler(this._acceptButton_Click); + // + // _cancelButton + // + this._cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this._cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this._cancelButton.Location = new System.Drawing.Point(319, 172); + this._cancelButton.Name = "_cancelButton"; + this._cancelButton.Size = new System.Drawing.Size(75, 23); + this._cancelButton.TabIndex = 8; + this._cancelButton.Text = "Cancel"; + this._cancelButton.UseVisualStyleBackColor = true; + // + // PrintMultiplePagesForm + // + this.AcceptButton = this._acceptButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this._cancelButton; + this.ClientSize = new System.Drawing.Size(406, 207); + this.Controls.Add(this._cancelButton); + this.Controls.Add(this._acceptButton); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this._margin); + this.Controls.Add(this._vertical); + this.Controls.Add(this._horizontal); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Name = "PrintMultiplePagesForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Print Multiple Pages"; + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox _horizontal; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox _vertical; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox _margin; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.RadioButton _verticalOrientation; + private System.Windows.Forms.RadioButton _horizontalOrientation; + private System.Windows.Forms.Button _acceptButton; + private System.Windows.Forms.Button _cancelButton; + } +} \ No newline at end of file diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PrintMultiplePagesForm.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PrintMultiplePagesForm.cs new file mode 100644 index 0000000000000000000000000000000000000000..809a3a3e64bdb53f33d4ac7a89890f9c75aa62d5 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PrintMultiplePagesForm.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace PdfiumViewer.Demo +{ + public partial class PrintMultiplePagesForm : Form + { + private readonly PdfViewer _viewer; + + public PrintMultiplePagesForm(PdfViewer viewer) + { + if (viewer == null) + throw new ArgumentNullException(nameof(viewer)); + + _viewer = viewer; + + InitializeComponent(); + } + + private void _acceptButton_Click(object sender, EventArgs e) + { + int horizontal; + int vertical; + float margin; + + if (!int.TryParse(_horizontal.Text, out horizontal)) + { + MessageBox.Show(this, "Invalid horizontal"); + } + else if (!int.TryParse(_vertical.Text, out vertical)) + { + MessageBox.Show(this, "Invalid vertical"); + } + else if (!float.TryParse(_margin.Text, out margin)) + { + MessageBox.Show(this, "Invalid margin"); + } + else + { + var settings = new PdfPrintSettings( + _viewer.DefaultPrintMode, + new PdfPrintMultiplePages( + horizontal, + vertical, + _horizontalOrientation.Checked ? Orientation.Horizontal : Orientation.Vertical, + margin + ) + ); + + using (var form = new PrintPreviewDialog()) + { + form.Document = _viewer.Document.CreatePrintDocument(settings); + form.ShowDialog(this); + } + + DialogResult = DialogResult.OK; + } + } + } +} diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PrintMultiplePagesForm.resx b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PrintMultiplePagesForm.resx new file mode 100644 index 0000000000000000000000000000000000000000..5ea0895e324fa7a86681adc56938bad2f2367ba0 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/PrintMultiplePagesForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/Program.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/Program.cs new file mode 100644 index 0000000000000000000000000000000000000000..2a86074b8f746a816de532452bd972e942d74dfb --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/Program.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Forms; + +namespace PdfiumViewer.Demo +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new MainForm()); + } + } +} diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/Properties/AssemblyInfo.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000000000000000000000000000000..138c6a33b1aff31cca1e562414c16073a6a0e5e3 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("PdfViewer.Demo")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Pieter van Ginkel")] +[assembly: AssemblyProduct("PdfViewer.Demo")] +[assembly: AssemblyCopyright("Pieter van Ginkel © 2012-2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: CLSCompliant(true)] +[assembly: ComVisible(false)] + +[assembly: Guid("975b4cd9-0202-4b28-80a6-faac73629152")] + +[assembly: AssemblyVersion("2.11.0.0")] +[assembly: AssemblyFileVersion("2.11.0.0")] diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/Properties/Resources.Designer.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/Properties/Resources.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..021a7fb971eda7b95bcc9f20f17b82de69230179 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// このコードはツールによって生成されました。 +// ランタイム バージョン:4.0.30319.42000 +// +// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 +// コードが再生成されるときに損失したりします。 +// +//------------------------------------------------------------------------------ + +namespace PdfiumViewer.Demo.Properties { + using System; + + + /// + /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。 + /// + // このクラスは StronglyTypedResourceBuilder クラスが ResGen + // または Visual Studio のようなツールを使用して自動生成されました。 + // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に + // ResGen を実行し直すか、または VS プロジェクトをビルドし直します。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PdfiumViewer.Demo.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// すべてについて、現在のスレッドの CurrentUICulture プロパティをオーバーライドします + /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/Properties/Resources.resx b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/Properties/Resources.resx new file mode 100644 index 0000000000000000000000000000000000000000..ffecec851ab4deae63e81647b4655c7d1fe6dfd7 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/Properties/Settings.Designer.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/Properties/Settings.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..332fa2a4f800455ef7bbbd1a9e8e2d2d5f4e3cb0 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// このコードはツールによって生成されました。 +// ランタイム バージョン:4.0.30319.42000 +// +// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 +// コードが再生成されるときに損失したりします。 +// +//------------------------------------------------------------------------------ + +namespace PdfiumViewer.Demo.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/Properties/Settings.settings b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/Properties/Settings.settings new file mode 100644 index 0000000000000000000000000000000000000000..abf36c5d3d7a33baabb780c9dffef3d804ceb62f --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/SearchForm.Designer.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/SearchForm.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..eb293624c1e772bb60920a58584af1531c8248f2 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/SearchForm.Designer.cs @@ -0,0 +1,145 @@ +namespace PdfiumViewer.Demo +{ + partial class SearchForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this._find = new System.Windows.Forms.TextBox(); + this._matchCase = new System.Windows.Forms.CheckBox(); + this._matchWholeWord = new System.Windows.Forms.CheckBox(); + this._highlightAll = new System.Windows.Forms.CheckBox(); + this._findPrevious = new System.Windows.Forms.Button(); + this._findNext = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 15); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(30, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Find:"; + // + // _find + // + this._find.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._find.Location = new System.Drawing.Point(65, 12); + this._find.Name = "_find"; + this._find.Size = new System.Drawing.Size(321, 20); + this._find.TabIndex = 1; + this._find.TextChanged += new System.EventHandler(this._find_TextChanged); + // + // _matchCase + // + this._matchCase.AutoSize = true; + this._matchCase.Location = new System.Drawing.Point(65, 38); + this._matchCase.Name = "_matchCase"; + this._matchCase.Size = new System.Drawing.Size(82, 17); + this._matchCase.TabIndex = 2; + this._matchCase.Text = "Match case"; + this._matchCase.UseVisualStyleBackColor = true; + this._matchCase.CheckedChanged += new System.EventHandler(this._matchCase_CheckedChanged); + // + // _matchWholeWord + // + this._matchWholeWord.AutoSize = true; + this._matchWholeWord.Location = new System.Drawing.Point(65, 61); + this._matchWholeWord.Name = "_matchWholeWord"; + this._matchWholeWord.Size = new System.Drawing.Size(113, 17); + this._matchWholeWord.TabIndex = 3; + this._matchWholeWord.Text = "Match whole word"; + this._matchWholeWord.UseVisualStyleBackColor = true; + this._matchWholeWord.CheckedChanged += new System.EventHandler(this._matchWholeWord_CheckedChanged); + // + // _highlightAll + // + this._highlightAll.AutoSize = true; + this._highlightAll.Location = new System.Drawing.Point(65, 84); + this._highlightAll.Name = "_highlightAll"; + this._highlightAll.Size = new System.Drawing.Size(123, 17); + this._highlightAll.TabIndex = 4; + this._highlightAll.Text = "Highlight all matches"; + this._highlightAll.UseVisualStyleBackColor = true; + this._highlightAll.CheckedChanged += new System.EventHandler(this._highlightAll_CheckedChanged); + // + // _findPrevious + // + this._findPrevious.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this._findPrevious.Location = new System.Drawing.Point(186, 115); + this._findPrevious.Name = "_findPrevious"; + this._findPrevious.Size = new System.Drawing.Size(97, 23); + this._findPrevious.TabIndex = 5; + this._findPrevious.Text = "Find &Previous"; + this._findPrevious.UseVisualStyleBackColor = true; + this._findPrevious.Click += new System.EventHandler(this._findPrevious_Click); + // + // _findNext + // + this._findNext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this._findNext.Location = new System.Drawing.Point(289, 115); + this._findNext.Name = "_findNext"; + this._findNext.Size = new System.Drawing.Size(97, 23); + this._findNext.TabIndex = 6; + this._findNext.Text = "Find &Next"; + this._findNext.UseVisualStyleBackColor = true; + this._findNext.Click += new System.EventHandler(this._findNext_Click); + // + // SearchForm + // + this.AcceptButton = this._findNext; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(398, 150); + this.Controls.Add(this._findNext); + this.Controls.Add(this._findPrevious); + this.Controls.Add(this._highlightAll); + this.Controls.Add(this._matchWholeWord); + this.Controls.Add(this._matchCase); + this.Controls.Add(this._find); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "SearchForm"; + this.Text = "Search"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox _find; + private System.Windows.Forms.CheckBox _matchCase; + private System.Windows.Forms.CheckBox _matchWholeWord; + private System.Windows.Forms.CheckBox _highlightAll; + private System.Windows.Forms.Button _findPrevious; + private System.Windows.Forms.Button _findNext; + } +} \ No newline at end of file diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/SearchForm.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/SearchForm.cs new file mode 100644 index 0000000000000000000000000000000000000000..8a4ed930170d4f637d3483fc6a44b4eeca1f5775 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/SearchForm.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace PdfiumViewer.Demo +{ + public partial class SearchForm : Form + { + private readonly PdfSearchManager _searchManager; + private bool _findDirty; + + public SearchForm(PdfRenderer renderer) + { + if (renderer == null) + throw new ArgumentNullException(nameof(renderer)); + + InitializeComponent(); + + _searchManager = new PdfSearchManager(renderer); + + _matchCase.Checked = _searchManager.MatchCase; + _matchWholeWord.Checked = _searchManager.MatchWholeWord; + _highlightAll.Checked = _searchManager.HighlightAllMatches; + } + + private void _matchCase_CheckedChanged(object sender, EventArgs e) + { + _findDirty = true; + _searchManager.MatchCase = _matchCase.Checked; + } + + private void _matchWholeWord_CheckedChanged(object sender, EventArgs e) + { + _findDirty = true; + _searchManager.MatchWholeWord = _matchWholeWord.Checked; + } + + private void _highlightAll_CheckedChanged(object sender, EventArgs e) + { + _searchManager.HighlightAllMatches = _highlightAll.Checked; + } + + private void _find_TextChanged(object sender, EventArgs e) + { + _findDirty = true; + } + + private void _findPrevious_Click(object sender, EventArgs e) + { + Find(false); + } + + private void _findNext_Click(object sender, EventArgs e) + { + Find(true); + } + + private void Find(bool forward) + { + if (_findDirty) + { + _findDirty = false; + + if (!_searchManager.Search(_find.Text)) + { + MessageBox.Show(this, "No matches found."); + return; + } + } + + if (!_searchManager.FindNext(forward)) + MessageBox.Show(this, "Find reached the starting point of the search."); + } + } +} diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/SearchForm.resx b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/SearchForm.resx new file mode 100644 index 0000000000000000000000000000000000000000..5ea0895e324fa7a86681adc56938bad2f2367ba0 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/SearchForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/app.config b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/app.config new file mode 100644 index 0000000000000000000000000000000000000000..d40509835204c28996481b33fdbf3aee87bf3141 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/app.config @@ -0,0 +1,3 @@ + + + diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/packages.config b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/packages.config new file mode 100644 index 0000000000000000000000000000000000000000..60ebdc94003b7196fcbe527a7e963a80e5c1402c --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Demo/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Test/.gitignore b/root/cli/PdfiumViewer-master/PdfiumViewer.Test/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..10714b4d2a33e9a66572c72605f0f48c187accae --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Test/.gitignore @@ -0,0 +1,4 @@ +/*.suo +/*.user +/bin +/obj diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Test/Example1.pdf b/root/cli/PdfiumViewer-master/PdfiumViewer.Test/Example1.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ed00f5918b2b89b0931bee78b6d2471a9c44b691 Binary files /dev/null and b/root/cli/PdfiumViewer-master/PdfiumViewer.Test/Example1.pdf differ diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Test/Example2.pdf b/root/cli/PdfiumViewer-master/PdfiumViewer.Test/Example2.pdf new file mode 100644 index 0000000000000000000000000000000000000000..1e6a94561523a4d90967ae6efaa7b6b3785fc47e Binary files /dev/null and b/root/cli/PdfiumViewer-master/PdfiumViewer.Test/Example2.pdf differ diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Test/MultiAppDomainFixture.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.Test/MultiAppDomainFixture.cs new file mode 100644 index 0000000000000000000000000000000000000000..567c6d39b15c1a0717f32f7b15343fcca29222cd --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Test/MultiAppDomainFixture.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using NUnit.Framework; + +namespace PdfiumViewer.Test +{ + [TestFixture] + public class MultiAppDomainFixture + { + [Test] + public void MultipleAppDomains() + { + RunThreads(); + } + + [Test] + public void MultipleAppDomainsAndCurrent() + { + using (var runner = new Runner()) + { + runner.Run(); + + RunThreads(); + } + } + + private void RunThreads() + { + const int scripts = 10; + const int iterations = 20; + var threads = new List(); + + for (int i = 0; i < scripts; i++) + { + var thread = new Thread(() => + { + try + { + for (int j = 0; j < iterations; j++) + { + using (var runner = new Runner()) + { + runner.Run(); + } + } + } + catch (Exception ex) + { + Console.WriteLine(ex); + Console.WriteLine(ex.StackTrace); + } + }); + + threads.Add(thread); + thread.Start(); + } + + foreach (var thread in threads) + { + thread.Join(); + } + } + + private class Script : MarshalByRefObject + { + public void Run() + { + using (var stream = typeof(MultiAppDomainFixture).Assembly.GetManifestResourceStream( + typeof(MultiAppDomainFixture).Namespace + ".Example" + (new Random().Next(2) + 1) + ".pdf" + )) + { + var document = PdfDocument.Load(stream); + + for (int i = 0; i < document.PageCount; i++) + { + using (document.Render(i, 96, 96, false)) + { + } + } + } + } + } + + private class Runner : IDisposable + { + private bool _disposed; + private AppDomain _appDomain; + + public Runner() + { + _appDomain = AppDomain.CreateDomain( + "Unit test", + AppDomain.CurrentDomain.Evidence, + new AppDomainSetup + { + ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase, + ApplicationName = "Unit test" + } + ); + } + + public void Run() + { + var script = (Script)_appDomain.CreateInstanceAndUnwrap( + typeof(Script).Assembly.FullName, + typeof(Script).FullName + ); + + script.Run(); + } + + public void Dispose() + { + if (!_disposed) + { + if (_appDomain != null) + { + AppDomain.Unload(_appDomain); + _appDomain = null; + } + + _disposed = true; + } + } + } + } +} diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Test/PdfiumViewer.Test.csproj b/root/cli/PdfiumViewer-master/PdfiumViewer.Test/PdfiumViewer.Test.csproj new file mode 100644 index 0000000000000000000000000000000000000000..c10d65d8245b7d1b17addc3c930238fcbf35e5a9 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Test/PdfiumViewer.Test.csproj @@ -0,0 +1,68 @@ + + + + + Debug + AnyCPU + {61083268-3F14-47B7-8753-AF69BB3D0891} + Library + Properties + PdfiumViewer.Test + PdfiumViewer.Test + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\NUnit.2.6.4\lib\nunit.framework.dll + + + + + + + + + + + + + + + + + {438914b6-5d1c-482c-b942-5c0e057eef6f} + PdfiumViewer + + + + + + + + + + \ No newline at end of file diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Test/Properties/AssemblyInfo.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.Test/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000000000000000000000000000000..61930bccba60252fe7154888ca8c77124f27a455 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Test/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("PdfiumViewer.Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("PdfiumViewer.Test")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6593d801-664d-4848-bcde-1602ba7b4908")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.Test/packages.config b/root/cli/PdfiumViewer-master/PdfiumViewer.Test/packages.config new file mode 100644 index 0000000000000000000000000000000000000000..512ce05d0dbf09ee1683a56c8cc1d3049c9b9f7f --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.Test/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.WPFDemo/.gitignore b/root/cli/PdfiumViewer-master/PdfiumViewer.WPFDemo/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..3b43a2fd5a19ebfc5514160d784aae8c5ad71309 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.WPFDemo/.gitignore @@ -0,0 +1,5 @@ +/*.suo +/*.user +/bin +/obj +/*.nupkg diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.WPFDemo/App.config b/root/cli/PdfiumViewer-master/PdfiumViewer.WPFDemo/App.config new file mode 100644 index 0000000000000000000000000000000000000000..8e15646352ec1d9a84bbc6504ef6b46e16bf7823 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.WPFDemo/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.WPFDemo/App.xaml b/root/cli/PdfiumViewer-master/PdfiumViewer.WPFDemo/App.xaml new file mode 100644 index 0000000000000000000000000000000000000000..8a3d80c3c1205cb4cda9feeadb0db2f9346d01b8 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.WPFDemo/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.WPFDemo/App.xaml.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.WPFDemo/App.xaml.cs new file mode 100644 index 0000000000000000000000000000000000000000..39b2cc8ae09c78796633f9fe7b0631b20ff55cfc --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.WPFDemo/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace PdfiumViewer.WPFDemo +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.WPFDemo/BitmapHelper.cs b/root/cli/PdfiumViewer-master/PdfiumViewer.WPFDemo/BitmapHelper.cs new file mode 100644 index 0000000000000000000000000000000000000000..94d9991b0f5b6cd628c611bcb3a0a76d5f37aeb6 --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.WPFDemo/BitmapHelper.cs @@ -0,0 +1,57 @@ +using System; +using System.Windows.Media.Imaging; +using System.Drawing; +using System.Windows.Media; + +namespace PdfiumViewer.WPFDemo +{ + internal class BitmapHelper + { + + public static BitmapSource ToBitmapSource(Image image) + { + return ToBitmapSource(image as Bitmap); + } + + /// + /// Convert an IImage to a WPF BitmapSource. The result can be used in the Set Property of Image.Source + /// + /// The Source Bitmap + /// The equivalent BitmapSource + public static BitmapSource ToBitmapSource(System.Drawing.Bitmap bitmap) + { + if (bitmap == null) return null; + + using (System.Drawing.Bitmap source = (System.Drawing.Bitmap)bitmap.Clone()) + { + IntPtr ptr = source.GetHbitmap(); //obtain the Hbitmap + + BitmapSource bs = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( + ptr, + IntPtr.Zero, + System.Windows.Int32Rect.Empty, + System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()); + + NativeMethods.DeleteObject(ptr); //release the HBitmap + bs.Freeze(); + return bs; + } + } + + public static BitmapSource ToBitmapSource(byte[] bytes, int width, int height, int dpiX, int dpiY) + { + var result = BitmapSource.Create( + width, + height, + dpiX, + dpiY, + PixelFormats.Bgra32, + null /* palette */, + bytes, + width * 4 /* stride */); + result.Freeze(); + + return result; + } + } +} diff --git a/root/cli/PdfiumViewer-master/PdfiumViewer.WPFDemo/MainWindow.xaml b/root/cli/PdfiumViewer-master/PdfiumViewer.WPFDemo/MainWindow.xaml new file mode 100644 index 0000000000000000000000000000000000000000..924b81b1cde0056902bcabd8ca2327aadb6c85fa --- /dev/null +++ b/root/cli/PdfiumViewer-master/PdfiumViewer.WPFDemo/MainWindow.xaml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + +