Code Monkey home page Code Monkey logo

pdf_signing's People

Contributors

ralpha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pdf_signing's Issues

Signature user information is overridden by certificate information

When a document is signed by running the sign_doc.rs the information defined in the UserSignatureInfo struct is ignored by acrobat. Instead it takes user information from the certificate instead.

        UserSignatureInfo {
            user_id: "272".to_owned(),
            user_name: "Charlie".to_owned(),
            user_email: "[email protected]".to_owned(),
            user_signature: std::fs::read("./examples/assets/sig1.png").unwrap(),
            user_signing_keys: signer.clone(),
        }

Schermafbeelding 2022-08-10 om 13 48 18

Digital signatures not able to be verified by Adobe after adding the signature image

Currently there is an issue with this package that does not allow the signatures to be verified in Adobe after the image objects have been inserted into the document.

In the code after the graphics are inserted into the document the graphics state is restored:

content.operations.push(Operation::new("Q", vec![]));

Commenting out this line will result in a valid signed document with signature images embedded in the document. What is the purpose of this line and is it fine if we remove this?

add_image_to_form

Hi @ralpha

Thanks for this project its great. I am just trying it out now but not sure what data I am meant to be referencing with the form_id field.

 doc_new
      .add_signature_to_form(img.as_bytes(), "image", page_id, form_id)
      .unwrap();

I assume its a reference to a dictionary with the width, height etc values but not too sure.

Cheers,
Josh

Failed to select a version for the requirement `lopdf = "^0.27.0"`

Hi @ralpha ,
I have been trying to run your example after creating all required certs, unfortunately I'm getting this error.

error: failed to select a version for the requirement `lopdf = "^0.27.0"`
candidate versions found which didn't match: 0.29.0
location searched: Git repository https://github.com/J-F-Liu/lopdf?branch=master
required by package `pdf_signing v0.1.0 (/path/to/project/folder)`

I have tried to change lopdf version to 0.29.0, I'm getting the following errors.

error[E0631]: type mismatch in function arguments
   --> src/image_xobject.rs:172:73
    |
172 |         let bbox: lopdf::Object = Array(identity_matrix.into_iter().map(Real).collect());
    |                                                                     --- ^^^^
    |                                                                     |   |
    |                                                                     |   expected due to this
    |                                                                     |   found signature defined here
    |                                                                     required by a bound introduced by this call
    |
    = note: expected function signature `fn(f64) -> _`
               found function signature `fn(f32) -> _`
note: required by a bound in `map`
   --> /home/egovridc/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:779:12
    |
779 |         F: FnMut(Self::Item) -> B,
    |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`

error[E0599]: the method `collect` exists for struct `std::iter::Map<std::vec::IntoIter<f64>, fn(f32) -> lopdf::Object {lopdf::Object::Real}>`, but its trait bounds were not satisfied
   --> src/image_xobject.rs:172:79
    |
172 |         let bbox: lopdf::Object = Array(identity_matrix.into_iter().map(Real).collect());
    |                                                                               ^^^^^^^ method cannot be called on `std::iter::Map<std::vec::IntoIter<f64>, fn(f32) -> lopdf::Object {lopdf::Object::Real}>` due to unsatisfied trait bounds
    |
   ::: /home/egovridc/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:61:1
    |
61  | pub struct Map<I, F> {
    | -------------------- doesn't satisfy `_: Iterator`
    |
    = note: the following trait bounds were not satisfied:
            `<fn(f32) -> lopdf::Object {lopdf::Object::Real} as FnOnce<(f64,)>>::Output = _`
            which is required by `std::iter::Map<std::vec::IntoIter<f64>, fn(f32) -> lopdf::Object {lopdf::Object::Real}>: Iterator`
            `fn(f32) -> lopdf::Object {lopdf::Object::Real}: FnMut<(f64,)>`
            which is required by `std::iter::Map<std::vec::IntoIter<f64>, fn(f32) -> lopdf::Object {lopdf::Object::Real}>: Iterator`
            `std::iter::Map<std::vec::IntoIter<f64>, fn(f32) -> lopdf::Object {lopdf::Object::Real}>: Iterator`
            which is required by `&mut std::iter::Map<std::vec::IntoIter<f64>, fn(f32) -> lopdf::Object {lopdf::Object::Real}>: Iterator`

error[E0599]: no method named `as_f64` found for enum `lopdf::Object` in the current scope
   --> src/signature_image.rs:134:47
    |
134 | ...                   x1: child_rect[0].as_f64()?,
    |                                         ^^^^^^ help: there is an associated function with a similar name: `as_i64`

error[E0599]: no method named `as_f64` found for enum `lopdf::Object` in the current scope
   --> src/signature_image.rs:135:47
    |
135 | ...                   y1: child_rect[1].as_f64()?,
    |                                         ^^^^^^ help: there is an associated function with a similar name: `as_i64`

error[E0599]: no method named `as_f64` found for enum `lopdf::Object` in the current scope
   --> src/signature_image.rs:136:47
    |
136 | ...                   x2: child_rect[2].as_f64()?,
    |                                         ^^^^^^ help: there is an associated function with a similar name: `as_i64`

error[E0599]: no method named `as_f64` found for enum `lopdf::Object` in the current scope
   --> src/signature_image.rs:137:47
    |
137 | ...                   y2: child_rect[3].as_f64()?,
    |                                         ^^^^^^ help: there is an associated function with a similar name: `as_i64`

Some errors have detailed explanations: E0599, E0631.
For more information about an error, try `rustc --explain E0599`.
error: could not compile `pdf_signing` due to 6 previous errors

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.