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

  • Home
  • SEARCH
  • 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 7766385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:24:11+00:00 2026-06-01T15:24:11+00:00

How do I go about creating a 3 col landscape layout using xhtml2pdf? I

  • 0

How do I go about creating a 3 col landscape layout using xhtml2pdf?

I tried something like this but it didn’t work. Should I even be using frames in the first place?

@page {
    size: a4 landscape;

    @frame left {
        -pdf-frame-content: left;
        -pdf-frame-border: 1;
        width: 9.9cm;
        text-align: left;
    }
    @frame middle {
        -pdf-frame-content: middle;
        -pdf-frame-border: 1;
        width: 9.9cm;
        text-align: left;
    }
    @frame right {
        -pdf-frame-content: left;
        -pdf-frame-border: 1;
        width: 9.9cm;
        text-align: left;
    }
}
  • 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-01T15:24:12+00:00Added an answer on June 1, 2026 at 3:24 pm

    I don’t think it can be done with xhtml2pdf even though its based on reportlab which allows you to do it.

    After messing with it for a while, the following snippet produces the following image: https://i.stack.imgur.com/poJox.jpg

    def badge(request):
        # Create the HttpResponse object with the appropriate PDF headers.
        response = HttpResponse(mimetype='application/pdf')
        response['Content-Disposition'] = 'attachment; filename=somefilename.pdf'
    
        # Create the PDF object, using the StringIO object as its "file."
        pagesize = pagesizes.landscape(letter)
        pagewidth, pageheight = pagesize
        doc = platypus.BaseDocTemplate(filename=response, pagesize=pagesize,
                showBoundary=1)
        newHeight = doc.bottomMargin + doc.topMargin + doc.height
        newWidth = doc.leftMargin + doc.rightMargin + doc.width
    
        # reset margins
        doc.leftMargin = 0
        doc.bottomMargin = 0
        doc.rightMargin = 0
        doc.topMargin = 0
    
        # create the frames
        frames = []
        left_frame_1 = Frame(doc.leftMargin,
                doc.bottomMargin,
                newWidth / 3,
                newHeight / 6,
                showBoundary=1,
                id="left_frame_1")
        left_frame_2 = Frame(doc.leftMargin,
                doc.bottomMargin + newHeight / 6,
                newWidth / 3,
                newHeight / 6,
                showBoundary=1,
                id="left_frame_2")
        left_frame_3 = Frame(doc.leftMargin,
                doc.bottomMargin + newHeight / 6 * 2,
                newWidth / 3,
                newHeight / 6,
                showBoundary=1,
                id="left_frame_3")
        left_frame_4 = Frame(doc.leftMargin,
                doc.bottomMargin + newHeight / 6 * 3,
                newWidth / 3,
                newHeight / 6,
                showBoundary=1,
                id="left_frame_4")
        left_frame_5 = Frame(doc.leftMargin,
                doc.bottomMargin + newHeight / 6 * 4,
                newWidth / 3,
                newHeight / 6,
                showBoundary=1,
                id="left_frame_5")
        left_frame_6 = Frame(doc.leftMargin,
                doc.bottomMargin + newHeight / 6 * 5,
                newWidth / 3,
                newHeight / 6,
                showBoundary=1,
                id="left_frame_6")
        mid_frame_1 = Frame(doc.leftMargin + newWidth / 3,
                doc.bottomMargin,
                newWidth / 3,
                newHeight / 6 * 4,
                showBoundary=1,
                id="mid_frame_1")
        mid_frame_2 = Frame(doc.leftMargin + newWidth / 3,
                doc.bottomMargin + newHeight / 6 * 4,
                newWidth / 3,
                newHeight / 6 * 2,
                showBoundary=1,
                id="mid_frame_2")
        right_frame_1 = Frame(doc.leftMargin + newWidth / 3 * 2,
                doc.bottomMargin,
                newWidth / 3,
                newHeight / 6 * 2,
                showBoundary=1,
                id="right_frame_1")
        right_frame_2 = Frame(doc.leftMargin + newWidth / 3 * 2,
                doc.bottomMargin + newHeight / 6 * 2,
                newWidth / 3,
                newHeight / 6 * 3,
                showBoundary=1,
                id="right_frame_2")
        right_frame_3 = Frame(doc.leftMargin + newWidth / 3 * 2,
                doc.bottomMargin + newHeight / 6 * 5,
                newWidth / 3,
                newHeight,
                showBoundary=1,
                id="right_frame_3")
    
        frames.append(left_frame_1)
        frames.append(left_frame_2)
        frames.append(left_frame_3)
        frames.append(left_frame_4)
        frames.append(left_frame_5)
        frames.append(left_frame_6)
        frames.append(mid_frame_1)
        frames.append(mid_frame_2)
        frames.append(right_frame_1)
        frames.append(right_frame_2)
        frames.append(right_frame_3)
    
        Elements = []
    
        styles = getSampleStyleSheet()
    
        # LEFT COL CONTENT
        Elements.append(Paragraph("LEFT1, " * 10,
            styles['Normal']))
        Elements.append(FrameBreak())
        Elements.append(Paragraph("LEFT2, " * 10,
            styles['Normal']))
        Elements.append(FrameBreak())
        Elements.append(Paragraph("LEFT3, " * 10,
            styles['Normal']))
        Elements.append(FrameBreak())
        Elements.append(Paragraph("LEFT4, " * 10,
            styles['Normal']))
        Elements.append(FrameBreak())
        Elements.append(Paragraph("LEFT5, " * 10,
            styles['Normal']))
        Elements.append(FrameBreak())
        Elements.append(Paragraph("LEFT6, " * 10,
            styles['Normal']))
        Elements.append(FrameBreak())
    
        # MID COL CONTENT
        Elements.append(Paragraph("MID_2, " * 20,
            styles['Normal']))
        Elements.append(FrameBreak())
        Elements.append(Paragraph('''
        <para><b>NOTE</b><br />
        (1) Please check the registration handy kit to ensure you have received
        the item(s) as marked on the cover. <br />
        (2) The official receipt(s) for the payments you have made are enclosed.
        Please check to ensure that it was issued correctly. <br />
        (3) You will be requested to present the appropriate coupon(s)/ ticket (s)
        for admission to lunch, banquet or other events. <br />
        (4) The organizer nor its appointed Professional Conference Organiser shall
        not be responsible for any loss or damage to this kit <br />
        </para>
        ''', styles['Normal']))
        Elements.append(FrameBreak())
    
        # RIGHT COL CONTENT
        Elements.append(Paragraph("RIGHT_1 " * 30,
            styles['Normal']))
        Elements.append(FrameBreak())
        Elements.append(Paragraph('''
        <para><b><font size="16">REGISTRATION Handy Kit</font></b> <br />
        This kit contains the checked items: <br />
        [] Namebadge <br />
        [] Official Receipt(s) <br />
        [] Lunch Coupon(s) <br />
        [] Banquet Ticket & Reply Slip <br />
        [] Others: <br />
        _________________________________
        _________________________________
        _________________________________
        _________________________________
        <br />
        <br />
        <br /> 
        <i>If any of the checked items are missing in your kit, please inform the
        registration counter staff</i>
        </para>
        ''', styles['Normal']))
        Elements.append(FrameBreak())
        Elements.append(Paragraph("RIGHT_3, " * 10,
            styles['Normal']))
    
        doc.addPageTemplates(platypus.PageTemplate(id="TwoCol", frames=frames))
        doc.build(Elements)
    
        return response
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How would you go about creating something like this http://www.bikingboss.com/ (move your mouse horizontally).
I am confirming about creating activity. My Manifest.xml is like this : <application android:icon=@drawable/icon
How would I go about creating a UITextField like the one in this image?
How would I go about creating the following layout using tablelayout? Column spanning is
How do you go about creating a sphere with meshes in Direct-x? I'm using
How should I go about creating a cron expression that will fire every 90
I have been reading about creating offline websites using Gears and using HTML 5.
In this question about creating a new perl module , it was suggested to
I'm thinking about creating a location-aware iPhone app that could work offline by coming
How do I go about creating the following layout in Android? I want a

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.