PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Nov 13, 2018 5:05 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Flattening a PDF doc
PostPosted: Sat May 28, 2016 12:23 am 
Offline

Joined: Sat May 28, 2016 12:20 am
Posts: 2
Using PDF Sharp, i was able to parse over 600 records into multiple billing statements but when I open the PDF it shows blue areas where the data is - thus clicking on field will reveal the data.

I suspect what I need to do is flatten and or disable the fields the document before saving it.

I'm sure PDFSharp has this but I'm not seeing it..


Top
 Profile  
Reply with quote  
 Post subject: Re: Flattening a PDF doc
PostPosted: Mon Jun 13, 2016 5:34 pm 
Offline

Joined: Tue Sep 30, 2014 12:29 pm
Posts: 19
I recently made some progress implementing this in v1.32 of PdfSharp and merged the changes into the 1.50 version
(please see attached .patch file)

As it works "OK" in v1.32, i had no chance to test this with 1.50, so consider this "experimental".
But it should give you something to start with...

Usage is pretty simple:

Code:
var doc = PdfReader.Open("myForm.pdf", PdfDocumentOpenMode.Modify);
if (doc.AcroForm != null)
    doc.AcroForm.Flatten();   // NOTE: doc.AcroForm is null after flattening !


Attachments:
File comment: PdfSharp 1.50 patch file
FormFlattening.zip [9.56 KiB]
Downloaded 263 times
Top
 Profile  
Reply with quote  
 Post subject: Re: Flattening a PDF doc
PostPosted: Mon Jun 13, 2016 8:57 pm 
Offline

Joined: Sat May 28, 2016 12:20 am
Posts: 2
Thank you - how is this patch applied via Visual Studio?

(void) wrote:
I recently made some progress implementing this in v1.32 of PdfSharp and merged the changes into the 1.50 version
(please see attached .patch file)

As it works "OK" in v1.32, i had no chance to test this with 1.50, so consider this "experimental".
But it should give you something to start with...

Usage is pretty simple:

Code:
var doc = PdfReader.Open("myForm.pdf", PdfDocumentOpenMode.Modify);
if (doc.AcroForm != null)
    doc.AcroForm.Flatten();   // NOTE: doc.AcroForm is null after flattening !


Top
 Profile  
Reply with quote  
 Post subject: Re: Flattening a PDF doc
PostPosted: Tue Jun 14, 2016 9:12 am 
Offline

Joined: Tue Sep 30, 2014 12:29 pm
Posts: 19
The patch was created with Tortoise SVN.
I recommend installing Tortoise SVN and create a local repository.
Import PdfSharp to your repository and then check it out, so the files are versioned.

In the directory, where you have checked-out PdfSharp, navigate to the Folder where you find the Solution file. (*.sln)
Right-click in Windows Explorer, go to the "Tortoise SVN" Menu and select "Apply patch".
Select the attached patch file.

https://tortoisesvn.net/docs/release/To ... patch.html

For further information, please consult the Tortoise SVN Documentation.


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 6 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