arklumpus / mupdfcore Goto Github PK
View Code? Open in Web Editor NEWMultiplatform .NET bindings for MuPDF
License: GNU Affero General Public License v3.0
Multiplatform .NET bindings for MuPDF
License: GNU Affero General Public License v3.0
Do you support deleting pages
like SumatraPDF, the text part can be selected and copied. Any advice? :)
Hello, I am learning the knowledge of PDF.
I found that your project is great. I followed your instructions and successfully ran PDFViewerDemo on both Windows and Mac.
But under Linux, I got this error. I don’t know where the file "MuPDFWrapper" is. Is it the directory "\native\out\build\linux-x64\MuPDFWrapper"? I have this directory but still have this abnormal. There is also libMuPDFWrapper.so in my running directory.
Hi!
I am trying to use MuPDFCore in container with Alpina Linux, but it doesn't work.
Here ldd result:
/app/runtimes/linux-x64/native # ldd libMuPDFWrapper.so
/lib/ld-musl-x86_64.so.1 (0x7fafacb69000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7fafa9cdf000)
libm.so.6 => /lib/ld-musl-x86_64.so.1 (0x7fafacb69000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7fafa9cc1000)
libc.so.6 => /lib/ld-musl-x86_64.so.1 (0x7fafacb69000)
Error relocating libMuPDFWrapper.so: __isnan: symbol not found
Error relocating libMuPDFWrapper.so: __isinff: symbol not found
Error relocating libMuPDFWrapper.so: __finite: symbol not found
Error relocating libMuPDFWrapper.so: __isnanf: symbol not found
Error relocating libMuPDFWrapper.so: __isinf: symbol not found
Can you add linux-musl-x64 support?
Hello
I am trying this method, but how can I Increase or decrease the image quality?
MuPDFContext context = new MuPDFContext();
MuPDFDocument document = new MuPDFDocument(context, @"blankAI\test.pdf");
document.SaveImage(1, 1, PixelFormats.RGB, @"blankAI\0test.png", RasterOutputFileTypes.PNG);
I also tried some older demo when I changed width and height:(but it gets memory leaking errors )
for (int i = 0; i < document.Pages.Count; i++)
{
//Initialise the renderer for the current page, using two threads (total number of threads: number of pages x 2
renderers[i] = document.GetMultiThreadedRenderer(i, 2);
//Determine the boundaries of the page when it is rendered with a 1.5x zoom factor
RoundedRectangle roundedBounds = document.Pages[i].Bounds.Round(1);
renderedPageSizes[i] = new RoundedSize(roundedBounds.Width / 2, roundedBounds.Height / 2);
//Determine the boundaries of each tile by splitting the total size of the page by the number of threads.
tileBounds[i] = renderedPageSizes[i].Split(renderers[i].ThreadCount);
destinations[i] = new IntPtr[renderers[i].ThreadCount];
for (int j = 0; j < renderers[i].ThreadCount; j++)
{
//Allocate the required memory for the j-th tile of the i-th page.
//Since we will be rendering with a 24-bit-per-pixel format, the required memory in bytes is height x width x 3.
destinations[i][j] = System.Runtime.InteropServices.Marshal.AllocHGlobal(tileBounds[i][j].Height * tileBounds[i][j].Width * 3);
}
}
Hello, do you support reading encrypted PDF files?
Hi,
First, thanks for the effort put in this library, greatly appreciate it! 👍 :)
I more or less got it done but I am unsure I am doing it fully correctly or having the full picture.
At the moment I do not see a document.GetText as can be found in pymupdf lib, https://pymupdf.readthedocs.io/en/latest/app2.html#plain-text so what I did is:
iterate on all pages of a document to get the MuPdfStructuredTextPage(s).
From each, get the MuPDFStructuredTextBlocks
From each get the MuPdftext lines
and concatenate those in a big string if they are not null or empty/whitespace...
Is this correct? meaning the best way to do this... or is there a better way?
I assume this will provide a UTF-8 Unicode... right?
What happens with text that comes in other languages? will we get it with that encoding or should we do a conversion?
Also to do this properly, we should use the OCR functions over all images, to try to obtain the text from them... right?
When selecting text on a PDF, a background effect is drawn over the selected text. However, upon switching pages or opening another PDF, the previous selection effect isn't cleared.
I attempted to address this by adding this.Selection = null within the Initialize method after reviewing the source code. Unfortunately, this modification didn't produce the desired outcome.
Thank you once again for your efforts in providing us with such a valuable tool.
When I try to export PNG image from an PDF that contains an image in JPEG2000 format I receive the "JPX support disabled" error.
That indicates that the support for those files were explicitly disabled with the "FZ_ENABLE_JPX" header (since it's enabled by default).
I've build everything from sources with default config.h headers and the PDF's with JPEG2000 files works correctly.
Did you disable it explicitly? If yes what was the reason. And if it an omission is it possible for you to release the new version with FZ_ENABLE_JPX enabled?
Thanks in advance.
Hi,
I just added MuPDFCore 1.7 NuGet package to my project, but MuPDFCore.dll couldn't be loaded because of no strong name:
MuPDFCore, Version=1.7.0.0, Culture=neutral, PublicKeyToken=null
Is this an issue or was designed?
Should I need to build from source to add strong name?
Thanks!
Wicky Hu
as shown in the title.
deepl translator.
Please
I want to show pdf files continuously. Is it possible to do so now?
Looking forward to your reply,thanks
I was reviewing muPDF_explored and noticed that on page 136 the original C API's support TIFF output, which is what I am mainly looking for in my current project. However per line 184 of muPDF.cs it appears we only have an enum for a select set of these values, plus some not support in the original C API. is there a means in which to add in the TIFF format or other image formats into the .NET library?
Is there a way to support iOS and Mac Catalyst?
Hi!
Native MuPDF library has the ability to set how many bits of anti-aliasing to use (fz_set_aa_level). The default value is 8.
But MuPdfCore has no such parameter in the WriteImage method.
Please add it, because sometimes anti-aliasing messes up schemes and fonts.
Hi,
I am trying to build MuPdfWrapper.dll to x86 arch.
Build with success, but when CreateContext method is called in MuPdfCore, got System.AccessViolationException:“Attempted to read or write protected memory. This is often an indication that other memory is corrupt.”
I think my x86 version libmupdf.lib is invalid or version mismatch, which is compiled from https://github.com/ArtifexSoftware/mupdf , branch 1.18.x.
Hi, there is a bug in MuPDFPageCollection.GetEnumerator implemention.
public IEnumerator<MuPDFPage> GetEnumerator()
{
for (int i = 0; i < Pages.Length; i++)
{
if (Pages[i] == null)
{
Pages[i] = new MuPDFPage(OwnerContext, OwnerDocument, i);
}
}
return (IEnumerator<MuPDFPage>)Pages.GetEnumerator();
}
The type of Pages.GetEnumerator()
is SZArrayEnumerator
, it can not be cast to System.Collections.Generic.IEnumerator
.
Hello,
I am a newcomer to Avalonia and I am encountering an issue while trying to use the MuPDFRenderer control in my project. The MuPDFRenderer control works fine on Avalonia 0.10.* versions, but I am facing difficulties in getting it to work on Avalonia 11.
It seems that there might be some compatibility issues or changes introduced in Avalonia 11 that are affecting the functionality of the MuPDFRenderer control. As a beginner, I am not familiar with the internal structure and specific features of Avalonia, so I am uncertain about the steps needed to resolve this problem.
I would greatly appreciate any guidance or suggestions you can provide in order to successfully use the MuPDFRenderer control on Avalonia 11. If there are any specific configuration settings or code modifications required, please let me know.
Thank you for your time and assistance!
Best regards,
Hello, first of all let me say that this is a great library and especially the multithreaded render.
Is there somewhere on the roadmap the ability to expose an API with Span<byte>
instead of IntPtr
?
The reason is that in most of the cases, after rendering an e.g. PDF file, we have to either change the exported file format or perform some sort of image manipulation (with another library e.g. ImageSharp). Therefore, it would be beneficial to avoid marshalling memory back, holding twice the amount.
The only way I know to expose a Span<byte>
out of an IntPtr
is by going into unsafe
mode and casting IntPtr
to a void*
pointer but this would make my project require an /unsafe
build, which I was really hoping to avoid.
Do you have any ideas?
Thanks,
--Theodore
Hello. I released an app using MuPDF with windows forms .core 3.2. At my pc it worked fine, but on others it is saying that "Unable to load DLL MuPDFWrapper". Are there any dependencies besides core 3.2? Dll is right next to executable. I saw this (but see the note for .NET Framework). But it is telling about Framework not Core :) I guess it hasnt changed then(it worked when I installed that pack).
I get exceptions when trying to run the code
//Save the full page as a PNG image.
renderedPage.SaveAsPNG("page" + i.ToString() + ".png");
The code is taken from your readme, where you show how to convert PDF to png.
Actual exception
System.MissingMethodException: Method not found: 'Void MuPDFCore.MuPDFContext..ctor(Int64)'.
at VectSharp.Raster.Raster.SaveAsPNG(Page page, String fileName, Double scale)
at MuPDFWrapperCore.Program.Main(String[] args) in
Project .NET6 64bit.
Windows 10 x64 with vs2019, use the original source, when open a pdf or xps file, it fires MuPDFCore.MuPDFException:“Cannot open document” exception. Then I upgrade the related AVA and Mupdf package to the newest version, exception still there.
Hello, I am trying to install the library to a Blazor WebAssembly project in .NET 6.0, and I am getting the error of a missing MuPDFWrapper
dll.
Do you have any ideas?
edit: I need to mention that I even tried adding the library as a blazor native dependency (using NativeFileReference
) but the error persisted.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.