PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Failed to modify metadata for password protected pdf file.
https://forum.pdfsharp.net/viewtopic.php?f=2&t=4404
Page 1 of 1

Author:  qsaddam [ Thu Dec 08, 2022 4:46 pm ]
Post subject:  Failed to modify metadata for password protected pdf file.

Hi,
PDFSharp Version : PDFsharp v1.5 beta 5
Tried to modify metadata of protected pdf file below but an exception thrown "Header checksum illegal".
Code:
        private void UpdateDefaultMetadeta_Click(string path, string password)
        {
            string path = filePathTextBox.Text;
            if(!File.Exists(path)) return;
            PdfDocument document = PdfReader.Open(path, password, PdfDocumentOpenMode.Modify, PdfPasswordProvider);//PdfReader.Open(path,PdfDocumentOpenMode.Modify, PdfPasswordProvider);
            document.Info.Author = "Sharp 1";
            document.Info.Creator = "Sharp 2";
            document.Info.Title = "Sharp 3";
            document.Info.CreationDate = DateTime.Today;
            document.Info.Keywords = "Sharp 4";
            document.Info.ModificationDate = DateTime.Today;
            document.Info.Subject = "Sharp 5";
            //document.Info.Producer = "Sharp 6";
            //document.Save("Result");
            document.Save(path);
        }

Exception stack Trace detail:
at PdfSharp.SharpZipLib.Zip.Compression.Inflater.DecodeHeader() in d:\SD_Codes\PDFSharp\PDFsharp-POC\PDFsharp\src\PdfSharp\SharpZipLib\Zip\Compression\Inflater.cs:line 255
at PdfSharp.SharpZipLib.Zip.Compression.Inflater.Decode() in d:\SD_Codes\PDFSharp\PDFsharp-POC\PDFsharp\src\PdfSharp\SharpZipLib\Zip\Compression\Inflater.cs:line 465
at PdfSharp.SharpZipLib.Zip.Compression.Inflater.Inflate(Byte[] buffer, Int32 offset, Int32 count) in d:\SD_Codes\PDFSharp\PDFsharp-POC\PDFsharp\src\PdfSharp\SharpZipLib\Zip\Compression\Inflater.cs:line 813
at PdfSharp.SharpZipLib.Zip.Compression.Streams.InflaterInputStream.Read(Byte[] buffer, Int32 offset, Int32 count) in d:\SD_Codes\PDFSharp\PDFsharp-POC\PDFsharp\src\PdfSharp\SharpZipLib\Zip\Compression\Streams\InflaterInputStream.cs:line 743
at PdfSharp.Pdf.Filters.FlateDecode.Decode(Byte[] data, FilterParms parms) in d:\SD_Codes\PDFSharp\PDFsharp-POC\PDFsharp\src\PdfSharp\Pdf.Filters\FlateDecode.cs:line 196
at PdfSharp.Pdf.Filters.Filter.Decode(Byte[] data) in d:\SD_Codes\PDFSharp\PDFsharp-POC\PDFsharp\src\PdfSharp\Pdf.Filters\Filter.cs:line 73
at PdfSharp.Pdf.Filters.Filtering.Decode(Byte[] data, PdfItem filterItem) in d:\SD_Codes\PDFSharp\PDFsharp-POC\PDFsharp\src\PdfSharp\Pdf.Filters\Filtering.cs:line 208
at PdfSharp.Pdf.PdfDictionary.PdfStream.TryUnfilter() in d:\SD_Codes\PDFSharp\PDFsharp-POC\PDFsharp\src\PdfSharp\Pdf\PdfDictionary.cs:line 1738
at PdfSharp.Pdf.Advanced.PdfObjectStream..ctor(PdfDictionary dict) in d:\SD_Codes\PDFSharp\PDFsharp-POC\PDFsharp\src\PdfSharp\Pdf.Advanced\PdfObjectStream.cs:line 67
at PdfSharp.Pdf.IO.Parser.ReadIRefsFromCompressedObject(PdfObjectID objectID) in d:\SD_Codes\PDFSharp\PDFsharp-POC\PDFsharp\src\PdfSharp\Pdf.IO\Parser.cs:line 840
----------------------------------------------------------------
We used password protected pdf file, encryption type: RC4 (128 bit).
Kindly help to improve this issue.

Thank in advance.

Author:  () => true [ Thu Dec 08, 2022 4:54 pm ]
Post subject:  Re: Failed to modify metadata for password protected pdf fil

Hi!
qsaddam wrote:
We used password protected pdf file, encryption type: RC4 (128 bit).
We don't have that PDF.

We have created Issue Submission Templates for both PDFsharp and MigraDoc.
See also:
http://forum.pdfsharp.net/viewtopic.php?f=2&t=832

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/