PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Sep 01, 2024 4:20 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Wed Aug 07, 2024 8:36 am 
Offline

Joined: Wed Aug 07, 2024 8:20 am
Posts: 3
Dear Supportor,

I am writing to seek your assistance regarding using PDFsharp.

I am currently facing the following challenges:encrypt a pdf file with AES256. Despite my best efforts, I have been unable to find a satisfactory solution on my own. Therefore, I humbly request your help in providing some insights or advice on how to address this matter effectively.

I find that when I encrypt a pdf file ,in the first line there is written a text [%PDF-2.0],and in the secornd line also a text[%ÓôÌá].
Can i use some method to rewrite these text in my own?

Thank you very much for considering my request. Your support and expertise would make a significant difference in resolving this matter.
I look forward to hearing from you soon.

Best regards


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 07, 2024 9:07 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 971
Location: CCAA
Neyo2024 wrote:
I find that when I encrypt a pdf file ,in the first line there is written a text [%PDF-2.0],and in the secornd line also a text[%ÓôÌá].
Can i use some method to rewrite these text in my own?
The text is valid. Why would you want to replace it?

With PDFsharp you can set the PDF version. This determines the number in the first line.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 08, 2024 7:35 am 
Offline

Joined: Wed Aug 07, 2024 8:20 am
Posts: 3
Thank you for your time and replay.

Quote:
The text is valid. Why would you want to replace it?

→Yes,I check the source code and it's just as you say, but in my case the pdf file has some text in the first line already.
when use PDFsharp to encrypt file with AES ,the first line text was replace by the [%PDF-2.0],and also the secondary
line was replace by the text [%ÓôÌá].To keep the pdf file the same after encrypted is needed.

Quote:
With PDFsharp you can set the PDF version. This determines the number in the first line.

→Thank you for your reminder.Yes , I know.

If there is some way can keep the pdf file not to be replaced, just call me thank you!

Best regards


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 08, 2024 8:49 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 971
Location: CCAA
Neyo2024 wrote:
Yes,I check the source code and it's just as you say, but in my case the pdf file has some text in the first line already.
when use PDFsharp to encrypt file with AES ,the first line text was replace by the [%PDF-2.0],and also the secondary
line was replace by the text [%ÓôÌá].To keep the pdf file the same after encrypted is needed.
Does that mean there are comments in the PDF file and you want to retain the comments while encrypting the file with PDFsharp?

Maybe this can be achieved by reading the lines to keep from the original file and adding them to the encrypted file while performing the encryption. Not my area of expertise and I am not sure if this can be done without modifying PDFsharp.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 09, 2024 7:29 am 
Offline

Joined: Wed Aug 07, 2024 8:20 am
Posts: 3
Quote:
Does that mean there are comments in the PDF file and you want to retain the comments while encrypting the file with PDFsharp?

→Sorry for my poor English make you something confused.Yes,as you said I just want to retain the comments while encrypting the file.
And in other way ,If it is possible to rewrite the comments in the header after encrypting the file is also OK.

Thank you for your time and reply again .
And at last I want to ask that Maybe PDFsharp Team has plans to provide an interface to do the things that I mentioned above in the future ?

Best regards


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 09, 2024 9:03 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 971
Location: CCAA
Neyo2024 wrote:
And at last I want to ask that Maybe PDFsharp Team has plans to provide an interface to do the things that I mentioned above in the future?
There are no plans to implement this.
I'm afraid it won't be considered for implementation in the foreseeable future. Unless someone gives us strong reasons why this is necessary.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 102 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group