Skip to content

pdfcpu crashes if no fontID is specified in textbox #630

@henrixapp

Description

@henrixapp

Hi,

I am using pdfcpu (latest version from GitHub cloned) on a Mac to fill a PDF with some textboxes (later via API in an application).

If I add content to one of the fields, pdfcpu crashes:

writing out.pdf...
unexpected panic attack: runtime error: slice bounds out of range [1:0]

exit status 1

The slice in question is in this line and selecting a fontID. When I provide a default value like

fontID = "Helv"
if len(da[i-2]) > 1 {
	fontID = da[i-2][1:]
}

the pdf is filled successfully.

It would be great if pdfcpu would either give a better error message (like PDF is corrupt with no fontID) or have a default behavior (with warning).

Thanks for this awesome project!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions