|
|
|
@ -16,7 +16,7 @@
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 81,
|
|
|
|
|
"execution_count": null,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
@ -26,7 +26,7 @@
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 87,
|
|
|
|
|
"execution_count": null,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
@ -35,81 +35,11 @@
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 88,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"name": "stdout",
|
|
|
|
|
"output_type": "stream",
|
|
|
|
|
"text": [
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n",
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n",
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n",
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n",
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n",
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxx\n",
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n",
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"execution_count": null,
|
|
|
|
|
"metadata": {
|
|
|
|
|
"scrolled": true
|
|
|
|
|
},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"# Simple fill-up of a page, to set the reach of our canvas\n",
|
|
|
|
|
"lines = [] # All the lines will be stored here\n",
|
|
|
|
@ -129,7 +59,7 @@
|
|
|
|
|
},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"# Another variation\n",
|
|
|
|
|
"# Another way to fill-up the page\n",
|
|
|
|
|
"import random \n",
|
|
|
|
|
"\n",
|
|
|
|
|
"lines = []\n",
|
|
|
|
@ -149,14 +79,17 @@
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 90,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"execution_count": null,
|
|
|
|
|
"metadata": {
|
|
|
|
|
"scrolled": true
|
|
|
|
|
},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"# Same variation, but with multiple pages\n",
|
|
|
|
|
"# Same as above + a \"switch\" to make multipaged PDFs\n",
|
|
|
|
|
"import random \n",
|
|
|
|
|
"\n",
|
|
|
|
|
"multipage = True\n",
|
|
|
|
|
"number_of_pages = 100\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"lines = []\n",
|
|
|
|
|
"pages = []\n",
|
|
|
|
@ -164,7 +97,7 @@
|
|
|
|
|
"txt = open('txt/language.txt', 'r').read()\n",
|
|
|
|
|
"words = txt.split()\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"for page in range(100):\n",
|
|
|
|
|
"for page in range(number_of_pages):\n",
|
|
|
|
|
" \n",
|
|
|
|
|
" for linenumber in range(height):\n",
|
|
|
|
|
" word = random.choice(words)\n",
|
|
|
|
@ -176,7 +109,10 @@
|
|
|
|
|
" # Add a page\n",
|
|
|
|
|
" pages.append(lines)\n",
|
|
|
|
|
" lines = []\n",
|
|
|
|
|
" "
|
|
|
|
|
"\n",
|
|
|
|
|
"for page in pages:\n",
|
|
|
|
|
" print('\\n'.join(page))\n",
|
|
|
|
|
" print('-' * width)"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
@ -209,7 +145,7 @@
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 91,
|
|
|
|
|
"execution_count": null,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
@ -220,7 +156,7 @@
|
|
|
|
|
"pagewidth = 210*mm\n",
|
|
|
|
|
"pageheight = 297*mm\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"c = Canvas(\"pdf/ASCII-canvas-to-PDF.pdf\", pagesize=(pagewidth, pageheight), bottomup=0)\n",
|
|
|
|
|
"c = Canvas(\"ASCII-canvas-to-PDF.pdf\", pagesize=(pagewidth, pageheight), bottomup=0)\n",
|
|
|
|
|
"c.setFont('Courier', 12)\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"start_y = 10*mm # start position of the lines\n",
|
|
|
|
@ -242,13 +178,6 @@
|
|
|
|
|
" \n",
|
|
|
|
|
"c.save()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": null,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": []
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|