Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8250155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:47:35+00:00 2026-06-07T23:47:35+00:00

I have a Pyramid web application that uses an internal web service to convert

  • 0

I have a Pyramid web application that uses an internal web service to convert some data into a PDF file using reportlab. This works great, but only one PDF file is generated at a time. The client now wants to be able to print (it can be zipped up, instead of an actual print through a printer) multiple PDF files.

I currently have this piece of code at the bottom:

    result = {"sales_order_data": {"sales_order_list": order_pdf_data}}
    encoded_result = urllib.urlencode(result)
    received_data = requests.post('http://convert_to_pdf/sales_order', data=encoded_result)
    pdf_file = received_data.content
    content_disposition = received_data.headers['Content-Disposition']

    res = Response(content_type='application/pdf', content_disposition=content_disposition)
    res.body = pdf_file
    return res

The pdf_file is the binary form of the PDF file. I was thinking of running my pdf conversion code multiple times and each time storing the pdf binary data in a list of sorts and then using StringIO and ZipFile to zip a bunch of the files together.

I’m not too sure if this is possible:

list_of_pdf_files = []
for order in list_of_orders:
    <processing of data here>
    result = {"sales_order_data": {"sales_order_list": order_pdf_data}}
    encoded_result = urllib.urlencode(result)
    received_data = requests.post('http://convert_to_pdf/sales_order', data=encoded_result)
    pdf_file = received_data.content
    list_of_pdf_files.append(pdf_file)

zipped_file = <What do I do here to zip the list of pdf files?>   
content_disposition = 'attachment; filename="pdf.zip"'
res = Response(content_type='application/zip', content_disposition=content_disposition)
res.body = zipped_file
return res

What do I do after getting a list of binary pdf files so that I can generate a zipped file in-memory and return that file via content-disposition as the response?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T23:47:36+00:00Added an answer on June 7, 2026 at 11:47 pm

    Use ZipFile.writestr() to write the PDF files one at a time to the archive.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a pyramid web application that uses SQLAlchemy. I have a
first of all thanks for reading. I have a web application that heavily uses
I have a Pyramid application which uses request.environ['REMOTE_ADDR'] in some places. The application is
I have a typical Pyramid web application setup. The application directory (I don't know
I am using latest Pyramid to build a web app. Somehow we have started
I'm hoping to write a custom data model for my web application that exists
I have a Pyramid app that uses Chameleon for its templates. I would like
I am using pyramid to create a web application. I am then using pyramid-beaker
I have a Pyramid application using Beaker Encrypted cookie sessions. I can log a
I have a fairly complex app that uses celery, mongo, redis and pyramid. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.