Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
There is an issue with the handling of the output parameter in the transform_pdf function of pdf_merge.py. | GoodFirstPicks

There is an issue with the handling of the output parameter in the transform_pdf function of pdf_merge.py.

frappe/frappe 0 comments 1mo ago
View on GitHub
lowopenScope: clearSkill match: yesFrappe / ERPNextPython

Why this is a good first issue

The issue involves a straightforward logic fix in a single function.

AI Summary

The issue identifies a logical error in the transform_pdf function where it incorrectly returns the body instead of the output parameter when both header and footer are absent. The fix requires modifying the return logic to consistently handle the output parameter. There are no apparent blockers or complex dependencies.

Issue Description

Description of the issue

Context information (for bug reports)

Output of bench version

erpnext 16.0.0-dev 
frappe 16.0.0-dev 

Steps to reproduce the issue

	def transform_pdf(self, output=None):
		from pypdf import PdfWriter

		header = self.header_pdf
		body = self.body_pdf
		footer = self.footer_pdf

                # issue
		if not header and not footer:
			return body

...

		if output:
			output.append_pages_from_reader(body)
			return output

When the parameter output is specified, the transform_pdf function should return output.

but if output is set and if not header and not footer , transform_pdf return body. This is incorrect.

It should:

output.append_pages_from_reader(body)
return output

Observed result

Expected result

Stacktrace / full error message

(paste here)

Additional information

OS version / distribution, Frappe install method, etc.

GitHub Labels

bug

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!

Loading labels...

Details

Points10 pts
Difficultylow
Scopeclear
Skill Matchyes
Test Focusedno
Assigneeiamejaaz