-
Notifications
You must be signed in to change notification settings - Fork 239
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
Digital signature #243
base: master
Are you sure you want to change the base?
Digital signature #243
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #243 +/- ##
=========================================
Coverage ? 26.07%
=========================================
Files ? 244
Lines ? 23645
Branches ? 2833
=========================================
Hits ? 6165
Misses ? 16984
Partials ? 496 ☔ View full report in Codecov by Sentry. |
Are you sure this works? For me, Adobe Reader validates the signature OK, but in the place of the visible signature I got an empty rectangle. |
I'm not 100% sure, its some time ago i did this. At the end we did not need that feature so i stopped and archived this MR as a starting point for somebody else. In the issue i have referenced the places where i did take the code parts from. In general i am not 100% sure if this approach is the right way to do it anyway, as it is very invasive (see description above). So feel free to hack on this and improve it :-) Have you seen |
Thanks for your reply! Yes, I'm fiddling with SignatureTestConsole, I've just added my own certificate. If this had worked for you, I must have messed up something... |
@mmmilan @pamapa Its not visible because PdfSharpCore/PdfSharpCore/Drawing/XForm.cs Line 178 in 8b9076c
It also doesn't work in If you change SignatureTestConsole to target .NET 6 specifically, and also go add the following implementation of internal virtual void Finish()
{
if (_formState == FormState.NotATemplate || _formState == FormState.Finished)
return;
Debug.Assert(_formState == FormState.Created || _formState == FormState.UnderConstruction);
_formState = FormState.Finished;
Gfx.Dispose();
Gfx = null;
if (PdfRenderer != null)
{
//pdfForm.CreateStream(PdfEncoders.RawEncoding.GetBytes(PdfRenderer.GetContent()));
PdfRenderer.Close();
Debug.Assert(PdfRenderer == null);
if (_document.Options.CompressContentStreams)
{
_pdfForm.Stream.Value = Filtering.FlateDecode.Encode(_pdfForm.Stream.Value, _document.Options.FlateEncodeMode);
_pdfForm.Elements["/Filter"] = new PdfName("/FlateDecode");
}
int length = _pdfForm.Stream.Length;
_pdfForm.Elements.SetInteger("/Length", length);
}
} |
It works! Thank you! |
@ascott18 nice work |
part of #237
I am not so sure if the taken approach is the right way to:
PdfItem.WriteObject
vsPdfItem.Write
seems error proneWe current do not need to sign PDFs for our project, therefore i am not investing time for this feature.
In order somebody else wants to work on this, i am pushing my changes on a draft branch. This branch is not intended to be merged like it is now...