"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xhtml2pdf/builders/watermarks.py" between
xhtml2pdf-0.2.7.tar.gz and xhtml2pdf-0.2.8.tar.gz

About: xhtml2pdf is a HTML/CSS to PDF converter written in Python.

watermarks.py  (xhtml2pdf-0.2.7):watermarks.py  (xhtml2pdf-0.2.8)
skipping to change at line 116 skipping to change at line 116
if not bgfile.notFound(): if not bgfile.notFound():
yield range(page, pages[counter]), bgfile, int(pgcontext['st ep']) yield range(page, pages[counter]), bgfile, int(pgcontext['st ep'])
counter+=1 counter+=1
@staticmethod @staticmethod
def process_doc(context, istream, output): def process_doc(context, istream, output):
pdfoutput = PyPDF3.PdfFileWriter() pdfoutput = PyPDF3.PdfFileWriter()
input1 = PyPDF3.PdfFileReader(istream) input1 = PyPDF3.PdfFileReader(istream)
has_bg=False has_bg=False
for pages, bgouter, step in WaterMarks.get_watermark(context, input1.num Pages): for pages, bgouter, step in WaterMarks.get_watermark(context, input1.num Pages):
bginput = PyPDF3.PdfFileReader(bgouter.getBytesIO())
for index, ctr in enumerate(pages): for index, ctr in enumerate(pages):
bginput = PyPDF3.PdfFileReader(bgouter.getBytesIO())
pagebg = bginput.getPage(0) pagebg = bginput.getPage(0)
page = input1.getPage(ctr-1) page = input1.getPage(ctr-1)
if index%step == 0: if index%step == 0:
page.mergePage(pagebg) pagebg.mergePage(page)
page = pagebg
pdfoutput.addPage(page) pdfoutput.addPage(page)
has_bg=True has_bg=True
if has_bg: if has_bg:
pdfoutput.write(output) pdfoutput.write(output)
return output, has_bg return output, has_bg
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)