GithubHelp home page GithubHelp logo

reliak / moonpdf Goto Github PK

View Code? Open in Web Editor NEW
188.0 188.0 91.0 12.49 MB

Contains a WPF control for displaying PDF files and a sample PDF viewer, that uses this control

License: GNU General Public License v3.0

C# 1.27% C 59.91% C++ 31.19% Objective-C 0.25% Python 2.03% Shell 1.00% Assembly 4.24% JavaScript 0.09% R 0.01%

moonpdf's People

Contributors

lukamicoder avatar reliak avatar stokara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

moonpdf's Issues

Can't build solution

Hi I'm trying to build the solution with Visual Studio 2017 and .NET 4.6

At first I got error message regarding the headertemplate.json (Code 9009) and then I just removed everything from the build events.

After that I got another series of errors from the MoonPDF project when I tried again to build the solution:

  • PageMargin, ViewType, PageRowDisplay unkown
  • MenuItemExtensions doesn't exist in clr-namespace:MoonPDF

Can somebody help me?

ZoomToFit

Why there is no ZoomToFit Method ?

If the width is greater than height , call ZoomToWidth , otherwise ZoomToHeight .

Is possible to add this method ?

How to add license declaraction to my own program

Hello

how to add license.txt for using this repository: moonpdf

The license declaration as following shows:

Copyright (C) 2020  zhangdonglin12

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program.  If not, see <http://www.gnu.org/licenses/>.

Am I right to using this declaration for my program ?

Looking forward for your reply. Thanks .

Source different from binaries to github

The source contained in this repository is different from the source where the code requests that we download the binaries from, i.e. on sourceforge at https://sourceforge.net/projects/moonpdf/files/. Which should be considered the latest source? Specifically for one example, the PdfLoaded event is FileLoaded at sourceforge. I'm not sure if there are other changes.

From sourceforge source for MoonPdfPanel.xaml.cs

            if (this.FileLoaded != null)
                this.FileLoaded(this, EventArgs.Empty);

From github

            if (this.PdfLoaded != null)
                this.PdfLoaded(this, EventArgs.Empty);

App crashes during opening of a corrupted PDF file - Attempted to read or write protected memory

When I try to load some corrupted pdf file, app crashes with an exception:

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

at MoonPdfLib.MuPdf.MuPdfWrapper.NativeMethods.CountPages(IntPtr doc)
at MoonPdfLib.MuPdf.MuPdfWrapper.GetPageBounds(IPdfSource source, ImageRotation rotation, String password) at MoonPdfLib.MoonPdfPanel.LoadPdf(IPdfSource source, String password)
at MoonPdfLib.MoonPdfPanel.Open(IPdfSource source, String password)
at MoonPdfLib.MoonPdfPanel.OpenFile(String pdfFilename, String password)

app crashes

It happens not often, but sometimes my app crashes on calling fz_run_page with System.AccessViolationException.
I cannot re-produce it, it happens occasionally on my client installations.

I guess the crashes are caused by the pinned but immediately un-pinned memory:

            public PdfFileStream(IPdfSource source)
            {
                if (source is FileSource)
                {
                    var fs = (FileSource)source;
                    Context = NativeMethods.NewContext(IntPtr.Zero, IntPtr.Zero, FZ_STORE_DEFAULT); // Creates the context
                    Stream = NativeMethods.OpenFile(Context, fs.Filename); // opens file as a stream
                    Document = NativeMethods.OpenDocumentStream(Context, ".pdf", Stream); // opens the document
                }
                else if (source is MemorySource)
                {
                    var ms = (MemorySource)source;
                    Context = NativeMethods.NewContext(IntPtr.Zero, IntPtr.Zero, FZ_STORE_DEFAULT); // Creates the context
                    GCHandle pinnedArray = GCHandle.Alloc(ms.Bytes, GCHandleType.Pinned);
                    IntPtr pointer = pinnedArray.AddrOfPinnedObject();
                    Stream = NativeMethods.OpenStream(Context, pointer, ms.Bytes.Length); // opens file as a stream
                    Document = NativeMethods.OpenDocumentStream(Context, ".pdf", Stream); // opens the document
                    pinnedArray.Free();
                }
}

I think pinnedArray must be an instance variable, and pinnedArray.Free() called in Dispose(), so the memory cannot get moved around by the garbage collector.

Out of Memory exception when scrolling large PDFs

If you open a large and long (>250 pages) PDF, maximize the window, set zoom to fit width, grab the scroll bar and start to pull it down, not too slow nor too fast, you will get this error: "An unhandled exception of type 'System.OutOfMemoryException' occurred in PresentationCore.dll" at line 36 of BitmapExtensionMethods.cs.

NullReferenceException when i call OpenFile method

Hi, a have a couples of issues regarding the OpenFile method calls, i create my component like this:

image

After that i call this method:

image

When the route of PDF on my computer and gives me NullReferenceException

Can you help me with this? Thanks!

didnt add libmupdf.dll

i tried but i couldnt add dll.it give this error
a reference to could not be added. please make sure that the file is accessible ...

How can i solve this problem

For load pdf

which code is used for load pdf file?.. It want for learning purpose..

Enable pinch zoom for touch devices

I am requesting if its possible to add pinch zoom for touch screen devices like a in a browser. My testing devices is a tecno winpad running windows 10 x86

Error running build-all.msbuild in "VS Command Prompt 2010"

Hi
When i ran build-all.msbuild in "VS Command Prompt 2010",i got the following error:

LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or
corrupt [D:\Projects\z_Samples\1.WPF\PDF_Word\moonpdf\moonpdf-master\build-all.
msbuild]
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.
0\VC\BIN\link.exe"' : return code '0x463' [D:\Projects\z_Samples\1.WPF\PDF_Word
\moonpdf\moonpdf-master\build-all.msbuild]
  Stop.
D:\Projects\z_Samples\1.WPF\PDF_Word\moonpdf\moonpdf-master\build-all.msbuild(1
7,3): error MSB3073: The command "nmake -f makefile-mupdf.msvc platform=X86" ex
ited with code 2.
Done Building Project "D:\Projects\z_Samples\1.WPF\PDF_Word\moonpdf\moonpdf-mas
ter\build-all.msbuild" (default targets) -- FAILED.

How can i resolve this issue?

OpenFile throws 'System.DllNotFoundException'

I call OpenFile on the MoonPdfPanel and get the following exception:

An exception of type 'System.DllNotFoundException' occurred in MoonPdfLib.dll but was not handled in user code

Message

Det gick inte att läsa in DLL-filen libmupdf.dll: Det går inte att hitta den angivna modulen. (Undantag från HRESULT: 0x8007007E)

Stack Trace

   vid MoonPdfLib.MuPdf.MuPdfWrapper.NativeMethods.NewContext(IntPtr alloc, IntPtr locks, UInt32 max_store)
   vid MoonPdfLib.MuPdf.MuPdfWrapper.PdfFileStream..ctor(IPdfSource source)
   vid MoonPdfLib.MuPdf.MuPdfWrapper.GetPageBounds(IPdfSource source, ImageRotation rotation, String password)
   vid MoonPdfLib.MoonPdfPanel.LoadPdf(IPdfSource source, String password)
   vid MoonPdfLib.MoonPdfPanel.Open(IPdfSource source, String password)
   vid MoonPdfLib.MoonPdfPanel.OpenFile(String pdfFilename, String password)

I am using Nuget package version 0.3.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.