image - Producing a printable calendar with Python -


How can I create a printable PDF file (US letter size) such that every page is a month Represents and divides in such a way that the day of the month gets a box of equal size? What if I want to leave the weekend and only want to work in weekdays?

Which Python module will I use to complete the following? :

  1. Splitting the image, such as the day of every day.
  2. Repeat 2-3 steps for all months in a fixed year
  3. Creating a PDF as a Production

    You can do it with 3 packages. To create a PDF, 'report lab', 'Calendar' to get the month as lists, and dragon binding PDF for 'ghostscript' to convert to PGF.

    You will start receiving data from the calendar package, in the U.S. Using the REPUBLOW to create a page of letter size. The table can be manipulated to make a grid, each cell should be placed in a box of the same size and the text font, size and alignment must be changed.

    You want it to be only a PDF, or you can convert this PDF into an image Ghostscript Python binding or if you want you can use only the system ('GS ...' Ghostscript 'can run. In addition, ghostscript should be installed for the work of Python 'ghostscript' package.

    If you want to filter all weekends, then you can use the manipulation of the good old-fashioned list on calendar data for this.

    Here's an example of how you can create a PDF. I am not going for a full year in a month, and I am not bothering to filter zero.

      reportlab.lib.units Import from Inc. reportlab.lib Reportlab.lib.pagesizes Import importLabel.platypus import import letters from SimpleDocTemplate, Table, TableStyle reportlab.graphics.shapes Import Import Calendar doc = SimpleDocTemplate ('calendar.pdf', pagesize = letter) cal = [['Mon', 'Mars', 'Mercury', 'Guru', 'Venus', 'Saturn', 'Sun']] cal.extend Table (Table 9 (Table 9 (Table 9 (Table ([9]) Table = Table (cal, 7 * [inch], ('font', (0, LAN) * [inch]) table. (0, 0), (-1, -1), 'helvetica' 0), (-1, 0), 'helvetica-bold', ('fontsize', (0, 0), (-1, - 1), 8), ('Ingrid', (0, 0) (-1, -1), 0.25, black), ('box', (0, 0), (-1, -1), 0.25, color. Green, ('ALIGN', (0 , 0), (1, -1), 'center'), ('VALIGN', (0, 0), (-1, -1), 'middle'),]) # this doctor with pdf Create ([Table])   

    If you want to add PageBr to any other page after the next calendar in the list given to Eak () doc.build (). PageBreak is part of reportlab.platypus.

      import ghostscript args = ['gs', #it What is 1 place in' -dSAFER ',' -dBATCH ',' -dNOPAUSE ',' -sDEVICE = png16m ',' -r100 ',' -sOutputFile = calendar.png ',' calendar.pdf '] ghostscript.sgostscript (* args)   

    Both report labels and ghost text packages are available through the use of PIP. I have made the above mentioned in an 'virtualenv' environment.

    ReportLab

    Ghostscript Python Binding

    The Calendar is part of the standard Python Library.

    / div>

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -