Rank: Newbie
Groups: Registered
Joined: 2/23/2019(UTC) Posts: 6  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?
|
|
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 2/23/2019(UTC) Posts: 6  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.
|
|
|
|
|
|
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.
|
|
|
|
|
|
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.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close