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
Error when saving a pdf containing only an embedPng #307
Comments
@jwoodrow What exactly is the error you're encountering? Can you share the error message and stacktrace? |
@Hopding Completely forgot the stack trace my bad !
EDIT:
|
I use |
I traced the error down to this line in default: {
throw new Error(`Invalid filter algorithm: ${data[pos - 1]}`);
} https://github.com/Hopding/png-ts/blob/master/src/png.ts#L302
It looks like at the time I forked Or, alternatively, it might be better to switch to a different library entirely. For example, I'll work on this as soon as I have time. But it may be several days before I do. If anybody would like to work on this sooner, I'm happy to answer questions. I haven't dug into this any further than I've shared above, but my initial inclination is to swap out |
Hi @Hopding, thanks for looking into this and you are perfectly correct file problematic_file.png
# => problematic_file.png: PNG image data, 750 x 1334, 16-bit/color RGBA, interlaced In the meantime I'll try and use a library to detect interlaced images and modify them (user's of my project should not be using interlaced images in the first place so I'll dress this issue beforehand) and once the png library has been changed I'll undo this tweak so I can use |
@jwoodrow Just wanted to update you on this. Today I finished swapping out Are you able to share any of the images you ran into trouble with? I'd like to include them in my test suite. Or at least test them on my new branch to make sure it will resolve the issue for you. |
When i use pdf-lib@1.3.2, i get this error
|
Hi @Hopding,
I've encountered a strange issue when using pdf-lib to "convert" images to PDF in my project. Usually this works fine but for one specific image I'm getting an error in my
pdf.save()
catch
method.Here is my code which converts an input file to a pdf file (stored at
newFile
)Here's some extra context in case:
file
is an object structured as suchimageDimesionToFit
is used to make an image scale to fit inside the A4 page if it is too wide or too high and looks like thisSince this is a professional project and this is happening on a clients' file I would prefer sending you this file privately if possible/needed (hopefully I'm not using
pdf-lib
in a wrong way haha)The text was updated successfully, but these errors were encountered: