[reportlab-users] Changing from Landscape to Portrait orientation in the same document.

Winn Ketchum winn at rangeandwater.com
Wed Feb 27 17:10:49 EST 2013


Hello Everyone,



I have a newbie question (should be simple to answer) that has been
bugging me for the past day or so and after pouring over all online
posts related to reportlab still can't be figured out. All I am trying
to do is switch from landscape to portrait orientation in the same
document. This will allow me to create a table of features (including
links to the pictures of these within the table) and then put in the
pictures so they can be linked to.



Here is the code I have come up with so far to facilitate what should be
a straight forward process:

from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY

from reportlab.lib import colors

from reportlab.lib.pagesizes import letter, landscape

from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer,
Image, Frame, Table, TableStyle, NextPageTemplate, PageTemplate,
BaseDocTemplate

from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle

from reportlab.lib.units import inch

from reportlab.platypus.flowables import Flowable, PageBreak

from pyPdf import PdfFileReader, PdfFileWriter

import glob, os

from reportlab.lib.pagesizes import letter, A4



doc = BaseDocTemplate("M:\GIS Mapping Services\Promotional\Automated
Reports\PDF_ReportLab\NextPageExample.pdf",showBoundary=1,pagesize=lands
cape(letter))

elements = []

styles = getSampleStyleSheet()

styles.add(ParagraphStyle(name='normal', fontSize=6, leading = 7,
alignment=TA_LEFT))



ptemplate = PageTemplate(id='portrait', pagesize=portrait(letter))

elements.append(Paragraph("Table is here.",styles["normal"]))

elements.append(NextPageTemplate('portrait'))

elements.append(PageBreak())

elements.append(Paragraph("Pictures are to be placed
here.",styles["normal"]))



doc.build(elements)

del elements



If you have any tips or would like to help me out with this can you
please be specific and show me exactly what I am doing wrong or include
a working example that goes from start to finish without any coding
missing.



Thank you in advance for your help,



Winn

Winn A. Ketchum

GIS Analyst

Western Range & Water, Inc.

623 E Main Ave

Suite 202

West Fargo, ND 58078

Phone (701) 281-4995

winn at rangeandwater.com







Confidentiality Warning: This message and any attachments are intended
only for the use of the intended recipient(s), are confidential, and may
be privileged. If you are not the intended recipient, you are hereby
notified that any review, retransmission, conversion to hard copy,
copying, circulation or other use of all or any portion of this message
and any attachments is strictly prohibited. If you are not the intended
recipient, please notify the sender immediately by return e-mail, and
delete this message and any attachments from your system.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20130227/dc1cc7f7/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 8582 bytes
Desc: image001.jpg
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20130227/dc1cc7f7/attachment-0001.jpe>


More information about the reportlab-users mailing list