logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

New Topic Post Reply
Options
Go to last post Go to first unread
oberon232  
#1 Posted : Monday, March 4, 2019 12:59:20 PM(UTC)
Quote
oberon232

Rank: Newbie

Groups: Registered
Joined: 2/23/2019(UTC)
Posts: 6
United States
Location: FL

Thanks: 1 times
I have modified a PDF by adding a comment.
When I try to save using PdfViewer1.Document.Save(Enums.SaveFlags.NoIncremental), the comments don't save.
When I try to save using PdfViewer1.Document.Save(CurrentFile,Enums.SaveFlags.NoIncremental), an error returns that the file is in use.
When I try to save using PdfViewer1.Document.Save(NewFile,Enums.SaveFlags.NoIncremental), it saves to the new file.
My question, is there an option I need to set to either at save or load to be able to save changes to a PDF?
oberon232  
#2 Posted : Monday, March 4, 2019 4:35:31 PM(UTC)
Quote
oberon232

Rank: Newbie

Groups: Registered
Joined: 2/23/2019(UTC)
Posts: 6
United States
Location: FL

Thanks: 1 times
I worked around it, by reading the file in to a byte array and loading that as the document, that way there was no file lock on save.
Paul Rayman  
#3 Posted : Monday, March 4, 2019 9:48:06 PM(UTC)
Quote
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Hi,

PdfViewer1.Document.Save(Enums.SaveFlags.NoIncremental)
This is saving in a custom way. When you call this method, the engine fires the PdfDocument.WriteBlock event and pass to the handler the data to being save. So you can save document in any way you want.

PdfViewer1.Document.Save(CurrentFile,Enums.SaveFlags.NoIncremental)
You cant to save the changes to the same file.
This is worth some explanation. Probably you noticed how even a very large PDF document with hundreds thousands of pages loads very fast. This becomes possible because there is not need to parse and load the entire document body. At first, only the cross-reference table is read and all the rest of data is loaded when needed. So the file is locked for write. You can't simultaneously read an object and write an another.
So you should implement an workaround. You can save to in memory byte array or to a temporary file, nex close original document and replace it with the saved copy.
Quick Reply Show Quick Reply
Users browsing this topic
Guest
New Topic Post Reply
Forum Jump  
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.