-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System.ArgumentOutOfRangeException: Non-negative number required on PDFs larger than two gigabyte #72
Comments
In the beginning there was PDFsharp. Then there was a partial port to Xamarin which was partially ported to .NET Core giving PdfSharpCore. Sometimes it is difficult to take bug fixes or improvements from PdfSharpCore back into PDFsharp. The PR looks quite simple and if you create a PR against the current PDFsharp 6.1.0 Preview 1 it will be quite simple for us to make the changes. I cannot promise they will be included, but if they have no impact on speed then I think they will be used. |
Thank you very much for your fast response! And PdfSharpCore is still maintained by empira or did ststeiger this on his own by copy not by fork? As for the change PR: That should be created in this repository here or what do you mean by "PR against the current PDFsharp 6.1.0 Preview 1"? I would prepare a PR in the following days then :D |
Hi May I ask for feedback on my PR and some help maybe? |
PdfSharpCore is not and was never maintained by empira. Support for files larger 2 GiB will be included with the next preview of PDFsharp 6.1.0 coming this month or so. |
Originally posted by @StLange in #76 (comment) I will test this in the following weeks and close the issue if everything is working as expected. |
Hi Thank you again for your time and effort! The new package is now implemented and it seems to work now as expected! Also nice to be mentioned indirectly in the docs, had a laugh reading that xD Only thing that I am not sure about at the moment is the TODO comment on this line: PDFsharp/src/foundation/src/PDFsharp/src/PdfSharp/Pdf.IO/enums/PdfDocumentOpenMode.cs Line 35 in 3fb4e9e
I tried opening the file with this mode and I at least got the metadata out of it.. using var pdf = PdfReader.Open(_pathConverter.ConvertForLocalUsage(fileInfo.FullPath), PdfDocumentOpenMode.Import);
var pdfVersion = $"{pdf.Version / 10}.{pdf.Version % 10}";
var pdfSize = pdf.FileSize;
.
.
foreach (var page in pdf.Pages)
{
using var cachePdfMemoryStream = new MemoryStream();
using var cachePdf = new PdfDocument();
cachePdf.AddPage(page);
cachePdf.Save(cachePdfMemoryStream);
.
. |
My implementation works now with a little workaround Thx for the help! |
Hello!
While doing some research on my error I stumbled opon this in the repository https://github.com/ststeiger/PdfSharpCore/
This issue is going to be an exact clone of ststeiger/PdfSharpCore#193
Like mentioned in the linked issue, I would also need to process files that are larger than 2GB..
Yea its unusual I agree but that should not be the main discussion point please..
Currently I have the package PDFsharpNetStandard2 installed, that is quite old and its needed to be replaced..
I want to replace it with PdfSharpCore or with this library here PdfSharp..
As stated in already in ststeiger/PdfSharpCore#403 (comment)
I am standing in front of the decision of the package it should be for the future in production code..
It also seems like the code is more or less a fork of each other but I am confused about it.. like do both parties know the other one exists? can there be a cooperation between the packages? Or even a merge?
After looking through this repository I found out that the fix for large files is not yet applied here.. To me thats a blocker to use PdfSharp in production code..
There is a pr where this is fixed in the other library: ststeiger/PdfSharpCore#227
It would be nice to know if this is a possible implementation here, if so I would also be able to open this pr here..
Maybe even adjust it a little because why even bother with negative values in the position value anyway? why not use ulong because the position should never be negative or am I wrong there?
Hoping for help here, I would also work on the pr if thats helpful!
Have a nice day folks!
The text was updated successfully, but these errors were encountered: