The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,226 other subscribers

Google Calendar – printing multiple months or weeks to PDF – URL parameter tips and tricks

Posted by jpluimers on 2010/06/28

Recently, I had to print multiple months or weeks from within Google Calendar.
The default UI does not allow that, but it is in fact pretty easy to do.

These are the steps to get PDF versions of a whole year.

Edit 20100714: thanks to Kilian Croese, I could explain a few more parameters, and cut out the steps for Fiddler, so it now works with most browsers on most platforms.
All text that is not relevant any more is marked deleted, so you can still read it if you want to use Fiddler.
It works from Google Chrome and Internet Explorer on Windows (FireFox works if you install FiddlerHook)

  1. Download, install and start HTTP fiddler 2
    (this allows you to see what HTTP traffic takes place between your web-browser and the Google calendar web-server)
  2. Open http://calendar.google.com, login, and browse to a month or week that needs to be in the printing range
  3. On the left select the calendars you want to see printed
  4. Click the print link (you’ll get a popup window with an image similar to the one on the right)
  5. In fiddler, look for the URL that looks like this one below, then press Ctrl-U to copy it to the clipboard:
    right-click on the calendar image, then copy the URL to the clipboard; it looks like this:
    http://www.google.com/calendar/printable?dates=20100621%2F20100628&pgsz=letter&hl=en&ctz=Europe%2FAmsterdam&mode=WEEK&wkst=2&src=ZHUwbHRscGdibjVqODhlbW1uMXZkZnQwMWdAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ&src=YTFkZHFnYjRxMTEwdDY4c2JrcG1pamFxYjRubjZzbzFAaW1wb3J0LmNhbGVuZGFyLmdvb2dsZS5jb20&src=ZHV0Y2hfX2VuQGhvbGlkYXkuY2FsZW5kYXIuZ29vZ2xlLmNvbQ&src=cCN3ZWVrbnVtQGdyb3VwLnYuY2FsZW5kYXIuZ29vZ2xlLmNvbQ&psdec=true&pft=png&rand=1277562185852
    (I’ll explain a bit more about the parameters a few paragraphs downward).
  6. Paste the URL in your favourite text editor
  7. replace “pgsz=letter” with “pgsz=a4
  8. remove the “&pft=png&rand=1277562185852” (so you get a multi-page PDF in stead of a single page PNG)
  9. replace the
    20100329%2F20100503” with
    20100101%2F20101231” (for exactly one year) or
    20091228%2F20101231” (for a PDF starting on monday 20091228)

I ended up with these URLs:

Furthermore, https://calendar.google.com/calendar/embedhelper generates a subset of the below parameters for https://calendar.google.com/calendar/embed based URLs.

Hope this helps a few people.

As promised a few notes on the URL parameters (Edit 20100714: thanks Kilian Croese, who toke the time to check out all options in the pop-up window; I marked your additions with “new“):

  • src parameters contain base64 encoded numbers referring to the selected calendars
    (since these calendars are public, I don’t mind sharing the values with you)
  • dates=20100621%2F20100628
    holds the start and ending date both ISO 8601 encoded as YYYYMMDD, separated by a %2F which is the ASCII code for the slash character (/)
  • pgsz=letter
    determines the page size (now letter; you can replace this with a4 and probably legal – I’m European, and we like A4)
  • hl=en
    indicates the language for the calendar; probably ISO 3166-1 encoded
    en is English,
    nl is Dutch.
  • ctz=Europe%2FAmsterdam
    Current Time Zone; Google probably uses Java, as I have also seen Africa/Windhoek as a value.
    Java has the nice TimeZone.GetAvailableIDs function for which the javaworld.com site has a nice example showing all the time zones.
  • mode=WEEK
    Print mode. I have seen MONTH and AGENDA here as well. DAY is also supported (edited 20170726; as per [WayBack] Kai Carver who also mentions these values can be in lower-case at [WayBackUse a custom URL to get a customized printable version of Google Calendar – Stack Overflow)
  • wkst=2
    I have no idea what this means :-)
  • psdec=true
    Prints descriptions declined appointments (true) or not (false)
  • pft=png
    Print file type is PNG (png) or PDF (leave this parameter away)
  • rand=1277562185852
    Some random number (looks like a JavaScript EPOCH value; leave it out and google will insert a fresh one.
  • pfs=NORMAL
    new: Fontsize, with these possible values: SMALLEST, SMALLER, SMALL, NORMAL, BIG, BIGGER, BIGGEST
    somehow this make me feel it is related to CSS font sizes.
  • po=AUTO
    new: Page Orientation, with these possible values: AUTO (seems to always map to LANDSCAPE), PORTRAIT, LANDSCAPE.
  • pbw=false
    new: Prints in black and white (false) or color (true)
  • pjs=false
    Insert “Print JavaScript” into the PDF (true) or just loads the PDF (false)
    The JavaScript inserted in the PDF looks like this: “/S/JavaScript/JS(this.print\({bUI: true,bSilent: false,bShrinkToFit: true}\);)
  • pda=false
    Prepare the PDF for download (true) or printing (false)

–jeroen

19 Responses to “Google Calendar – printing multiple months or weeks to PDF – URL parameter tips and tricks”

  1. Sara said

    I wanted to get a large range of weeks (~6 months) and it kept coming up with a 5-day week printed on a page. But, when it displayed on the browser window directly from GCal, it showed 7 day weeks. I started, then looking at print ranges beyond 4 weeks. 5 was ok, as was 6, but not 7. So it appears as if you can print 6 weeks at a time in week view, but not more than that.

  2. All About Mail…

    […]Google Calendar – printing multiple months or weeks to PDF « The Wiert Corner – irregular stream of Wiert stuff[…]…

  3. […] In the past I wrote about a Simple example to show DateTime.Now in ISO 8601 format on ideone.com | Online C# Compiler & Debugging Tool , using ISO 8601 in batch-files, and how ISO 8601 is used in Google Calendar URLs. […]

  4. […] Comments Noah on Google Calendar – printi…jpluimers on Removing the VMWare Server SSL…IL on Removing the VMWare Server […]

  5. Noah said

    Thanks for this – wish this was built into GCal, but this worked a treat for me!

  6. mcbarley said

    Thank you so much…now if only I could get a two-week view to do this…

  7. Chris said

    it looks like wkst means “week start”, i.e., Sunday = 1, Monday = 2, etc.

  8. […] Comments jpluimers on Google Calendar – printi…Kilian Croese on Google Calendar – printi…Kilian Croese on Google Calendar – […]

  9. Another option: &pbw=false/true To print in Black and White or not.

    (Maybe your could/want to merge all these comments?)

  10. The &pfs parameter seems to be for the Font Size, with one of the following options: SMALLEST | SMALLER | SMALL | NORMAL | BIG | BIGGER | BIGGEST

    (sorry for the multiple replies, couldn’t figure out how to change a reply)

  11. Than something else. I’m just playing around with it now. You can use the &po parameter with the value of LANDSCAPE or PORTRAIT

    for example &po=PORTRAIT for portrait orientated printing.

    There is also a &pfs parameter, but i haven’t figured out yet what that is for.

  12. You don’t really need to use fiddler. To make things even easier. Just right click on the preview image and copy the Image Location. This will get the same URL as in step 5, but without using Fiddler, which might be to advanced for some people.

    -Kilian

    • jpluimers said

      Thx! I’ll be editing my post because of your replies.
      Don’t worry about sending multiple replies; having them in ‘one bite at a time’ is easier for many people.
      –jeroen

  13. Taryn said

    me again – when I reread your post, I realised that I can do what I want to do, but now the problem is that the URL is not showing up in fiddler. The only google related URLs coming up are CONNECT hosted. I’m using Chrome as my browser.

    • jpluimers said

      You are probably using HTTPS in your Google Calendar connection, decrypting HTTPS traffic in Fiddler is a lot more difficult than capturing unencrypted HTTP traffic.
      So: try using HTTP in stead of HTTPS when connecting to Google Calendar.

      –jeroen

  14. Taryn said

    hi there – thanks for this! does this apply to ranges more than 5 weeks? I’m wanting to print a 12 week range on one page.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: