Skip to content
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

add_js results in "Incorrect first char in NameObject:" #1420

Closed
mike4420 opened this issue Nov 3, 2022 · 2 comments
Closed

add_js results in "Incorrect first char in NameObject:" #1420

mike4420 opened this issue Nov 3, 2022 · 2 comments

Comments

@mike4420
Copy link

mike4420 commented Nov 3, 2022

Replace this: What happened? What were you trying to achieve?

Environment

Which environment were you using when you encountered the problem?

$ python -m platform
Linux-5.19.0-kali2-amd64-x86_64-with-Kali-kali-rolling-kali-rolling

$ python -c "import PyPDF2;print(PyPDF2.__version__)"
2.11.1

Code + PDF

This is a minimal, complete example that shows the issue:

from PyPDF2 import PdfFileWriter
writer=PdfFileWriter()
writer.addBlankPage(width=200, height=200)
writer.add_js("this.print({bUI:true,bSilent:false,bShrinkToFit:true});")
with open("output.pdf", "wb") as output_stream:
	writer.write(output_stream)
$ ./genpdf.py 
Incorrect first char in NameObject:((this.print({bUI:true,bSilent:false,bShrinkToFit:true});))

Traceback

@pubpub-zz
Copy link
Collaborator

The text was wrongly inserted as a NameObject, fixed in PR #1431

pubpub-zz added a commit to pubpub-zz/pypdf that referenced this issue Nov 20, 2022
MartinThoma pushed a commit that referenced this issue Nov 20, 2022
@MartinThoma
Copy link
Member

Fixed by #1439

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants