jbaarssen / pdflibcore Goto Github PK
View Code? Open in Web Editor NEWPdfLib CORE is a fast PDF editing and reading library for modern .NET Core applications.
License: MIT License
PdfLib CORE is a fast PDF editing and reading library for modern .NET Core applications.
License: MIT License
We get this when we're doing release builds for our Xamarin.Forms UWP app.
C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.2.12-rel-31116-00\tools\Microsoft.NetNative.targets(809,5): error : MCG0037: MCG0037:InvalidCSharpIdentifierName Struct 'PdfLibCore.Types.FS_RECTF' in assembly 'Assembly(Name=PdfLibCore, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null, Location=D:\...\ilc\in\PdfLibCore.dll)' has a field with name '<Left>k__BackingField' that is invalid. This could be because the name is obfuscated or the field is auto-implemented by the compiler. Please make sure the field name follows C# identifier conventions.
This might have some insight on how to fix the issue but I'm unclear how it would apply to PdfLibCore:
https://developercommunity.visualstudio.com/t/cant-build-release-code-mcg0037invalidcsharpidenti/526363#T-N529127
Thanks!
PdfLibCore/src/PdfLibCore/PdfPage.cs
Line 79 in 981ed44
should be
Pdfium.FPDF_RenderPageBitmap(renderTarget.Handle, Handle, rectDest.left, rectDest.top, rectDest.width, rectDest.height, orientation, flags);
in the PdfLibCore/src/ExampleApp/Program.cs :
//SaveToJpeg(bitmap.AsBmpStream(196D, 196D), Path.Combine(destination, $"{i++}.jpeg"));
I cannot find bitmap.AsBmpStream method.
using (var ms = new MemoryStream())
{
img.Save(ms, ImageFormat.Jpeg);
}
By default, storage is done with 96 dpi and the quality is not good. How can I change this default to 150 or 200 Dpi to experience better quality?
In my WPF applicationn when I render PDF to image, I often have a crash :
PdfLibCore.PdfiumException: Tentative de lecture ou d'écriture de mémoire protégée. Cela indique souvent qu'une autre mémoire est endommagée. ---> System.AccessViolationException: Tentative de lecture ou d'écriture de mémoire protégée. Cela indique souvent qu'une autre mémoire est endommagée.
à PdfLibCore.Pdfium.PlatformInvoke.FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page, Int32 start_x, Int32 start_y, Int32 size_x, Int32 size_y, PageOrientations rotate, RenderingFlags flags)
à PdfLibCore.Pdfium.FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page, Int32 start_x, Int32 start_y, Int32 size_x, Int32 size_y, PageOrientations rotate, RenderingFlags flags)
For rendering, I use PdfiumBitmap :
var bitmap = new PdfiumBitmap(width, height, true);
pdfPage.Render(bitmap, pdfPage.Orientation, RenderingFlags.LcdText);
The crash occurs in Pdfium.cs, line 928 :
lock (Pdfium._lock)
{
try
{
Pdfium.PlatformInvoke.FPDF_RenderPageBitmap(bitmap, page, start_x, start_y, size_x, size_y, rotate, flags);
}
catch (AccessViolationException ex)
{
throw new PdfiumException((Exception) ex);
}
}
I tried to use the PdfCore library in a .NET MAUI App, and it worked only on Windows.
On Android and iOS the pdfium library is missing.
I tried to add the pdfium-binaries NuGet packages for iOS and Android in the PdfCore library but with no luck.
Can you help on this?
Hi, I have a simple avalonia window where I load a multi page pdf and provide some simple navigation. I only show one page at a time so there's a button to load the next/previous page.
However after a few clicks to the next page I crash with a:
System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'
from: pdfPage.Render(bitmap, PageOrientations.Normal, RenderingFlags.LcdText);
I'm using the newest 2.4 version of the plugin.
Hello
When I import the package using nuget, I will get a warning when compiling the project
MSB3270: The generated project's processor architecture "MSIL" does not match the processor architecture "AMD64" referencing PdfLibCore.dll". This mismatch may cause runtime failures. Consider changing your project's The target processor architecture to align the processor architecture between your project and the reference, or associate a reference with a processor architecture that matches your project's target processor architecture
targetFramework: net6, aspnetcore webapi
Please how should I handle this warning
Looking forward to your reply
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.