Comments (4)
I can confirm this happens with some files but have not been able to identify the cause yet.
from pdfsign.
Signing fails if the document has more than one xref
table (revisions).
from pdfsign.
This item count includes all objects of the document:
Line 32 in 4fb6faf
But only the (latest?) xref
table entries are included in the xref
new table.
Using the correct count for the xref
does not seem to fix the problem.
Adding a new referencing xref
table instead of including all items from the last table seems to be a cleaner approach but has not resulted in any success for now.
The ReaderXrefInformation
only contains information about the entire document and probably needs to be updated to contain information about each xref
table or stream:
https://github.com/digitorus/pdf/blob/master/read.go#L92
from pdfsign.
This code at the writeXrefTable function makes the trick, but it probably is not the best option:
func (context *SignContext) writeXrefTable() error {
context.InputFile.Seek(context.PDFReader.XrefInformation.StartPos, 0)
scanner := bufio.NewScanner(context.InputFile)
scanner.Split(bufio.ScanWords)
scanner.Scan() // This should be xref string
scanner.Scan()
first_object_id := scanner.Text()
scanner.Scan()
xref_items := scanner.Text()
xref_items_i, _ := strconv.Atoi(xref_items)
xref_size := fmt.Sprintf("xref\n%s %s\n", first_object_id, xref_items)
new_xref_size := fmt.Sprintf("xref\n%s %s\n", first_object_id, fmt.Sprint(xref_items_i+4))
...
}
from pdfsign.
Related Issues (10)
- output empty pdf, any ideas? HOT 3
- Signing a PDF with attachment results in a signed PDF without attachment HOT 5
- Error encoding UTF-8 characters HOT 4
- Visual signature support HOT 5
- "Signature is not LTV enabled" HOT 12
- Should the revocation.RevocationData expire? HOT 5
- Supplier of QES key/certificate HOT 1
- Invisible signature HOT 2
- The default SignatureMaxLengthBase is too short, should be increased HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdfsign.