jung-kurt / gofpdf

A PDF document generator with high level support for text, drawing and images
http://godoc.org/github.com/jung-kurt/gofpdf
MIT License
4.32k stars 780 forks source link

different hashes for the same file #226

Closed FrankIT60 closed 5 years ago

FrankIT60 commented 5 years ago

Hello,

Even if I always create the same file I get different hashes. I think that a timestamp or similar mechanism is inserted during the creation of the file. In case it would be possible to configure this as an option?

For example it would be useful if you want to reproduce a document and be sure it is the same as the original.

Thanks Franco

jung-kurt commented 5 years ago

I think that a timestamp or similar mechanism is inserted during the creation of the file.

You are right, the document creation timestamp is recorded internally. Also, internal catalogs are generated from go maps in which the keys are not ordered by default. See SetDefaultCreationDate and SetDefaultCatalogSort to accomplish your goal. See the standard example initialization function for an example of their use. Also, see ComparePDFs and ComparePDFFiles for comparing PDFs.

jung-kurt commented 5 years ago

Please reopen if the timestamp and catalog functions shown above don't solve your problem.