-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding a warnings
member to the Fpdf
struct
#44
Comments
(apologies for the belated answer: a fine mix of holidays and a backlog at work) is this the sole instance of such an error ? because in this instance, the error should actually be raised iff the pdfVersion we are generating is < |
Hi @sbinet , It's the only case I've encountered but of course, you're in a better position to say whether there are other, similar cases:) I can see that
That would address the case in question, as I said, I leave to you to say whether this should occur in other places as well. Cheers, PS |
AFAICT (not being the original author of the package) the I can't think of a use case where one would want an explicit version. (but I am open to counter examples.) |
Could you please create a tag that includes this change (the last tag was created in April and there were some changes this fix relies on since)? I'll be happy to test once you do. |
@jessp01 done: |
Works as expected:) Cheers, |
Hi all,
First of all, excellent project.
The reason for raising this is that some issues encountered during processing are not fatal and generating the doc in spite of them may be worthwhile. For example, consider https://github.com/go-pdf/fpdf/blob/main/png.go#L57 (I bring it as an example because I've actually encountered it):
With my input, if I simply change the code to print the error rather than assign it to
f.err
, I get the image in the generated PDF doc. You can easily reproduce this with the below command but I'm also attaching the resulting PDF to this issue:gg.pdf
But, because in
mdtopdf
we callOutputFileAndClose()
, which returns immediately ifif f.err != nil
, no doc is generated.My suggestion is to add a
warnings
string array to theFpdf
struct, populate it when encountering non-fatal errors (instead of assigning them to theerr
member) and print these inOutputFileAndClose()
, rather than give up and return without generating the file.If you find this acceptable, I'm happy to submit a pull request.
Cheers,
The text was updated successfully, but these errors were encountered: